Compare commits
239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c250fa560e | |||
| b017e8690a | |||
| 8a9680e75c | |||
| 36c66e676a | |||
| ba530061a0 | |||
| 89ae3bc143 | |||
| 3951f59d09 | |||
| cd8c998ebf | |||
| 2cb544591b | |||
| 1b1b5c047c | |||
| fa5b9e5689 | |||
| c26df8da6f | |||
| 1e02d85fca | |||
| d1dc2331f8 | |||
| d503deb8c5 | |||
| 0859b92aaf | |||
| 695d26434c | |||
| a19de645e4 | |||
| de9a27db10 | |||
| b6d5b7d603 | |||
| 93d7cf4dc3 | |||
| 0c42596dc8 | |||
| 8cf9c1ba97 | |||
| 7a47d63b48 | |||
| 4648a8c103 | |||
| 87947871d1 | |||
| 87fee572ff | |||
| 89f7a3ec63 | |||
| 7092a9ccbb | |||
| e9ea9b5e1b | |||
| fd1efb29ec | |||
| cf4781153e | |||
| ebed142cd5 | |||
| d162aba14a | |||
| ec075f5807 | |||
| dca90e6316 | |||
| df31fafec5 | |||
| 828dc64035 | |||
| 0b74164a8e | |||
| 62be1b1267 | |||
| 85ae7e764f | |||
| 3daa624627 | |||
| d8af1aaf7b | |||
| f2d105d8b9 | |||
| 5b0a8c0668 | |||
| c3ccf3a609 | |||
| 60bbede408 | |||
| 1d0299af89 | |||
| c2d0e255df | |||
| 005d3e7d64 | |||
| 12f8638223 | |||
| e3f9e8c842 | |||
| a475f72d50 | |||
| a559ef9f90 | |||
| be83302b14 | |||
| 83d7ea9ef1 | |||
| 95024442de | |||
| 69f54b5f22 | |||
| 3404f95b2e | |||
| e56738481b | |||
| cb59dc353b | |||
| d1b75eac08 | |||
| 8fabd4e4ed | |||
| 564d92bed7 | |||
| 95f103ccc2 | |||
| 0ace2fdae7 | |||
| 5da3541584 | |||
| ef86d2f1f1 | |||
| a10a6d1af8 | |||
| 6d87174cc1 | |||
| 9af9c3fe77 | |||
| 9cedf5da4c | |||
| 906d675dca | |||
| f1b3105202 | |||
| 3ebb213916 | |||
| a65ca205de | |||
| 3e1120612b | |||
| 8d06d39a62 | |||
| da7fea47c6 | |||
| f2442b25f6 | |||
| 300d3ff09b | |||
| e6337b8f14 | |||
| 2be785ace3 | |||
| 5e2d991fab | |||
| 536cb4caf1 | |||
| 27745ea141 | |||
| 5289c55740 | |||
| 791773fc8a | |||
| 1da27e6c2b | |||
| a909b7904e | |||
| 1b1abce7da | |||
| fbc10be381 | |||
| 61f2647b62 | |||
| a5bea7fc59 | |||
| b9be5c2561 | |||
| 97556de447 | |||
| d5bde0d8df | |||
| cc5ca0b5fe | |||
| 0cb9cc6840 | |||
| d38d7b1ff4 | |||
| 2d87f933d5 | |||
| a734a0cff7 | |||
| d0ace55d03 | |||
| 3fda0308ac | |||
| d796b2afc1 | |||
| f95cfc2ee0 | |||
| c5d1439422 | |||
| 5e9f4559b6 | |||
| 4bbb0441a6 | |||
| 4cf1d7d9a4 | |||
| a6a3ddca75 | |||
| 27cfa85d3a | |||
| a9e1e7b634 | |||
| 9f5f920c81 | |||
| f9a0d91299 | |||
| 82c2560822 | |||
| f467b8cb6c | |||
| aea1a03453 | |||
| 1568e5f19c | |||
| 8dff47db78 | |||
| 987e48733a | |||
| ac5142443a | |||
| 44360d83aa | |||
| 021cb817d4 | |||
| f4f91fba78 | |||
| dec5e8ad6c | |||
| a6b2196c10 | |||
| 4321c8d24e | |||
| 4cff3a3c28 | |||
| 5458c9a310 | |||
| 0045ec353f | |||
| 716d3e95f1 | |||
| beeb28f390 | |||
| 080e8816a5 | |||
| f7eb323bd5 | |||
| 0f484fdf49 | |||
| d779422bf4 | |||
| 11ea698969 | |||
| 0e0e6b5c41 | |||
| 4c218621c6 | |||
| c150a91e50 | |||
| 7be9a0a987 | |||
| 50589c0911 | |||
| e61ae618e8 | |||
| 930e6a0989 | |||
| 7c50b32684 | |||
| 0f7daf7ebd | |||
| 12cbc2a9c5 | |||
| 959d263619 | |||
| 6a1fb52b25 | |||
| 18cd043421 | |||
| ddb2f82aba | |||
| 6c99e7951f | |||
| e44e745761 | |||
| 30c11439e4 | |||
| 0883f621f6 | |||
| 2d0784d1e5 | |||
| af0011f32a | |||
| ab6c5ac21a | |||
| 227a38fb98 | |||
| 06f9dee649 | |||
| 75680192bb | |||
| a53efb394f | |||
| 98ed32c8cf | |||
| df10ebebca | |||
| 88dc73cd66 | |||
| cd0919aeeb | |||
| ce6711b587 | |||
| 6cb3fcf9ad | |||
| e5878554bd | |||
| 44c8c4b5b8 | |||
| c0b5525dd7 | |||
| 36f8a8e1dd | |||
| 16f73b56ab | |||
| 47dc2e6214 | |||
| c6483f0380 | |||
| 168b38b2a3 | |||
| 70ca4ac913 | |||
| 72099192b5 | |||
| ea48128869 | |||
| f0b22146c8 | |||
| fe0d94687a | |||
| 238c3d38e8 | |||
| 6af4f1f2c6 | |||
| e215fb056f | |||
| e6178efcfb | |||
| 30cf0e2040 | |||
| 48d620cdb0 | |||
| 3bd487d092 | |||
| 6c8c37256b | |||
| 37b1fcbaf0 | |||
| dc111768e3 | |||
| 6589d5d5d3 | |||
| e6975a71d5 | |||
| 33b497e5f4 | |||
| c5e7c81c19 | |||
| 47d1fe7082 | |||
| 735bd574ff | |||
| 5c0d9785e0 | |||
| db14868324 | |||
| 06952833ef | |||
| 2a90e93a6f | |||
| 0d94ddb96e | |||
| c7645b55ba | |||
| 208806c027 | |||
| 8024610364 | |||
| 8e4644568b | |||
| e0a71830fa | |||
| 5b0057c258 | |||
| fb61c55fa7 | |||
| a70ef52964 | |||
| 51204ee401 | |||
| 657f165ffb | |||
| 3bd98d851a | |||
| 9eea46b19b | |||
| 76fb5d260f | |||
| 267cd46ea0 | |||
| 96f6a0161f | |||
| 7bc53adc67 | |||
| 8ecff73c18 | |||
| 35e65ad18c | |||
| 8def8eaa86 | |||
| c0774ad9b9 | |||
| f306cbe457 | |||
| 577b989c4c | |||
| e6b162f4f6 | |||
| b40cc1879f | |||
| 8a7c7bf77d | |||
| 38a1179de5 | |||
| f263b4d92b | |||
| c612727116 | |||
| ab9c9df7d6 | |||
| c607e50433 | |||
| df5555bdf1 | |||
| 9506339e6f | |||
| 68605a7560 | |||
| 839dd7315a | |||
| d148c10c66 | |||
| 2b573b9070 |
@@ -2,7 +2,6 @@
|
||||
syntax: glob
|
||||
|
||||
*.obj
|
||||
*.exe
|
||||
*.pdb
|
||||
*.user
|
||||
*.aps
|
||||
@@ -58,4 +57,6 @@ src/Umbraco.Tests/config/umbracoSettings.config
|
||||
src/Umbraco.Web.UI/App_Plugins/*
|
||||
src/Umbraco.Web.UI/Views/*
|
||||
|
||||
src\Umbraco.Web.UI\[W]eb.config
|
||||
src\Umbraco.Web.UI\[W]eb.config
|
||||
src/packages/
|
||||
build/*.zip
|
||||
|
||||
@@ -12,3 +12,18 @@ d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
|
||||
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
|
||||
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
|
||||
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
|
||||
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0
|
||||
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
|
||||
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
|
||||
6eb5f2fb5a88aa29ea544499df9160a1b31b5638 Release-4.11.1
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
|
||||
0000000000000000000000000000000000000000 4.11.2
|
||||
73711b806a4044dbf0d7d7c095ddfdda23b09932 Release-4.11.2
|
||||
77db220b89e166b3c0736ed321ecfd6416cddbcd Release-4.11.2.1
|
||||
54cde33b809dcb3a1f7e7ae0d5375f6dd0d89c8d Release-4.11.2.2
|
||||
baa44b79cf90a60631e38e11f771c200b08a4583 Release-4.11.3
|
||||
e4d0c7e740555d8707ba71f55a623a3f96da8e65 Release-4.11.3.1
|
||||
e4d0c7e740555d8707ba71f55a623a3f96da8e65 Release-4.11.3.1
|
||||
0000000000000000000000000000000000000000 Release-4.11.3.1
|
||||
e02f5aebb87e3f07d27376647756caa9762931d8 Release-4.11.4
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec
|
||||
NuGet.exe pack NuSpecs\UmbracoCms.nuspec
|
||||
REM pause
|
||||
+17
-1
@@ -1,5 +1,21 @@
|
||||
@ECHO OFF
|
||||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj"
|
||||
set version=4.11.5
|
||||
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%version%
|
||||
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Data\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Plugins\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\css\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\macroScripts\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\masterpages\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\media\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\scripts\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\usercontrols\dummy.txt
|
||||
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\xslt\dummy.txt
|
||||
|
||||
NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
|
||||
NuGet.exe pack NuSpecs\UmbracoCms.nuspec -Version %version%
|
||||
|
||||
|
||||
if ERRORLEVEL 1 goto :showerror
|
||||
|
||||
|
||||
+11
-1
@@ -24,6 +24,9 @@
|
||||
<PropertyGroup Condition="'$(BUILD_NUMBER)'!=''">
|
||||
<DECIMAL_BUILD_NUMBER>.$(BUILD_NUMBER)</DECIMAL_BUILD_NUMBER>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(BUILD_RELEASE)'!=''">
|
||||
<DECIMAL_BUILD_NUMBER>.$(BUILD_RELEASE)</DECIMAL_BUILD_NUMBER>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildConfiguration>Release</BuildConfiguration>
|
||||
@@ -160,7 +163,7 @@
|
||||
<Message Text="Finished offsetting timestamps" Importance="high" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CompileProjects">
|
||||
<Target Name="CompileProjects" DependsOnTargets="SetVersionNumber">
|
||||
|
||||
<Message Text="Compiling web project to build\$(BuildFolder)" Importance="high" />
|
||||
<!-- For UseWPP_CopyWebApplication=True see http://stackoverflow.com/questions/1983575/copywebapplication-with-web-config-transformations -->
|
||||
@@ -232,6 +235,13 @@
|
||||
<Message Text="Finished compiling projects" Importance="high" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SetVersionNumber" Condition="'$(BUILD_RELEASE)'!=''">
|
||||
<!-- Match & replace 3 and 4 digit version numbers and -beta (if it's there) -->
|
||||
<FileUpdate Files="..\src\Umbraco.Core\Configuration\GlobalSettings.cs"
|
||||
Regex="(\d+)\.(\d+)\.(\d+)(.(\d+))?(-([a-zA-Z]+))?"
|
||||
ReplacementText="$(BUILD_RELEASE)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="AfterBuild">
|
||||
<Message Text="Hi" />
|
||||
</Target>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>UmbracoCms.Core</id>
|
||||
<version>4.11.0</version>
|
||||
<version>$version$</version>
|
||||
<title>Umbraco Cms Core Binaries</title>
|
||||
<authors>Morten Christensen</authors>
|
||||
<owners>Umbraco HQ</owners>
|
||||
@@ -26,6 +26,7 @@
|
||||
<file src="..\_BuildOutput\WebApp\bin\ICSharpCode.SharpZipLib.dll" target="lib\ICSharpCode.SharpZipLib.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\interfaces.dll" target="lib\interfaces.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Lucene.Net.dll" target="lib\Lucene.Net.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\log4net.dll" target="lib\log4net.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.Web.Helpers.dll" target="lib\Microsoft.Web.Helpers.dll" />
|
||||
<file src="..\_BuildOutput\WebApp\bin\Microsoft.Web.Infrastructure.dll" target="lib\Microsoft.Web.Infrastructure.dll" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>UmbracoCms</id>
|
||||
<version>4.11.0</version>
|
||||
<version>$version$</version>
|
||||
<title>Umbraco Cms</title>
|
||||
<authors>Morten Christensen</authors>
|
||||
<owners>Umbraco HQ</owners>
|
||||
@@ -15,7 +15,7 @@
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="UmbracoCms.Core" version="4.11.0" />
|
||||
<dependency id="UmbracoCms.Core" version="[$version$]" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
@@ -27,16 +27,19 @@
|
||||
<file src="..\_BuildOutput\WebApp\scripts\**" target="Content\scripts" />
|
||||
<file src="..\_BuildOutput\WebApp\usercontrols\**" target="Content\usercontrols" />
|
||||
<file src="..\_BuildOutput\WebApp\xslt\**" target="Content\xslt" />
|
||||
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" />
|
||||
<file src="..\_BuildOutput\WebApp\default.aspx" target="Content\default.aspx" />
|
||||
<file src="..\_BuildOutput\WebApp\Web.config" target="Content\Web.config" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Browsers\**" target="UmbracoFiles\App_Browsers" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Code\**" target="UmbracoFiles\App_Code" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Data\**" target="UmbracoFiles\App_Data" />
|
||||
<file src="..\_BuildOutput\WebApp\App_Plugins\**" target="UmbracoFiles\App_Plugins" />
|
||||
<file src="..\_BuildOutput\WebApp\config\**" target="UmbracoFiles\config" />
|
||||
<file src="..\_BuildOutput\WebApp\install\**" target="UmbracoFiles\install" />
|
||||
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
|
||||
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
|
||||
<file src="..\_BuildOutput\WebApp\Web.config" target="UmbracoFiles\Web.config" />
|
||||
<file src="..\_BuildOutput\WebApp\Global.asax" target="UmbracoFiles\Global.asax" />
|
||||
<file src="tools\install.ps1" target="tools\install.ps1" />
|
||||
<file src="tools\Readme.txt" target="tools\Readme.txt" />
|
||||
</files>
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
@ECHO OFF
|
||||
|
||||
:choice
|
||||
set /P c=WARNING! Are you sure you want to continue, this will remove all package files, view files, sqlce database, etc... Press 'Y' to auto-remove all files/folders, 'N' to cancel or 'C' to prompt for each folder removal?
|
||||
if /I "%c%" EQU "C" goto :prompt
|
||||
if /I "%c%" EQU "Y" goto :auto
|
||||
if /I "%c%" EQU "N" goto :exit
|
||||
goto :choice
|
||||
|
||||
|
||||
:prompt
|
||||
|
||||
echo Current folder: %CD%
|
||||
|
||||
echo Removing sqlce database
|
||||
del ..\src\Umbraco.Web.UI\App_Data\Umbraco.sdf
|
||||
|
||||
echo Resetting installedPackages.config
|
||||
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config
|
||||
|
||||
echo Removing plugin cache files
|
||||
del ..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*
|
||||
|
||||
echo Removing cache files and examine index
|
||||
del ..\src\Umbraco.Web.UI\App_Data\TEMP\*.*
|
||||
|
||||
echo Removing log files
|
||||
del ..\src\Umbraco.Web.UI\App_Data\Logs\*.*
|
||||
|
||||
echo Removing packages
|
||||
del ..\src\Umbraco.Web.UI\App_Data\packages\*.*
|
||||
|
||||
echo Removing previews
|
||||
del ..\src\Umbraco.Web.UI\App_Data\preview\*.*
|
||||
|
||||
echo Removing app code files (typically added by starterkits)
|
||||
del ..\src\Umbraco.Web.UI\App_Code\*.*
|
||||
|
||||
echo Removing xslt files
|
||||
del ..\src\Umbraco.Web.UI\xslt\*.*
|
||||
|
||||
echo Removing user control files
|
||||
del ..\src\Umbraco.Web.UI\UserControls\*.*
|
||||
|
||||
echo Removing masterpage files
|
||||
del ..\src\Umbraco.Web.UI\masterpages\*.*
|
||||
|
||||
echo Removing view files
|
||||
del ..\src\Umbraco.Web.UI\Views\*.*
|
||||
|
||||
echo Removing razor files
|
||||
del ..\src\Umbraco.Web.UI\macroScripts\*.*
|
||||
|
||||
echo Removing media files
|
||||
del ..\src\Umbraco.Web.UI\media\*.*
|
||||
|
||||
echo Removing script files
|
||||
del ..\src\Umbraco.Web.UI\scripts\*.*
|
||||
|
||||
echo Removing css files
|
||||
del ..\src\Umbraco.Web.UI\css\*.*
|
||||
|
||||
echo "Umbraco install reverted to clean install"
|
||||
pause
|
||||
exit
|
||||
|
||||
|
||||
|
||||
:auto
|
||||
|
||||
echo Current folder: %CD%
|
||||
|
||||
echo Removing sqlce database
|
||||
del ..\src\Umbraco.Web.UI\App_Data\Umbraco.sdf
|
||||
|
||||
echo Resetting installedPackages.config
|
||||
echo ^<?xml version="1.0" encoding="utf-8"?^>^<packages^>^</packages^> >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config
|
||||
|
||||
echo Removing plugin cache files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*) DO DEL %%A
|
||||
|
||||
echo Removing cache files and examine index
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\*.*) DO DEL %%A
|
||||
|
||||
echo Removing log files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\Logs\*.*) DO DEL %%A
|
||||
|
||||
echo Removing packages
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\packages\*.*) DO DEL %%A
|
||||
|
||||
echo Removing previews
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\preview\*.*) DO DEL %%A
|
||||
|
||||
echo Removing app code files (typically added by starterkits)
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\App_Code\*.*) DO DEL %%A
|
||||
|
||||
echo Removing xslt files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\xslt\*.*) DO DEL %%A
|
||||
|
||||
echo Removing masterpage files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\masterpages\*.*) DO DEL %%A
|
||||
|
||||
echo Removing user control files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A
|
||||
|
||||
echo Removing view files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A
|
||||
|
||||
echo Removing razor files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A
|
||||
|
||||
echo Removing media files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\media\*.*) DO DEL %%A
|
||||
|
||||
echo Removing script files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\scripts\*.*) DO DEL %%A
|
||||
|
||||
echo Removing css files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\css\*.*) DO DEL %%A
|
||||
|
||||
echo "Umbraco install reverted to clean install"
|
||||
pause
|
||||
exit
|
||||
|
||||
|
||||
|
||||
:exit
|
||||
exit
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
</configuration>
|
||||
Binary file not shown.
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
||||
|
||||
<!-- Enable the restore command to run before builds -->
|
||||
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
|
||||
|
||||
<!-- Property that enables building a package from a project -->
|
||||
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
|
||||
|
||||
<!-- Determines if package restore consent is required to restore packages -->
|
||||
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
|
||||
|
||||
<!-- Download NuGet.exe if it does not already exist -->
|
||||
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
||||
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
|
||||
<!--
|
||||
<PackageSource Include="https://nuget.org/api/v2/" />
|
||||
<PackageSource Include="https://my-nuget-source/nuget/" />
|
||||
-->
|
||||
<PackageSource Include="https://nuget.org/api/v2/" />
|
||||
<PackageSource Include="http://www.myget.org/F/umbracocore/" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
|
||||
<!-- Windows specific commands -->
|
||||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
||||
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
|
||||
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
||||
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
|
||||
<PackagesConfig>packages.config</PackagesConfig>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- NuGet command -->
|
||||
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
|
||||
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
|
||||
|
||||
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
||||
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
||||
|
||||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
||||
|
||||
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
|
||||
<!-- Commands -->
|
||||
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
|
||||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
|
||||
|
||||
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
||||
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
|
||||
RestorePackages;
|
||||
$(ResolveReferencesDependsOn);
|
||||
</ResolveReferencesDependsOn>
|
||||
|
||||
<!-- Make the build depend on restore packages -->
|
||||
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
||||
$(BuildDependsOn);
|
||||
BuildPackage;
|
||||
</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CheckPrerequisites">
|
||||
<!-- Raise an error if we're unable to locate nuget.exe -->
|
||||
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
||||
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
|
||||
<!--
|
||||
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
|
||||
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
||||
parallel builds will have to wait for it to complete.
|
||||
-->
|
||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_DownloadNuGet">
|
||||
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(BuildCommand)"
|
||||
Condition=" '$(OS)' != 'Windows_NT' " />
|
||||
|
||||
<Exec Command="$(BuildCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
</Target>
|
||||
|
||||
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<OutputFilename ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Reference Include="System.Core" />
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Net" />
|
||||
<Using Namespace="Microsoft.Build.Framework" />
|
||||
<Using Namespace="Microsoft.Build.Utilities" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
try {
|
||||
OutputFilename = Path.GetFullPath(OutputFilename);
|
||||
|
||||
Log.LogMessage("Downloading latest version of NuGet.exe...");
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.LogErrorFromException(ex);
|
||||
return false;
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
|
||||
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<EnvKey ParameterType="System.String" Required="true" />
|
||||
<EnvValue ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Using Namespace="System" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
try {
|
||||
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
|
||||
}
|
||||
catch {
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
</Project>
|
||||
@@ -9,14 +9,14 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// A resolver to return all IAction objects
|
||||
/// </summary>
|
||||
internal sealed class ActionsResolver : ManyObjectsResolverBase<ActionsResolver, IAction>
|
||||
internal sealed class ActionsResolver : LazyManyObjectsResolverBase<ActionsResolver, IAction>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="packageActions"></param>
|
||||
internal ActionsResolver(IEnumerable<Type> packageActions)
|
||||
internal ActionsResolver(Func<IEnumerable<Type>> packageActions)
|
||||
: base(packageActions)
|
||||
{
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
protected override IEnumerable<IAction> CreateInstances()
|
||||
{
|
||||
{
|
||||
var actions = new List<IAction>();
|
||||
var foundIActions = PluginManager.Current.ResolveActions();
|
||||
var foundIActions = InstanceTypes;
|
||||
foreach (var type in foundIActions)
|
||||
{
|
||||
IAction typeInstance;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="refreshers"></param>
|
||||
internal CacheRefreshersResolver(IEnumerable<Type> refreshers)
|
||||
internal CacheRefreshersResolver(Func<IEnumerable<Type>> refreshers)
|
||||
: base(refreshers)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
@@ -28,14 +28,31 @@ namespace Umbraco.Core.Configuration
|
||||
#region Private static fields
|
||||
|
||||
// CURRENT UMBRACO VERSION ID
|
||||
private const string CurrentUmbracoVersion = "4.11.0";
|
||||
private const string CurrentUmbracoVersion = "4.11.5";
|
||||
|
||||
private static string _reservedUrlsCache;
|
||||
private static readonly object Locker = new object();
|
||||
//make this volatile so that we can ensure thread safety with a double check lock
|
||||
private static volatile string _reservedUrlsCache;
|
||||
private static string _reservedPathsCache;
|
||||
private static StartsWithContainer _reservedList = new StartsWithContainer();
|
||||
private static string _reservedPaths;
|
||||
private static string _reservedUrls;
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
private const string StaticReservedPaths = "~/app_plugins/,~/install/,";
|
||||
private const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,";
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// used for unit tests
|
||||
/// </summary>
|
||||
internal static void ResetCache()
|
||||
{
|
||||
_reservedUrlsCache = null;
|
||||
_reservedPaths = null;
|
||||
_reservedUrls = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the reserved urls from web.config.
|
||||
/// </summary>
|
||||
@@ -43,11 +60,19 @@ namespace Umbraco.Core.Configuration
|
||||
public static string ReservedUrls
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
|
||||
: string.Empty;
|
||||
{
|
||||
if (_reservedUrls == null)
|
||||
{
|
||||
var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
|
||||
: string.Empty;
|
||||
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
_reservedUrls = StaticReservedUrls + urls;
|
||||
}
|
||||
return _reservedUrls;
|
||||
}
|
||||
internal set { _reservedUrls = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,10 +83,25 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
|
||||
: string.Empty;
|
||||
if (_reservedPaths == null)
|
||||
{
|
||||
var reservedPaths = StaticReservedPaths;
|
||||
//always add the umbraco path to the list
|
||||
if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath")
|
||||
&& !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace())
|
||||
{
|
||||
reservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(',');
|
||||
}
|
||||
|
||||
var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
|
||||
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
|
||||
: string.Empty;
|
||||
|
||||
_reservedPaths = reservedPaths + allPaths;
|
||||
}
|
||||
return _reservedPaths;
|
||||
}
|
||||
internal set { _reservedPaths = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,7 +221,7 @@ namespace Umbraco.Core.Configuration
|
||||
SaveSetting("umbracoConfigurationStatus", value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a setting into the configuration file.
|
||||
/// </summary>
|
||||
@@ -191,16 +231,16 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
var webConfig = new WebConfigurationFileMap();
|
||||
var vDirs = webConfig.VirtualDirectories;
|
||||
var vDir = FullpathToRoot;
|
||||
var physicalPathToRoot = FullpathToRoot;
|
||||
foreach (VirtualDirectoryMapping v in webConfig.VirtualDirectories)
|
||||
{
|
||||
if (v.IsAppRoot)
|
||||
{
|
||||
vDir = v.PhysicalDirectory;
|
||||
physicalPathToRoot = v.PhysicalDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
string fileName = String.Concat(vDir, "web.config");
|
||||
string fileName = System.IO.Path.Combine(physicalPathToRoot, "web.config");
|
||||
var xml = XDocument.Load(fileName);
|
||||
var appSettings = xml.Root.Descendants("appSettings").Single();
|
||||
|
||||
@@ -221,7 +261,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// <value>The fullpath to root.</value>
|
||||
public static string FullpathToRoot
|
||||
{
|
||||
get { return HttpRuntime.AppDomainAppPath; }
|
||||
get { return IOHelper.GetRootDirectorySafe(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -581,38 +621,42 @@ namespace Umbraco.Core.Configuration
|
||||
/// </returns>
|
||||
public static bool IsReservedPathOrUrl(string url)
|
||||
{
|
||||
// check if GlobalSettings.ReservedPaths and GlobalSettings.ReservedUrls are unchanged
|
||||
if (!object.ReferenceEquals(_reservedPathsCache, GlobalSettings.ReservedPaths)
|
||||
|| !object.ReferenceEquals(_reservedUrlsCache, GlobalSettings.ReservedUrls))
|
||||
if (_reservedUrlsCache == null)
|
||||
{
|
||||
// store references to strings to determine changes
|
||||
_reservedPathsCache = GlobalSettings.ReservedPaths;
|
||||
_reservedUrlsCache = GlobalSettings.ReservedUrls;
|
||||
|
||||
string _root = SystemDirectories.Root.Trim().ToLower();
|
||||
|
||||
// add URLs and paths to a new list
|
||||
StartsWithContainer _newReservedList = new StartsWithContainer();
|
||||
foreach (string reservedUrl in _reservedUrlsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
lock (Locker)
|
||||
{
|
||||
//resolves the url to support tilde chars
|
||||
string reservedUrlTrimmed = IOHelper.ResolveUrl(reservedUrl).Trim().ToLower();
|
||||
if (reservedUrlTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedUrlTrimmed);
|
||||
if (_reservedUrlsCache == null)
|
||||
{
|
||||
// store references to strings to determine changes
|
||||
_reservedPathsCache = GlobalSettings.ReservedPaths;
|
||||
_reservedUrlsCache = GlobalSettings.ReservedUrls;
|
||||
|
||||
string _root = SystemDirectories.Root.Trim().ToLower();
|
||||
|
||||
// add URLs and paths to a new list
|
||||
StartsWithContainer _newReservedList = new StartsWithContainer();
|
||||
foreach (string reservedUrl in _reservedUrlsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
//resolves the url to support tilde chars
|
||||
string reservedUrlTrimmed = IOHelper.ResolveUrl(reservedUrl).Trim().ToLower();
|
||||
if (reservedUrlTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedUrlTrimmed);
|
||||
}
|
||||
|
||||
foreach (string reservedPath in _reservedPathsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
bool trimEnd = !reservedPath.EndsWith("/");
|
||||
//resolves the url to support tilde chars
|
||||
string reservedPathTrimmed = IOHelper.ResolveUrl(reservedPath).Trim().ToLower();
|
||||
|
||||
if (reservedPathTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedPathTrimmed + (reservedPathTrimmed.EndsWith("/") ? "" : "/"));
|
||||
}
|
||||
|
||||
// use the new list from now on
|
||||
_reservedList = _newReservedList;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string reservedPath in _reservedPathsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
bool trimEnd = !reservedPath.EndsWith("/");
|
||||
//resolves the url to support tilde chars
|
||||
string reservedPathTrimmed = IOHelper.ResolveUrl(reservedPath).Trim().ToLower();
|
||||
|
||||
if (reservedPathTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedPathTrimmed + (reservedPathTrimmed.EndsWith("/") ? "" : "/"));
|
||||
}
|
||||
|
||||
// use the new list from now on
|
||||
_reservedList = _newReservedList;
|
||||
}
|
||||
|
||||
//The url should be cleaned up before checking:
|
||||
|
||||
@@ -25,7 +25,31 @@ namespace Umbraco.Core.Configuration
|
||||
/// </summary>
|
||||
internal class UmbracoSettings
|
||||
{
|
||||
/// <summary>
|
||||
private static bool GetKeyValue(string key, bool defaultValue)
|
||||
{
|
||||
bool value;
|
||||
string stringValue = GetKey(key);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(stringValue))
|
||||
return defaultValue;
|
||||
if (bool.TryParse(stringValue, out value))
|
||||
return value;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private static int GetKeyValue(string key, int defaultValue)
|
||||
{
|
||||
int value;
|
||||
string stringValue = GetKey(key);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(stringValue))
|
||||
return defaultValue;
|
||||
if (int.TryParse(stringValue, out value))
|
||||
return value;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config)
|
||||
/// </summary>
|
||||
internal static void ResetSetters()
|
||||
@@ -35,6 +59,7 @@ namespace Umbraco.Core.Configuration
|
||||
_useLegacySchema = null;
|
||||
_useDomainPrefixes = null;
|
||||
_umbracoLibraryCacheDuration = null;
|
||||
_trySkipIisCustomErrors = null;
|
||||
}
|
||||
|
||||
internal const string TempFriendlyXmlChildContainerNodename = ""; // "children";
|
||||
@@ -125,11 +150,32 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
EnsureSettingsDocument();
|
||||
|
||||
string attrName = null;
|
||||
var pos = key.IndexOf('@');
|
||||
if (pos > 0)
|
||||
{
|
||||
attrName = key.Substring(pos + 1);
|
||||
key = key.Substring(0, pos - 1);
|
||||
}
|
||||
|
||||
var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key);
|
||||
if (node == null || node.FirstChild == null || node.FirstChild.Value == null)
|
||||
return string.Empty;
|
||||
return node.FirstChild.Value;
|
||||
}
|
||||
if (node == null)
|
||||
return string.Empty;
|
||||
|
||||
if (pos < 0)
|
||||
{
|
||||
if (node.FirstChild == null || node.FirstChild.Value == null)
|
||||
return string.Empty;
|
||||
return node.FirstChild.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
var attr = node.Attributes[attrName];
|
||||
if (attr == null)
|
||||
return string.Empty;
|
||||
return attr.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the media library will create new directories in the /media directory.
|
||||
@@ -202,6 +248,7 @@ namespace Umbraco.Core.Configuration
|
||||
return value != null ? value.Attributes["assembly"].Value : "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of an external logger that can be used to store log items in 3rd party systems
|
||||
/// </summary>
|
||||
@@ -350,24 +397,13 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_useDomainPrefixes.HasValue)
|
||||
return _useDomainPrefixes.Value;
|
||||
bool result;
|
||||
if (bool.TryParse(GetKey("/settings/requestHandler/useDomainPrefixes"), out result))
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// default: false
|
||||
return _useDomainPrefixes ?? GetKeyValue("/settings/requestHandler/useDomainPrefixes", false);
|
||||
}
|
||||
// for unit tests only
|
||||
internal set
|
||||
{
|
||||
_useDomainPrefixes = value;
|
||||
// for unit tests only
|
||||
_useDomainPrefixes = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,31 +417,14 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (GlobalSettings.UseDirectoryUrls)
|
||||
{
|
||||
if (_addTrailingSlash.HasValue)
|
||||
return _addTrailingSlash.Value;
|
||||
bool result;
|
||||
if (bool.TryParse(GetKey("/settings/requestHandler/addTrailingSlash"), out result))
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// default: false
|
||||
return GlobalSettings.UseDirectoryUrls
|
||||
&& (_addTrailingSlash ?? GetKeyValue("/settings/requestHandler/addTrailingSlash", false));
|
||||
}
|
||||
// for unit tests only
|
||||
internal set
|
||||
{
|
||||
_addTrailingSlash = value;
|
||||
// for unit tests only
|
||||
_addTrailingSlash = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,31 +641,34 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_forceSafeAliases.HasValue)
|
||||
return _forceSafeAliases.Value;
|
||||
|
||||
string forceSafeAlias = GetKey("/settings/content/ForceSafeAliases");
|
||||
if (String.IsNullOrEmpty(forceSafeAlias))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return bool.Parse(forceSafeAlias);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// default: true
|
||||
return _forceSafeAliases ?? GetKeyValue("/settings/content/ForceSafeAliases", true);
|
||||
}
|
||||
internal set
|
||||
{
|
||||
//used for unit testing
|
||||
// used for unit testing
|
||||
_forceSafeAliases = value;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool? _trySkipIisCustomErrors;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating where to try to skip IIS custom errors.
|
||||
/// </summary>
|
||||
public static bool TrySkipIisCustomErrors
|
||||
{
|
||||
get
|
||||
{
|
||||
// default: false
|
||||
return _trySkipIisCustomErrors ?? GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false);
|
||||
}
|
||||
internal set
|
||||
{
|
||||
// used for unit testing
|
||||
_trySkipIisCustomErrors = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the allowed image file types.
|
||||
@@ -676,26 +698,14 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_umbracoLibraryCacheDuration.HasValue)
|
||||
return _umbracoLibraryCacheDuration.Value;
|
||||
|
||||
string libraryCacheDuration = GetKey("/settings/content/UmbracoLibraryCacheDuration");
|
||||
if (String.IsNullOrEmpty(libraryCacheDuration))
|
||||
return 1800;
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return int.Parse(libraryCacheDuration);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 1800;
|
||||
}
|
||||
}
|
||||
|
||||
// default: 1800
|
||||
return _umbracoLibraryCacheDuration ?? GetKeyValue("/settings/content/UmbracoLibraryCacheDuration", 1800);
|
||||
}
|
||||
internal set { _umbracoLibraryCacheDuration = value; }
|
||||
internal set
|
||||
{
|
||||
// for unit tests only
|
||||
_umbracoLibraryCacheDuration = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1051,27 +1061,12 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_useLegacySchema.HasValue)
|
||||
return _useLegacySchema.Value;
|
||||
|
||||
string value = GetKey("/settings/content/UseLegacyXmlSchema");
|
||||
bool result;
|
||||
if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//default. TODO: When we change this to a real config section we won't have to worry about parse errors
|
||||
// and should handle defaults with unit tests properly.
|
||||
return false;
|
||||
}
|
||||
// default: true
|
||||
return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false);
|
||||
}
|
||||
internal set
|
||||
{
|
||||
//used for unit testing
|
||||
// used for unit testing
|
||||
_useLegacySchema = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,19 +94,19 @@ namespace Umbraco.Core
|
||||
protected virtual void InitializeResolvers()
|
||||
{
|
||||
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
|
||||
PluginManager.Current.ResolveCacheRefreshers());
|
||||
() => PluginManager.Current.ResolveCacheRefreshers());
|
||||
|
||||
DataTypesResolver.Current = new DataTypesResolver(
|
||||
PluginManager.Current.ResolveDataTypes());
|
||||
() => PluginManager.Current.ResolveDataTypes());
|
||||
|
||||
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
|
||||
PluginManager.Current.ResolveMacroRenderings());
|
||||
() => PluginManager.Current.ResolveMacroRenderings());
|
||||
|
||||
PackageActionsResolver.Current = new PackageActionsResolver(
|
||||
PluginManager.Current.ResolvePackageActions());
|
||||
() => PluginManager.Current.ResolvePackageActions());
|
||||
|
||||
ActionsResolver.Current = new ActionsResolver(
|
||||
PluginManager.Current.ResolveActions());
|
||||
() => PluginManager.Current.ResolveActions());
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
PluginManager.Current.ResolvePropertyEditorValueConverters());
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Umbraco.Core
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="dataTypes"></param>
|
||||
internal DataTypesResolver(IEnumerable<Type> dataTypes)
|
||||
internal DataTypesResolver(Func<IEnumerable<Type>> dataTypes)
|
||||
: base(dataTypes)
|
||||
{
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Dictionary
|
||||
/// <summary>
|
||||
/// Resolves the current CultureDictionaryFactory
|
||||
/// </summary>
|
||||
internal class CultureDictionaryFactoryResolver : SingleObjectResolverBase<CultureDictionaryFactoryResolver, ICultureDictionaryFactory>
|
||||
internal sealed class CultureDictionaryFactoryResolver : SingleObjectResolverBase<CultureDictionaryFactoryResolver, ICultureDictionaryFactory>
|
||||
{
|
||||
internal CultureDictionaryFactoryResolver(ICultureDictionaryFactory factory)
|
||||
: base(factory)
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -158,7 +159,7 @@ namespace Umbraco.Core
|
||||
var builder = new StringBuilder();
|
||||
foreach (var i in d)
|
||||
{
|
||||
builder.Append(String.Format("{0}={1}&", i.Key, i.Value));
|
||||
builder.Append(String.Format("{0}={1}&", HttpUtility.UrlEncode(i.Key), i.Value == null ? string.Empty : HttpUtility.UrlEncode(i.Value.ToString())));
|
||||
}
|
||||
return builder.ToString().TrimEnd('&');
|
||||
}
|
||||
|
||||
+121
-110
@@ -4,124 +4,135 @@ using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
|
||||
// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
|
||||
// {
|
||||
// Thread.Sleep(567);
|
||||
// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public class DisposableTimer : DisposableObject
|
||||
{
|
||||
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
|
||||
private readonly Action<long> _callback;
|
||||
/// <summary>
|
||||
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
|
||||
// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
|
||||
// {
|
||||
// Thread.Sleep(567);
|
||||
// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public class DisposableTimer : DisposableObject
|
||||
{
|
||||
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
|
||||
private readonly Action<long> _callback;
|
||||
|
||||
protected DisposableTimer(Action<long> callback)
|
||||
{
|
||||
_callback = callback;
|
||||
}
|
||||
protected DisposableTimer(Action<long> callback)
|
||||
{
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
public Stopwatch Stopwatch
|
||||
{
|
||||
get { return _stopwatch; }
|
||||
}
|
||||
public Stopwatch Stopwatch
|
||||
{
|
||||
get { return _stopwatch; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the timer and invokes the specified callback upon disposal.
|
||||
/// </summary>
|
||||
/// <param name="callback">The callback.</param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer Start(Action<long> callback)
|
||||
{
|
||||
return new DisposableTimer(callback);
|
||||
}
|
||||
/// <summary>
|
||||
/// Starts the timer and invokes the specified callback upon disposal.
|
||||
/// </summary>
|
||||
/// <param name="callback">The callback.</param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer Start(Action<long> callback)
|
||||
{
|
||||
return new DisposableTimer(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
|
||||
{
|
||||
return TraceDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
public static DisposableTimer TraceDuration<T>(Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
return TraceDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
|
||||
{
|
||||
LogHelper.Info(loggerType, () => startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)"));
|
||||
}
|
||||
public static DisposableTimer TraceDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
LogHelper.Debug(loggerType, startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage() + " (took " + x + "ms)"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
|
||||
{
|
||||
return DebugDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
|
||||
{
|
||||
return TraceDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
return DebugDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
|
||||
{
|
||||
LogHelper.Info(loggerType, () => startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
|
||||
{
|
||||
LogHelper.Debug(loggerType, () => startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)"));
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
|
||||
{
|
||||
return DebugDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
LogHelper.Debug(loggerType, startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)"));
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
return DebugDuration(typeof(T), startMessage, completeMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
|
||||
/// </summary>
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
|
||||
{
|
||||
LogHelper.Debug(loggerType, () => startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
|
||||
/// </summary>
|
||||
/// <param name="loggerType"></param>
|
||||
/// <param name="startMessage"></param>
|
||||
/// <param name="completeMessage"></param>
|
||||
/// <returns></returns>
|
||||
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
|
||||
{
|
||||
LogHelper.Debug(loggerType, startMessage);
|
||||
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
|
||||
/// </summary>
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,51 +72,51 @@ namespace Umbraco.Core.Dynamics
|
||||
return true; //anyway
|
||||
}
|
||||
|
||||
//ok, now lets try to match by member, property, extensino method
|
||||
var attempt = DynamicInstanceHelper.TryInvokeMember(this, binder, args, new[]
|
||||
//ok, now lets try to match by member, property, extensino method
|
||||
var attempt = DynamicInstanceHelper.TryInvokeMember(this, binder, args, new[]
|
||||
{
|
||||
typeof (IEnumerable<DynamicXml>),
|
||||
typeof (IEnumerable<XElement>),
|
||||
typeof (DynamicXml)
|
||||
});
|
||||
|
||||
if (attempt.Success)
|
||||
{
|
||||
result = attempt.Result.ObjectResult;
|
||||
if (attempt.Success)
|
||||
{
|
||||
result = attempt.Result.ObjectResult;
|
||||
|
||||
//need to check the return type and possibly cast if result is from an extension method found
|
||||
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod)
|
||||
{
|
||||
//if the result is already a DynamicXml instance, then we do not need to cast
|
||||
if (attempt.Result.ObjectResult != null && !(attempt.Result.ObjectResult is DynamicXml))
|
||||
{
|
||||
if (attempt.Result.ObjectResult is XElement)
|
||||
{
|
||||
result = new DynamicXml((XElement)attempt.Result.ObjectResult);
|
||||
}
|
||||
else if (attempt.Result.ObjectResult is IEnumerable<XElement>)
|
||||
{
|
||||
result = ((IEnumerable<XElement>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x));
|
||||
}
|
||||
else if (attempt.Result.ObjectResult is IEnumerable<DynamicXml>)
|
||||
{
|
||||
result = ((IEnumerable<DynamicXml>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x.BaseElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//need to check the return type and possibly cast if result is from an extension method found
|
||||
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod)
|
||||
{
|
||||
//if the result is already a DynamicXml instance, then we do not need to cast
|
||||
if (attempt.Result.ObjectResult != null && !(attempt.Result.ObjectResult is DynamicXml))
|
||||
{
|
||||
if (attempt.Result.ObjectResult is XElement)
|
||||
{
|
||||
result = new DynamicXml((XElement)attempt.Result.ObjectResult);
|
||||
}
|
||||
else if (attempt.Result.ObjectResult is IEnumerable<XElement>)
|
||||
{
|
||||
result = ((IEnumerable<XElement>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x));
|
||||
}
|
||||
else if (attempt.Result.ObjectResult is IEnumerable<DynamicXml>)
|
||||
{
|
||||
result = ((IEnumerable<DynamicXml>)attempt.Result.ObjectResult).Select(x => new DynamicXml(x.BaseElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//this is the result of an extension method execution gone wrong so we return dynamic null
|
||||
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod
|
||||
&& attempt.Error != null && attempt.Error is TargetInvocationException)
|
||||
{
|
||||
result = new DynamicNull();
|
||||
return true;
|
||||
}
|
||||
//this is the result of an extension method execution gone wrong so we return dynamic null
|
||||
if (attempt.Result.Reason == DynamicInstanceHelper.TryInvokeMemberSuccessReason.FoundExtensionMethod
|
||||
&& attempt.Error != null && attempt.Error is TargetInvocationException)
|
||||
{
|
||||
result = new DynamicNull();
|
||||
return true;
|
||||
}
|
||||
|
||||
result = null;
|
||||
return false;
|
||||
result = null;
|
||||
return false;
|
||||
|
||||
}
|
||||
public override bool TryGetMember(GetMemberBinder binder, out object result)
|
||||
@@ -228,40 +228,40 @@ namespace Umbraco.Core.Dynamics
|
||||
return new DynamicXml(this.BaseElement.XPathSelectElements(expression).FirstOrDefault());
|
||||
}
|
||||
|
||||
IEnumerator<XElement> IEnumerable<XElement>.GetEnumerator()
|
||||
{
|
||||
return this.BaseElement.Elements().GetEnumerator();
|
||||
}
|
||||
IEnumerator<XElement> IEnumerable<XElement>.GetEnumerator()
|
||||
{
|
||||
return this.BaseElement.Elements().GetEnumerator();
|
||||
}
|
||||
|
||||
public IEnumerator<DynamicXml> GetEnumerator()
|
||||
{
|
||||
return this.BaseElement.Elements().Select(e => new DynamicXml(e)).GetEnumerator();
|
||||
}
|
||||
public IEnumerator<DynamicXml> GetEnumerator()
|
||||
{
|
||||
return this.BaseElement.Elements().Select(e => new DynamicXml(e)).GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public int Count()
|
||||
{
|
||||
return ((IEnumerable<XElement>)this).Count();
|
||||
return ((IEnumerable<XElement>)this).Count();
|
||||
}
|
||||
|
||||
public bool Any()
|
||||
{
|
||||
return ((IEnumerable<XElement>)this).Any();
|
||||
return ((IEnumerable<XElement>)this).Any();
|
||||
}
|
||||
|
||||
public IEnumerable<DynamicXml> Take(int count)
|
||||
{
|
||||
return ((IEnumerable<DynamicXml>)this).Take(count);
|
||||
}
|
||||
public IEnumerable<DynamicXml> Take(int count)
|
||||
{
|
||||
return ((IEnumerable<DynamicXml>)this).Take(count);
|
||||
}
|
||||
|
||||
public IEnumerable<DynamicXml> Skip(int count)
|
||||
{
|
||||
return ((IEnumerable<DynamicXml>)this).Skip(count);
|
||||
}
|
||||
public IEnumerable<DynamicXml> Skip(int count)
|
||||
{
|
||||
return ((IEnumerable<DynamicXml>)this).Skip(count);
|
||||
}
|
||||
|
||||
public bool IsNull()
|
||||
{
|
||||
@@ -503,72 +503,72 @@ namespace Umbraco.Core.Dynamics
|
||||
public HtmlString IsDescendant(DynamicXml other, string valueIfTrue)
|
||||
{
|
||||
var ancestors = this.Ancestors();
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
}
|
||||
public HtmlString IsDescendant(DynamicXml other, string valueIfTrue, string valueIfFalse)
|
||||
{
|
||||
var ancestors = this.Ancestors();
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
}
|
||||
public bool IsDescendantOrSelf(DynamicXml other)
|
||||
{
|
||||
var ancestors = this.AncestorsOrSelf();
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null);
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null);
|
||||
}
|
||||
public HtmlString IsDescendantOrSelf(DynamicXml other, string valueIfTrue)
|
||||
{
|
||||
var ancestors = this.AncestorsOrSelf();
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
}
|
||||
public HtmlString IsDescendantOrSelf(DynamicXml other, string valueIfTrue, string valueIfFalse)
|
||||
{
|
||||
var ancestors = this.AncestorsOrSelf();
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
return IsHelper(n => ancestors.FirstOrDefault(ancestor => ancestor.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
}
|
||||
public bool IsAncestor(DynamicXml other)
|
||||
{
|
||||
var descendants = this.Descendants();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
|
||||
}
|
||||
public HtmlString IsAncestor(DynamicXml other, string valueIfTrue)
|
||||
{
|
||||
var descendants = this.Descendants();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
}
|
||||
public HtmlString IsAncestor(DynamicXml other, string valueIfTrue, string valueIfFalse)
|
||||
{
|
||||
var descendants = this.Descendants();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
}
|
||||
public bool IsAncestorOrSelf(DynamicXml other)
|
||||
{
|
||||
var descendants = this.DescendantsOrSelf();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null);
|
||||
}
|
||||
public HtmlString IsAncestorOrSelf(DynamicXml other, string valueIfTrue)
|
||||
{
|
||||
var descendants = this.DescendantsOrSelf();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue);
|
||||
}
|
||||
public HtmlString IsAncestorOrSelf(DynamicXml other, string valueIfTrue, string valueIfFalse)
|
||||
{
|
||||
var descendants = this.DescendantsOrSelf();
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
return IsHelper(n => descendants.FirstOrDefault(descendant => descendant.BaseElement == other.BaseElement) != null, valueIfTrue, valueIfFalse);
|
||||
}
|
||||
public IEnumerable<DynamicXml> Descendants()
|
||||
{
|
||||
return Descendants(n => true);
|
||||
}
|
||||
public IEnumerable<DynamicXml> Descendants(Func<XElement, bool> func)
|
||||
public IEnumerable<DynamicXml> Descendants(Func<XElement, bool> func)
|
||||
{
|
||||
var flattenedNodes = this.BaseElement.Elements().Map(func, (XElement n) => { return n.Elements(); });
|
||||
return flattenedNodes.ToList().ConvertAll(n => new DynamicXml(n));
|
||||
}
|
||||
public IEnumerable<DynamicXml> DescendantsOrSelf()
|
||||
public IEnumerable<DynamicXml> DescendantsOrSelf()
|
||||
{
|
||||
return DescendantsOrSelf(n => true);
|
||||
}
|
||||
public IEnumerable<DynamicXml> DescendantsOrSelf(Func<XElement, bool> func)
|
||||
public IEnumerable<DynamicXml> DescendantsOrSelf(Func<XElement, bool> func)
|
||||
{
|
||||
var flattenedNodes = this.BaseElement.Elements().Map(func, (XElement n) => { return n.Elements(); });
|
||||
var list = new List<DynamicXml>();
|
||||
@@ -576,11 +576,11 @@ namespace Umbraco.Core.Dynamics
|
||||
list.AddRange(flattenedNodes.ToList().ConvertAll(n => new DynamicXml(n)));
|
||||
return list;
|
||||
}
|
||||
public IEnumerable<DynamicXml> Ancestors()
|
||||
public IEnumerable<DynamicXml> Ancestors()
|
||||
{
|
||||
return Ancestors(item => true);
|
||||
}
|
||||
public IEnumerable<DynamicXml> Ancestors(Func<XElement, bool> func)
|
||||
public IEnumerable<DynamicXml> Ancestors(Func<XElement, bool> func)
|
||||
{
|
||||
var ancestorList = new List<XElement>();
|
||||
var node = this.BaseElement;
|
||||
@@ -611,11 +611,11 @@ namespace Umbraco.Core.Dynamics
|
||||
ancestorList.Reverse();
|
||||
return ancestorList.ConvertAll(item => new DynamicXml(item));
|
||||
}
|
||||
public IEnumerable<DynamicXml> AncestorsOrSelf()
|
||||
public IEnumerable<DynamicXml> AncestorsOrSelf()
|
||||
{
|
||||
return AncestorsOrSelf(item => true);
|
||||
}
|
||||
public IEnumerable<DynamicXml> AncestorsOrSelf(Func<XElement, bool> func)
|
||||
public IEnumerable<DynamicXml> AncestorsOrSelf(Func<XElement, bool> func)
|
||||
{
|
||||
List<XElement> ancestorList = new List<XElement>();
|
||||
var node = this.BaseElement;
|
||||
@@ -730,6 +730,6 @@ namespace Umbraco.Core.Dynamics
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace Umbraco.Core.IO
|
||||
///
|
||||
/// This abstract class just wraps the 'real' IFileSystem object passed in to its constructor.
|
||||
/// </remarks>
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal abstract class FileSystemWrapper : IFileSystem
|
||||
public abstract class FileSystemWrapper : IFileSystem
|
||||
{
|
||||
private readonly IFileSystem _wrapped;
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ using System.IO;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal interface IFileSystem
|
||||
{
|
||||
public interface IFileSystem
|
||||
{
|
||||
IEnumerable<string> GetDirectories(string path);
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
foreach (var character in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
filePath = filePath.Replace(character, '_');
|
||||
filePath = filePath.Replace(character, '-');
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -240,10 +240,14 @@ namespace Umbraco.Core.IO
|
||||
if (reservedCharacters.IndexOf(character) == -1)
|
||||
stringBuilder.Append(character);
|
||||
else
|
||||
stringBuilder.Append("_");
|
||||
stringBuilder.Append("-");
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
// Remove repeating dashes
|
||||
// From: http://stackoverflow.com/questions/5111967/regex-to-remove-a-specific-repeated-character
|
||||
var reducedString = Regex.Replace(stringBuilder.ToString(), "-+", "-");
|
||||
|
||||
return reducedString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace Umbraco.Core.IO
|
||||
/// A custom file system provider for media
|
||||
/// </summary>
|
||||
[FileSystemProvider("media")]
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class MediaFileSystem : FileSystemWrapper
|
||||
public class MediaFileSystem : FileSystemWrapper
|
||||
{
|
||||
public MediaFileSystem(IFileSystem wrapped)
|
||||
: base(wrapped)
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
|
||||
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
||||
internal class PhysicalFileSystem : IFileSystem
|
||||
public class PhysicalFileSystem : IFileSystem
|
||||
{
|
||||
private readonly string _rootPath;
|
||||
private readonly string _rootUrl;
|
||||
|
||||
public PhysicalFileSystem(string virtualRoot)
|
||||
{
|
||||
_rootPath = System.Web.Hosting.HostingEnvironment.MapPath(virtualRoot);
|
||||
_rootUrl = VirtualPathUtility.ToAbsolute(virtualRoot);
|
||||
_rootPath = IOHelper.MapPath(virtualRoot);
|
||||
_rootUrl = IOHelper.ResolveUrl(virtualRoot);
|
||||
}
|
||||
|
||||
public PhysicalFileSystem(string rootPath, string rootUrl)
|
||||
@@ -43,9 +42,13 @@ namespace Umbraco.Core.IO
|
||||
return Directory.EnumerateDirectories(path).Select(GetRelativePath);
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
|
||||
}
|
||||
catch (DirectoryNotFoundException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
|
||||
}
|
||||
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
@@ -65,7 +68,9 @@ namespace Umbraco.Core.IO
|
||||
Directory.Delete(GetFullPath(path), recursive);
|
||||
}
|
||||
catch (DirectoryNotFoundException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string path)
|
||||
@@ -80,9 +85,7 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public void AddFile(string path, Stream stream, bool overrideIfExists)
|
||||
{
|
||||
if (FileExists(path) && !overrideIfExists)
|
||||
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists",
|
||||
path));
|
||||
if (FileExists(path) && !overrideIfExists) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
|
||||
|
||||
EnsureDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
@@ -108,9 +111,13 @@ namespace Umbraco.Core.IO
|
||||
return Directory.EnumerateFiles(path, filter).Select(GetRelativePath);
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
|
||||
}
|
||||
catch (DirectoryNotFoundException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
|
||||
}
|
||||
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
@@ -130,7 +137,9 @@ namespace Umbraco.Core.IO
|
||||
File.Delete(GetFullPath(path));
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{ }
|
||||
{
|
||||
LogHelper.Error<PhysicalFileSystem>("File not found", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public bool FileExists(string path)
|
||||
@@ -188,7 +197,7 @@ namespace Umbraco.Core.IO
|
||||
|
||||
protected string EnsureTrailingSeparator(string path)
|
||||
{
|
||||
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
|
||||
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal))
|
||||
path = path + Path.DirectorySeparatorChar;
|
||||
|
||||
return path;
|
||||
|
||||
@@ -69,6 +69,15 @@ namespace Umbraco.Core.IO
|
||||
}
|
||||
}
|
||||
|
||||
public static string AppPlugins
|
||||
{
|
||||
get
|
||||
{
|
||||
//NOTE: this is not configurable and shouldn't need to be
|
||||
return "~/App_Plugins";
|
||||
}
|
||||
}
|
||||
|
||||
public static string MvcViews
|
||||
{
|
||||
get
|
||||
|
||||
@@ -60,49 +60,77 @@ namespace Umbraco.Core.Logging
|
||||
|
||||
#region Warn
|
||||
|
||||
public static void Warn(Type callingType, string message, params object[] format)
|
||||
public static void Warn(Type callingType, string message, params Func<object>[] formatItems)
|
||||
{
|
||||
var logger = LogManager.GetLogger(callingType);
|
||||
if (logger != null)
|
||||
logger.WarnFormat(PrefixThreadId(message), format);
|
||||
if (logger == null || !logger.IsWarnEnabled) return;
|
||||
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
|
||||
}
|
||||
|
||||
public static void Warn(Type callingType, TraceContext trace, string message, params object[] format)
|
||||
public static void Warn(Type callingType, string message, bool showHttpTrace, params Func<object>[] formatItems)
|
||||
{
|
||||
if (trace != null)
|
||||
Mandate.ParameterNotNull(callingType, "callingType");
|
||||
Mandate.ParameterNotNullOrEmpty(message, "message");
|
||||
|
||||
if (showHttpTrace && HttpContext.Current != null)
|
||||
{
|
||||
trace.Warn(string.Format(message, format));
|
||||
HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()));
|
||||
}
|
||||
|
||||
var logger = LogManager.GetLogger(callingType);
|
||||
if (logger != null)
|
||||
logger.WarnFormat(PrefixThreadId(message), format);
|
||||
if (logger == null || !logger.IsWarnEnabled) return;
|
||||
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
|
||||
|
||||
}
|
||||
|
||||
public static void WarnWithException(Type callingType, string message, Exception e, params Func<object>[] formatItems)
|
||||
{
|
||||
WarnWithException(callingType, message, false, e, formatItems);
|
||||
}
|
||||
|
||||
public static void WarnWithException(Type callingType, string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
|
||||
{
|
||||
Mandate.ParameterNotNull(e, "e");
|
||||
Mandate.ParameterNotNull(callingType, "callingType");
|
||||
Mandate.ParameterNotNullOrEmpty(message, "message");
|
||||
|
||||
if (showHttpTrace && HttpContext.Current != null)
|
||||
{
|
||||
HttpContext.Current.Trace.Warn(
|
||||
callingType.Name,
|
||||
string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()),
|
||||
e);
|
||||
}
|
||||
|
||||
var logger = LogManager.GetLogger(callingType);
|
||||
if (logger == null || !logger.IsWarnEnabled) return;
|
||||
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
|
||||
logger.WarnFormat(PrefixThreadId(message) + ". Exception: " + e, executedParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a warn log
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="items"></param>
|
||||
public static void Warn<T>(string message, params object[] items)
|
||||
/// <param name="formatItems"></param>
|
||||
public static void Warn<T>(string message, params Func<object>[] formatItems)
|
||||
{
|
||||
var logger = LoggerFor<T>();
|
||||
if (logger != null)
|
||||
logger.WarnFormat(PrefixThreadId(message), items);
|
||||
Warn(typeof(T), message, formatItems);
|
||||
}
|
||||
|
||||
public static void Warn<T>(string message, TraceContext trace, params object[] items)
|
||||
public static void Warn<T>(string message, bool showHttpTrace, params Func<object>[] formatItems)
|
||||
{
|
||||
if (trace != null)
|
||||
{
|
||||
trace.Warn(string.Format(message, items));
|
||||
}
|
||||
Warn(typeof(T), message, showHttpTrace, formatItems);
|
||||
}
|
||||
|
||||
var logger = LoggerFor<T>();
|
||||
if (logger != null)
|
||||
logger.WarnFormat(PrefixThreadId(message), items);
|
||||
public static void WarnWithException<T>(string message, Exception e, params Func<object>[] formatItems)
|
||||
{
|
||||
WarnWithException(typeof(T), message, e, formatItems);
|
||||
}
|
||||
public static void WarnWithException<T>(string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
|
||||
{
|
||||
WarnWithException(typeof(T), message, showHttpTrace, e, formatItems);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -214,14 +242,15 @@ namespace Umbraco.Core.Logging
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="generateMessageFormat"></param>
|
||||
/// <param name="trace"></param>
|
||||
/// <param name="showHttpTrace"></param>
|
||||
/// <param name="formatItems"></param>
|
||||
public static void Debug<T>(string generateMessageFormat, TraceContext trace, params Func<object>[] formatItems)
|
||||
public static void Debug<T>(string generateMessageFormat, bool showHttpTrace, params Func<object>[] formatItems)
|
||||
{
|
||||
if (trace != null)
|
||||
if (showHttpTrace && HttpContext.Current != null)
|
||||
{
|
||||
// must .ToArray() here else string.Format sees only one parameter
|
||||
trace.Write(string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray()));
|
||||
HttpContext.Current.Trace.Write(
|
||||
typeof(T).Name,
|
||||
string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray()));
|
||||
}
|
||||
Debug(typeof(T), generateMessageFormat, formatItems);
|
||||
}
|
||||
|
||||
@@ -66,8 +66,7 @@ namespace Umbraco.Core.Macros
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var macroAlias = attributes["macroalias"] ?? attributes["alias"];
|
||||
var macroAlias = attributes.ContainsKey("macroalias") ? attributes["macroalias"] : attributes["alias"];
|
||||
|
||||
//call the callback now that we have the macro parsed
|
||||
macroFoundCallback(macroAlias, attributes);
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Core.ObjectResolution
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for lazily resolving types for a resolver
|
||||
/// </summary>
|
||||
/// <typeparam name="TResolver"></typeparam>
|
||||
/// <typeparam name="TResolved"></typeparam>
|
||||
/// <remarks>
|
||||
/// This is a special case resolver for when types get lazily resolved in order to resolve the actual types. This is useful
|
||||
/// for when there is some processing overhead (i.e. Type finding in assemblies) to return the Types used to instantiate the instances.
|
||||
/// In some these cases we don't want to have to type find during application startup, only when we need to resolve the instances.
|
||||
///
|
||||
/// Important notes about this resolver: This does not support Insert or Remove and therefore does not support any ordering unless
|
||||
/// the types are marked with the WeightedPluginAttribute.
|
||||
/// </remarks>
|
||||
internal abstract class LazyManyObjectsResolverBase<TResolver, TResolved> : ManyObjectsResolverBase<TResolver, TResolved>
|
||||
where TResolved : class
|
||||
where TResolver : class
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
protected LazyManyObjectsResolverBase(ObjectLifetimeScope scope = ObjectLifetimeScope.Application)
|
||||
: base(scope)
|
||||
{
|
||||
}
|
||||
|
||||
protected LazyManyObjectsResolverBase(HttpContextBase httpContext)
|
||||
: base(httpContext)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a list of lazy types
|
||||
/// </summary>
|
||||
/// <param name="listOfLazyTypes"></param>
|
||||
/// <param name="scope"></param>
|
||||
protected LazyManyObjectsResolverBase(IEnumerable<Lazy<Type>> listOfLazyTypes, ObjectLifetimeScope scope = ObjectLifetimeScope.Application)
|
||||
: this(scope)
|
||||
{
|
||||
AddTypes(listOfLazyTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a delegate to return a list of types
|
||||
/// </summary>
|
||||
/// <param name="typeListDelegate"></param>
|
||||
/// <param name="scope"></param>
|
||||
protected LazyManyObjectsResolverBase(Func<IEnumerable<Type>> typeListDelegate, ObjectLifetimeScope scope = ObjectLifetimeScope.Application)
|
||||
: this(scope)
|
||||
{
|
||||
_listOfTypeListDelegates.Add(typeListDelegate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a list of lazy types
|
||||
/// </summary>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <param name="listOfLazyTypes"></param>
|
||||
protected LazyManyObjectsResolverBase(HttpContextBase httpContext, IEnumerable<Lazy<Type>> listOfLazyTypes)
|
||||
: this(httpContext)
|
||||
{
|
||||
AddTypes(listOfLazyTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a delegate to return a list of types
|
||||
/// </summary>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <param name="typeListDelegate"></param>
|
||||
protected LazyManyObjectsResolverBase(HttpContextBase httpContext, Func<IEnumerable<Type>> typeListDelegate)
|
||||
: this(httpContext)
|
||||
{
|
||||
_listOfTypeListDelegates.Add(typeListDelegate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private readonly List<Lazy<Type>> _lazyTypeList = new List<Lazy<Type>>();
|
||||
private readonly List<Func<IEnumerable<Type>>> _listOfTypeListDelegates = new List<Func<IEnumerable<Type>>>();
|
||||
private List<Type> _resolvedTypes = null;
|
||||
private readonly ReaderWriterLockSlim _typeResolutionLock = new ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// Used for unit tests
|
||||
/// </summary>
|
||||
internal bool HasResolvedTypes
|
||||
{
|
||||
get { return _resolvedTypes != null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Once this is called this will resolve all types registered in the lazy list
|
||||
/// </summary>
|
||||
protected override IEnumerable<Type> InstanceTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
using (var lck = new UpgradeableReadLock(_typeResolutionLock))
|
||||
{
|
||||
var lazyTypeList = _lazyTypeList.Select(x => x.Value).ToArray();
|
||||
var listofTypeListDelegates = _listOfTypeListDelegates.SelectMany(x => x()).ToArray();
|
||||
|
||||
//we need to validate each resolved type now since we could not do it before when inserting the lazy delegates
|
||||
if (!HasResolvedTypes)
|
||||
{
|
||||
lck.UpgradeToWriteLock();
|
||||
|
||||
_resolvedTypes = new List<Type>();
|
||||
|
||||
//first iterate the lazy type list
|
||||
foreach (var l in lazyTypeList)
|
||||
{
|
||||
UpdateUniqueList(_resolvedTypes, l);
|
||||
}
|
||||
|
||||
//next iterate the list of list type delegates
|
||||
foreach (var l in listofTypeListDelegates)
|
||||
{
|
||||
UpdateUniqueList(_resolvedTypes, l);
|
||||
}
|
||||
}
|
||||
|
||||
return _resolvedTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateUniqueList(List<Type> uniqueList, Type toAdd)
|
||||
{
|
||||
EnsureCorrectType(toAdd);
|
||||
if (uniqueList.Contains(toAdd))
|
||||
{
|
||||
throw new InvalidOperationException("The Type " + toAdd + " already exists in the collection");
|
||||
}
|
||||
uniqueList.Add(toAdd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows adding of multiple lazy types at once
|
||||
/// </summary>
|
||||
/// <param name="types"></param>
|
||||
protected void AddTypes(IEnumerable<Lazy<Type>> types)
|
||||
{
|
||||
EnsureAddSupport();
|
||||
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
foreach (var t in types)
|
||||
{
|
||||
_lazyTypeList.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a type list delegate to the collection
|
||||
/// </summary>
|
||||
/// <param name="typeListDelegate"></param>
|
||||
public void AddTypeListDelegate(Func<IEnumerable<Type>> typeListDelegate)
|
||||
{
|
||||
EnsureAddSupport();
|
||||
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
_listOfTypeListDelegates.Add(typeListDelegate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a lazy type to the list
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void AddType(Lazy<Type> value)
|
||||
{
|
||||
EnsureAddSupport();
|
||||
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
_lazyTypeList.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the static type added to a lazy type and adds it to the internal list
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public override void AddType(Type value)
|
||||
{
|
||||
AddType(new Lazy<Type>(() => value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all lazy types
|
||||
/// </summary>
|
||||
public override void Clear()
|
||||
{
|
||||
EnsureClearSupport();
|
||||
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
_lazyTypeList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does not support removal
|
||||
/// </summary>
|
||||
protected override bool SupportsRemove
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does not support insert
|
||||
/// </summary>
|
||||
protected override bool SupportsInsert
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// these old classes don't contain metadata, the objects need to be instantiated first to get their metadata, we then store this
|
||||
/// for use in the GetById method.
|
||||
/// </remarks>
|
||||
internal abstract class LegacyTransientObjectsResolver<TResolver, TResolved> : ManyObjectsResolverBase<TResolver, TResolved>
|
||||
internal abstract class LegacyTransientObjectsResolver<TResolver, TResolved> : LazyManyObjectsResolverBase<TResolver, TResolved>
|
||||
where TResolved : class
|
||||
where TResolver : class
|
||||
{
|
||||
@@ -27,16 +27,15 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="refreshers"></param>
|
||||
/// <param name="types"></param>
|
||||
/// <remarks>
|
||||
/// We are creating Transient instances (new instances each time) because this is how the legacy code worked and
|
||||
/// I don't want to muck anything up by changing them to application based instances.
|
||||
/// TODO: However, it would make much more sense to do this and would speed up the application plus this would make the GetById method much easier.
|
||||
/// </remarks>
|
||||
protected LegacyTransientObjectsResolver(IEnumerable<Type> refreshers)
|
||||
: base(ObjectLifetimeScope.Transient) // new objects every time
|
||||
{
|
||||
AddTypes(refreshers);
|
||||
protected LegacyTransientObjectsResolver(Func<IEnumerable<Type>> types)
|
||||
: base(types, ObjectLifetimeScope.Transient) // new objects every time
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -55,7 +54,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
protected abstract Guid GetUniqueIdentifier(TResolved obj);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new ICacheRefresher instance by id
|
||||
/// Returns a new TResolved instance by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using Umbraco.Core.Macros;
|
||||
@@ -14,14 +15,14 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// Much of this classes methods are based on legacy code from umbraco.editorControls.macrocontainer.MacroControlFactory
|
||||
/// this code should probably be reviewed and cleaned up if necessary.
|
||||
/// </remarks>
|
||||
internal sealed class MacroFieldEditorsResolver : ManyObjectsResolverBase<MacroFieldEditorsResolver, IMacroGuiRendering>
|
||||
internal sealed class MacroFieldEditorsResolver : LazyManyObjectsResolverBase<MacroFieldEditorsResolver, IMacroGuiRendering>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="macroEditors"></param>
|
||||
internal MacroFieldEditorsResolver(IEnumerable<Type> macroEditors)
|
||||
internal MacroFieldEditorsResolver(Func<IEnumerable<Type>> macroEditors)
|
||||
: base(macroEditors, ObjectLifetimeScope.Transient)
|
||||
{
|
||||
|
||||
@@ -56,7 +57,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// </remarks>
|
||||
internal List<Type> MacroControlTypes
|
||||
{
|
||||
get { return InstanceTypes; }
|
||||
get { return InstanceTypes.ToList(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,14 +6,14 @@ using System.Web;
|
||||
|
||||
namespace Umbraco.Core.ObjectResolution
|
||||
{
|
||||
|
||||
internal abstract class ManyObjectsResolverBase<TResolver, TResolved> : ResolverBase<TResolver>
|
||||
where TResolved : class
|
||||
where TResolver : class
|
||||
{
|
||||
private List<TResolved> _applicationInstances = null;
|
||||
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
|
||||
|
||||
private readonly List<Type> _instanceTypes = new List<Type>();
|
||||
|
||||
#region Constructors
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
}
|
||||
|
||||
LifetimeScope = scope;
|
||||
InstanceTypes = new List<Type>();
|
||||
_instanceTypes = new List<Type>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
if (httpContext == null) throw new ArgumentNullException("httpContext");
|
||||
LifetimeScope = ObjectLifetimeScope.HttpRequest;
|
||||
CurrentHttpContext = httpContext;
|
||||
InstanceTypes = new List<Type>();
|
||||
_instanceTypes = new List<Type>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,8 +58,8 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// <param name="scope">If set to true will resolve singleton objects which will be created once for the lifetime of the application</param>
|
||||
protected ManyObjectsResolverBase(IEnumerable<Type> value, ObjectLifetimeScope scope = ObjectLifetimeScope.Application)
|
||||
: this(scope)
|
||||
{
|
||||
InstanceTypes = new List<Type>(value);
|
||||
{
|
||||
_instanceTypes = new List<Type>(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,7 +71,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
protected ManyObjectsResolverBase(HttpContextBase httpContext, IEnumerable<Type> value)
|
||||
: this(httpContext)
|
||||
{
|
||||
InstanceTypes = new List<Type>(value);
|
||||
_instanceTypes = new List<Type>(value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -83,7 +83,10 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// <summary>
|
||||
/// Returns the list of Types registered that instances will be created from
|
||||
/// </summary>
|
||||
protected List<Type> InstanceTypes { get; private set; }
|
||||
protected virtual IEnumerable<Type> InstanceTypes
|
||||
{
|
||||
get { return _instanceTypes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Current HttpContextBase used to construct this object if one exists.
|
||||
@@ -97,11 +100,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
protected ObjectLifetimeScope LifetimeScope { get; private set; }
|
||||
|
||||
private int _defaultPluginWeight = 10;
|
||||
private bool _supportsAdd = true;
|
||||
private bool _supportsInsert = true;
|
||||
private bool _supportsClear = true;
|
||||
private bool _supportsRemove = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used in conjunction with GetSortedValues and WeightedPluginAttribute, if any of the objects
|
||||
/// being resolved do not contain the WeightedPluginAttribute then this will be the default weight applied
|
||||
@@ -189,15 +188,16 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// Removes a type.
|
||||
/// </summary>
|
||||
/// <param name="value">The type to remove.</param>
|
||||
public void RemoveType(Type value)
|
||||
public virtual void RemoveType(Type value)
|
||||
{
|
||||
if (!SupportsRemove)
|
||||
throw new InvalidOperationException("This resolver does not support Removing types");
|
||||
EnsureRemoveSupport();
|
||||
|
||||
using (new WriteLock(_lock))
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
EnsureCorrectType(value);
|
||||
InstanceTypes.Remove(value);
|
||||
_instanceTypes.Remove(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,8 +215,12 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// </summary>
|
||||
/// <param name="types"></param>
|
||||
protected void AddTypes(IEnumerable<Type> types)
|
||||
{
|
||||
using (var l = new WriteLock(_lock))
|
||||
{
|
||||
EnsureAddSupport();
|
||||
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
foreach(var t in types)
|
||||
{
|
||||
@@ -225,7 +229,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
{
|
||||
throw new InvalidOperationException("The Type " + t + " already exists in the collection");
|
||||
};
|
||||
InstanceTypes.Add(t);
|
||||
_instanceTypes.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,19 +238,20 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// Adds a Type to the end of the list.
|
||||
/// </summary>
|
||||
/// <param name="value">The object to be added.</param>
|
||||
public void AddType(Type value)
|
||||
public virtual void AddType(Type value)
|
||||
{
|
||||
if (!SupportsAdd)
|
||||
throw new InvalidOperationException("This resolver does not support Adding new types");
|
||||
EnsureAddSupport();
|
||||
|
||||
using (var l = new WriteLock(_lock))
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
EnsureCorrectType(value);
|
||||
if (InstanceTypes.Contains(value))
|
||||
{
|
||||
throw new InvalidOperationException("The Type " + value + " already exists in the collection");
|
||||
};
|
||||
InstanceTypes.Add(value);
|
||||
_instanceTypes.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,14 +267,15 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// <summary>
|
||||
/// Clears the list.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
public virtual void Clear()
|
||||
{
|
||||
if (!SupportsClear)
|
||||
throw new InvalidOperationException("This resolver does not support Clearing types");
|
||||
EnsureClearSupport();
|
||||
|
||||
using (new WriteLock(_lock))
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (GetWriteLock())
|
||||
{
|
||||
InstanceTypes.Clear();
|
||||
_instanceTypes.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,12 +284,13 @@ namespace Umbraco.Core.ObjectResolution
|
||||
/// </summary>
|
||||
/// <param name="index">The zero-based index at which the object should be inserted.</param>
|
||||
/// <param name="value">The object to insert.</param>
|
||||
public void InsertType(int index, Type value)
|
||||
public virtual void InsertType(int index, Type value)
|
||||
{
|
||||
if (!SupportsInsert)
|
||||
throw new InvalidOperationException("This resolver does not support Inserting new types");
|
||||
EnsureInsertSupport();
|
||||
|
||||
using (var l = new UpgradeableReadLock(_lock))
|
||||
EnsureResolutionNotFrozen();
|
||||
|
||||
using (var l = GetWriteLock())
|
||||
{
|
||||
EnsureCorrectType(value);
|
||||
if (InstanceTypes.Contains(value))
|
||||
@@ -291,8 +298,7 @@ namespace Umbraco.Core.ObjectResolution
|
||||
throw new InvalidOperationException("The Type " + value + " already exists in the collection");
|
||||
};
|
||||
|
||||
l.UpgradeToWriteLock();
|
||||
InstanceTypes.Insert(index, value);
|
||||
_instanceTypes.Insert(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +312,65 @@ namespace Umbraco.Core.ObjectResolution
|
||||
InsertType(index, typeof (T));
|
||||
}
|
||||
|
||||
private void EnsureCorrectType(Type t)
|
||||
/// <summary>
|
||||
/// Returns a WriteLock to use when modifying collections
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected WriteLock GetWriteLock()
|
||||
{
|
||||
return new WriteLock(_lock);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if resolution is frozen
|
||||
/// </summary>
|
||||
protected void EnsureResolutionNotFrozen()
|
||||
{
|
||||
if (Resolution.IsFrozen)
|
||||
throw new InvalidOperationException("The type list cannot be modified after resolution has been frozen");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if this does not support Remove
|
||||
/// </summary>
|
||||
protected void EnsureRemoveSupport()
|
||||
{
|
||||
if (!SupportsRemove)
|
||||
throw new InvalidOperationException("This resolver does not support Removing types");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if this does not support Clear
|
||||
/// </summary>
|
||||
protected void EnsureClearSupport()
|
||||
{
|
||||
if (!SupportsClear)
|
||||
throw new InvalidOperationException("This resolver does not support Clearing types");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if this does not support Add
|
||||
/// </summary>
|
||||
protected void EnsureAddSupport()
|
||||
{
|
||||
if (!SupportsAdd)
|
||||
throw new InvalidOperationException("This resolver does not support Adding new types");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if this does not support insert
|
||||
/// </summary>
|
||||
protected void EnsureInsertSupport()
|
||||
{
|
||||
if (!SupportsInsert)
|
||||
throw new InvalidOperationException("This resolver does not support Inserting new types");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an exception if the type is not of the TResolved type
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
protected void EnsureCorrectType(Type t)
|
||||
{
|
||||
if (!TypeHelper.IsTypeAssignableFrom<TResolved>(t))
|
||||
throw new InvalidOperationException("The resolver " + this.GetType() + " can only accept types of " + typeof(TResolved) + ". The Type passed in to this method is " + t);
|
||||
@@ -314,22 +378,22 @@ namespace Umbraco.Core.ObjectResolution
|
||||
|
||||
protected virtual bool SupportsAdd
|
||||
{
|
||||
get { return _supportsAdd; }
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected virtual bool SupportsInsert
|
||||
{
|
||||
get { return _supportsInsert; }
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected virtual bool SupportsClear
|
||||
{
|
||||
get { return _supportsClear; }
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected virtual bool SupportsRemove
|
||||
{
|
||||
get { return _supportsRemove; }
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// A resolver to return all IPackageAction objects
|
||||
/// </summary>
|
||||
internal sealed class PackageActionsResolver : ManyObjectsResolverBase<PackageActionsResolver, IPackageAction>
|
||||
internal sealed class PackageActionsResolver : LazyManyObjectsResolverBase<PackageActionsResolver, IPackageAction>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="packageActions"></param>
|
||||
internal PackageActionsResolver(IEnumerable<Type> packageActions)
|
||||
internal PackageActionsResolver(Func<IEnumerable<Type>> packageActions)
|
||||
: base(packageActions)
|
||||
{
|
||||
|
||||
|
||||
+681
-598
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// <summary>
|
||||
/// Manages the list of IPropertyEditorValueConverter's
|
||||
/// </summary>
|
||||
internal class PropertyEditorValueConvertersResolver : ManyObjectsResolverBase<PropertyEditorValueConvertersResolver, IPropertyEditorValueConverter>
|
||||
internal sealed class PropertyEditorValueConvertersResolver : ManyObjectsResolverBase<PropertyEditorValueConvertersResolver, IPropertyEditorValueConverter>
|
||||
{
|
||||
public PropertyEditorValueConvertersResolver(IEnumerable<Type> converters)
|
||||
: base(converters)
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
@@ -18,6 +19,65 @@ namespace Umbraco.Core
|
||||
///</summary>
|
||||
public static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Encrypt the string using the MachineKey in medium trust
|
||||
/// </summary>
|
||||
/// <param name="value">The string value to be encrypted.</param>
|
||||
/// <returns></returns>
|
||||
public static string EncryptWithMachineKey(this string value)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
string valueToEncrypt = value;
|
||||
List<string> parts = new List<string>();
|
||||
|
||||
const int EncrpytBlockSize = 500;
|
||||
|
||||
while (valueToEncrypt.Length > EncrpytBlockSize)
|
||||
{
|
||||
parts.Add(valueToEncrypt.Substring(0, EncrpytBlockSize));
|
||||
valueToEncrypt = valueToEncrypt.Remove(0, EncrpytBlockSize);
|
||||
}
|
||||
|
||||
if (valueToEncrypt.Length > 0)
|
||||
{
|
||||
parts.Add(valueToEncrypt);
|
||||
}
|
||||
|
||||
StringBuilder encrpytedValue = new StringBuilder();
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
var encrpytedBlock = FormsAuthentication.Encrypt(new FormsAuthenticationTicket(0, string.Empty, DateTime.Now, DateTime.MaxValue, false, part));
|
||||
encrpytedValue.AppendLine(encrpytedBlock);
|
||||
}
|
||||
|
||||
return encrpytedValue.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypt the encrypted string using the Machine key in medium trust
|
||||
/// </summary>
|
||||
/// <param name="value">The string value to be decrypted</param>
|
||||
/// <returns></returns>
|
||||
public static string DecryptWithMachineKey(this string value)
|
||||
{
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
string[] parts = value.Split('\n');
|
||||
|
||||
StringBuilder decryptedValue = new StringBuilder();
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
decryptedValue.Append(FormsAuthentication.Decrypt(part.TrimEnd()).UserData);
|
||||
}
|
||||
|
||||
return decryptedValue.ToString();
|
||||
}
|
||||
|
||||
//this is from SqlMetal and just makes it a bit of fun to allow pluralisation
|
||||
public static string MakePluralName(this string name)
|
||||
{
|
||||
@@ -144,22 +204,22 @@ namespace Umbraco.Core
|
||||
|
||||
public static string EnsureStartsWith(this string input, char value)
|
||||
{
|
||||
return input.StartsWith(value.ToString()) ? input : value + input;
|
||||
return input.StartsWith(value.ToString(CultureInfo.InvariantCulture)) ? input : value + input;
|
||||
}
|
||||
|
||||
public static string EnsureEndsWith(this string input, char value)
|
||||
{
|
||||
return input.EndsWith(value.ToString()) ? input : input + value;
|
||||
return input.EndsWith(value.ToString(CultureInfo.InvariantCulture)) ? input : input + value;
|
||||
}
|
||||
|
||||
public static bool IsLowerCase(this char ch)
|
||||
{
|
||||
return ch.ToString(CultureInfo.InvariantCulture) == ch.ToString(CultureInfo.InvariantCulture).ToLower();
|
||||
return ch.ToString(CultureInfo.InvariantCulture) == ch.ToString(CultureInfo.InvariantCulture).ToLowerInvariant();
|
||||
}
|
||||
|
||||
public static bool IsUpperCase(this char ch)
|
||||
{
|
||||
return ch.ToString(CultureInfo.InvariantCulture) == ch.ToString(CultureInfo.InvariantCulture).ToUpper();
|
||||
return ch.ToString(CultureInfo.InvariantCulture) == ch.ToString(CultureInfo.InvariantCulture).ToUpperInvariant();
|
||||
}
|
||||
|
||||
/// <summary>Is null or white space.</summary>
|
||||
@@ -267,7 +327,7 @@ namespace Umbraco.Core
|
||||
Enumerable.Range(97, 26));
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (var c in value.Where(c => charReplacements.Values.Contains(c.ToString()) || validCodeRanges.Contains(c)))
|
||||
foreach (var c in value.Where(c => charReplacements.Values.Contains(c.ToString(CultureInfo.InvariantCulture)) || validCodeRanges.Contains(c)))
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
@@ -328,7 +388,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
if (splittedPhraseChars.Length > 0)
|
||||
{
|
||||
splittedPhraseChars[0] = ((new String(splittedPhraseChars[0], 1)).ToUpper().ToCharArray())[0];
|
||||
splittedPhraseChars[0] = ((new String(splittedPhraseChars[0], 1)).ToUpperInvariant().ToCharArray())[0];
|
||||
}
|
||||
sb.Append(new String(splittedPhraseChars));
|
||||
}
|
||||
@@ -343,15 +403,15 @@ namespace Umbraco.Core
|
||||
var match = pattern.Match(result);
|
||||
if (match.Success)
|
||||
{
|
||||
result = match.Groups[1].Value.ToLower() + match.Groups[2].Value;
|
||||
result = match.Groups[1].Value.ToLowerInvariant() + match.Groups[2].Value;
|
||||
|
||||
return result.Substring(0, 1).ToLower() + result.Substring(1);
|
||||
return result.Substring(0, 1).ToLowerInvariant() + result.Substring(1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result.ToLower();
|
||||
return result.ToLowerInvariant();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<AssemblyName>Umbraco.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -70,6 +72,7 @@
|
||||
<Compile Include="HashCodeCombiner.cs" />
|
||||
<Compile Include="IO\FileSystemWrapper.cs" />
|
||||
<Compile Include="Media\IImageUrlProvider.cs" />
|
||||
<Compile Include="ObjectResolution\LazyManyObjectsResolverbase.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="Dictionary\ICultureDictionary.cs" />
|
||||
<Compile Include="Dynamics\ClassFactory.cs" />
|
||||
@@ -161,6 +164,11 @@
|
||||
<Compile Include="WriteLock.cs" />
|
||||
<Compile Include="XmlExtensions.cs" />
|
||||
<Compile Include="XmlHelper.cs" />
|
||||
<Compile Include="Xml\DynamicContext.cs" />
|
||||
<Compile Include="Xml\XmlNamespaces.cs" />
|
||||
<Compile Include="Xml\XmlNodeListFactory.cs" />
|
||||
<Compile Include="Xml\XmlNodeExtensions.cs" />
|
||||
<Compile Include="Xml\XPathVariable.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
@@ -173,6 +181,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.Xsl;
|
||||
using System.Xml.XPath;
|
||||
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the evaluation context for fast execution and custom
|
||||
/// variables resolution.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is responsible for resolving variables during dynamic expression execution.
|
||||
/// <para>Discussed in http://weblogs.asp.net/cazzu/archive/2003/10/07/30888.aspx</para>
|
||||
/// <para>Author: Daniel Cazzulino, <a href="http://clariusconsulting.net/kzu">blog</a></para>
|
||||
/// </remarks>
|
||||
public class DynamicContext : XsltContext
|
||||
{
|
||||
#region Private vars
|
||||
|
||||
readonly IDictionary<string, IXsltContextVariable> _variables =
|
||||
new Dictionary<string, IXsltContextVariable>();
|
||||
|
||||
#endregion Private
|
||||
|
||||
#region Constructors & Initialization
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DynamicContext"/> class.
|
||||
/// </summary>
|
||||
public DynamicContext()
|
||||
: base(new NameTable())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DynamicContext"/>
|
||||
/// class with the specified <see cref="NameTable"/>.
|
||||
/// </summary>
|
||||
/// <param name="table">The NameTable to use.</param>
|
||||
public DynamicContext(NameTable table)
|
||||
: base(table)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DynamicContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">A previously filled context with the namespaces to use.</param>
|
||||
public DynamicContext(XmlNamespaceManager context)
|
||||
: this(context, new NameTable())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DynamicContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">A previously filled context with the namespaces to use.</param>
|
||||
/// <param name="table">The NameTable to use.</param>
|
||||
public DynamicContext(XmlNamespaceManager context, NameTable table)
|
||||
: base(table)
|
||||
{
|
||||
object xml = table.Add(XmlNamespaces.Xml);
|
||||
object xmlns = table.Add(XmlNamespaces.XmlNs);
|
||||
|
||||
if (context == null) return;
|
||||
|
||||
foreach (string prefix in context)
|
||||
{
|
||||
var uri = context.LookupNamespace(prefix);
|
||||
// Use fast object reference comparison to omit forbidden namespace declarations.
|
||||
if (Equals(uri, xml) || Equals(uri, xmlns))
|
||||
continue;
|
||||
if (uri == null)
|
||||
continue;
|
||||
base.AddNamespace(prefix, uri);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Constructors & Initialization
|
||||
|
||||
#region Common Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Implementation equal to <see cref="XsltContext"/>.
|
||||
/// </summary>
|
||||
public override int CompareDocument(string baseUri, string nextbaseUri)
|
||||
{
|
||||
return String.Compare(baseUri, nextbaseUri, false, System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="XmlNamespaceManager"/>.
|
||||
/// </summary>
|
||||
public override string LookupNamespace(string prefix)
|
||||
{
|
||||
var key = NameTable.Get(prefix);
|
||||
return key == null ? null : base.LookupNamespace(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="XmlNamespaceManager"/>.
|
||||
/// </summary>
|
||||
public override string LookupPrefix(string uri)
|
||||
{
|
||||
var key = NameTable.Get(uri);
|
||||
return key == null ? null : base.LookupPrefix(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="XsltContext"/>.
|
||||
/// </summary>
|
||||
public override bool PreserveWhitespace(XPathNavigator node)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="XsltContext"/>.
|
||||
/// </summary>
|
||||
public override bool Whitespace
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion Common Overrides
|
||||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Shortcut method that compiles an expression using an empty navigator.
|
||||
/// </summary>
|
||||
/// <param name="xpath">The expression to compile</param>
|
||||
/// <returns>A compiled <see cref="XPathExpression"/>.</returns>
|
||||
public static XPathExpression Compile(string xpath)
|
||||
{
|
||||
return new XmlDocument().CreateNavigator().Compile(xpath);
|
||||
}
|
||||
|
||||
#endregion Public Members
|
||||
|
||||
#region Variable Handling Code
|
||||
|
||||
/// <summary>
|
||||
/// Adds the variable to the dynamic evaluation context.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the variable to add to the context.</param>
|
||||
/// <param name="value">The value of the variable to add to the context.</param>
|
||||
/// <remarks>
|
||||
/// Value type conversion for XPath evaluation is as follows:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>CLR Type</term>
|
||||
/// <description>XPath type</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>System.String</term>
|
||||
/// <description>XPathResultType.String</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>System.Double (or types that can be converted to)</term>
|
||||
/// <description>XPathResultType.Number</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>System.Boolean</term>
|
||||
/// <description>XPathResultType.Boolean</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>System.Xml.XPath.XPathNavigator</term>
|
||||
/// <description>XPathResultType.Navigator</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>System.Xml.XPath.XPathNodeIterator</term>
|
||||
/// <description>XPathResultType.NodeSet</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>Others</term>
|
||||
/// <description>XPathResultType.Any</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// <note type="note">See the topic "Compile, Select, Evaluate, and Matches with
|
||||
/// XPath and XPathExpressions" in MSDN documentation for additional information.</note>
|
||||
/// </remarks>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="value"/> is null.</exception>
|
||||
public void AddVariable(string name, object value)
|
||||
{
|
||||
if (value == null) throw new ArgumentNullException("value");
|
||||
_variables[name] = new DynamicVariable(name, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="XsltContext"/>. Not used in our implementation.
|
||||
/// </summary>
|
||||
public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the dynamic variables added to the context. See <see cref="XsltContext"/>.
|
||||
/// </summary>
|
||||
public override IXsltContextVariable ResolveVariable(string prefix, string name)
|
||||
{
|
||||
IXsltContextVariable var;
|
||||
_variables.TryGetValue(name, out var);
|
||||
return var;
|
||||
}
|
||||
|
||||
#endregion Variable Handling Code
|
||||
|
||||
#region Internal DynamicVariable class
|
||||
|
||||
/// <summary>
|
||||
/// Represents a variable during dynamic expression execution.
|
||||
/// </summary>
|
||||
internal class DynamicVariable : IXsltContextVariable
|
||||
{
|
||||
readonly string _name;
|
||||
readonly object _value;
|
||||
|
||||
#region Public Members
|
||||
|
||||
public string Name { get { return _name; } }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the variable.</param>
|
||||
/// <param name="value">The value of the variable.</param>
|
||||
public DynamicVariable(string name, object value)
|
||||
{
|
||||
|
||||
_name = name;
|
||||
_value = value;
|
||||
|
||||
if (value is String)
|
||||
_type = XPathResultType.String;
|
||||
else if (value is bool)
|
||||
_type = XPathResultType.Boolean;
|
||||
else if (value is XPathNavigator)
|
||||
_type = XPathResultType.Navigator;
|
||||
else if (value is XPathNodeIterator)
|
||||
_type = XPathResultType.NodeSet;
|
||||
else
|
||||
{
|
||||
// Try to convert to double (native XPath numeric type)
|
||||
if (value is double)
|
||||
{
|
||||
_type = XPathResultType.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value is IConvertible)
|
||||
{
|
||||
try
|
||||
{
|
||||
_value = Convert.ToDouble(value);
|
||||
// We suceeded, so it's a number.
|
||||
_type = XPathResultType.Number;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
_type = XPathResultType.Any;
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
_type = XPathResultType.Any;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_type = XPathResultType.Any;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Members
|
||||
|
||||
#region IXsltContextVariable Implementation
|
||||
|
||||
XPathResultType IXsltContextVariable.VariableType
|
||||
{
|
||||
get { return _type; }
|
||||
}
|
||||
|
||||
readonly XPathResultType _type;
|
||||
|
||||
object IXsltContextVariable.Evaluate(XsltContext context)
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
bool IXsltContextVariable.IsLocal
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
bool IXsltContextVariable.IsParam
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion IXsltContextVariable Implementation
|
||||
}
|
||||
|
||||
#endregion Internal DynamicVariable class
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
internal class XPathVariable
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public XPathVariable(string name, string value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides public constants for wellknown XML namespaces.
|
||||
/// </summary>
|
||||
/// <remarks>Author: Daniel Cazzulino, <a href="http://clariusconsulting.net/kzu">blog</a></remarks>
|
||||
public static class XmlNamespaces
|
||||
{
|
||||
/// <summary>
|
||||
/// The public XML 1.0 namespace.
|
||||
/// </summary>
|
||||
/// <remarks>See http://www.w3.org/TR/2004/REC-xml-20040204/</remarks>
|
||||
public const string Xml = "http://www.w3.org/XML/1998/namespace";
|
||||
|
||||
/// <summary>
|
||||
/// Public Xml Namespaces specification namespace.
|
||||
/// </summary>
|
||||
/// <remarks>See http://www.w3.org/TR/REC-xml-names/</remarks>
|
||||
public const string XmlNs = "http://www.w3.org/2000/xmlns/";
|
||||
|
||||
/// <summary>
|
||||
/// Public Xml Namespaces prefix.
|
||||
/// </summary>
|
||||
/// <remarks>See http://www.w3.org/TR/REC-xml-names/</remarks>
|
||||
public const string XmlNsPrefix = "xmlns";
|
||||
|
||||
/// <summary>
|
||||
/// XML Schema instance namespace.
|
||||
/// </summary>
|
||||
/// <remarks>See http://www.w3.org/TR/xmlschema-1/</remarks>
|
||||
public const string Xsi = "http://www.w3.org/2001/XMLSchema-instance";
|
||||
|
||||
/// <summary>
|
||||
/// XML 1.0 Schema namespace.
|
||||
/// </summary>
|
||||
/// <remarks>See http://www.w3.org/TR/xmlschema-1/</remarks>
|
||||
public const string Xsd = "http://www.w3.org/2001/XMLSchema";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
internal static class XmlNodeExtensions
|
||||
{
|
||||
static XPathNodeIterator Select(string expression, XPathNavigator source, params XPathVariable[] variables)
|
||||
{
|
||||
var expr = source.Compile(expression);
|
||||
var context = new DynamicContext();
|
||||
foreach (var variable in variables)
|
||||
context.AddVariable(variable.Name, variable.Value);
|
||||
expr.SetContext(context);
|
||||
return source.Select(expr);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectNodes(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNodeList SelectNodes(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectNodes(expression);
|
||||
|
||||
var iterator = Select(expression, source.CreateNavigator(), variables);
|
||||
return XmlNodeListFactory.CreateNodeList(iterator);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, IEnumerable<XPathVariable> variables)
|
||||
{
|
||||
var av = variables == null ? null : variables.ToArray();
|
||||
return SelectSingleNode(source, expression, av);
|
||||
}
|
||||
|
||||
public static XmlNode SelectSingleNode(this XmlNode source, string expression, params XPathVariable[] variables)
|
||||
{
|
||||
if (variables == null || variables.Length == 0 || variables[0] == null)
|
||||
return source.SelectSingleNode(expression);
|
||||
|
||||
return SelectNodes(source, expression, variables).Cast<XmlNode>().FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
// source: mvpxml.codeplex.com
|
||||
|
||||
namespace Umbraco.Core.Xml
|
||||
{
|
||||
class XmlNodeListFactory
|
||||
{
|
||||
private XmlNodeListFactory() { }
|
||||
|
||||
#region Public members
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of a <see cref="XmlNodeList"/> that allows
|
||||
/// enumerating <see cref="XmlNode"/> elements in the iterator.
|
||||
/// </summary>
|
||||
/// <param name="iterator">The result of a previous node selection
|
||||
/// through an <see cref="XPathNavigator"/> query.</param>
|
||||
/// <returns>An initialized list ready to be enumerated.</returns>
|
||||
/// <remarks>The underlying XML store used to issue the query must be
|
||||
/// an object inheriting <see cref="XmlNode"/>, such as
|
||||
/// <see cref="XmlDocument"/>.</remarks>
|
||||
public static XmlNodeList CreateNodeList(XPathNodeIterator iterator)
|
||||
{
|
||||
return new XmlNodeListIterator(iterator);
|
||||
}
|
||||
|
||||
#endregion Public members
|
||||
|
||||
#region XmlNodeListIterator
|
||||
|
||||
private class XmlNodeListIterator : XmlNodeList
|
||||
{
|
||||
readonly XPathNodeIterator _iterator;
|
||||
readonly IList<XmlNode> _nodes = new List<XmlNode>();
|
||||
|
||||
public XmlNodeListIterator(XPathNodeIterator iterator)
|
||||
{
|
||||
_iterator = iterator.Clone();
|
||||
}
|
||||
|
||||
public override System.Collections.IEnumerator GetEnumerator()
|
||||
{
|
||||
return new XmlNodeListEnumerator(this);
|
||||
}
|
||||
|
||||
public override XmlNode Item(int index)
|
||||
{
|
||||
|
||||
if (index >= _nodes.Count)
|
||||
ReadTo(index);
|
||||
// Compatible behavior with .NET
|
||||
if (index >= _nodes.Count || index < 0)
|
||||
return null;
|
||||
return _nodes[index];
|
||||
}
|
||||
|
||||
public override int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_done) ReadToEnd();
|
||||
return _nodes.Count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reads the entire iterator.
|
||||
/// </summary>
|
||||
private void ReadToEnd()
|
||||
{
|
||||
while (_iterator.MoveNext())
|
||||
{
|
||||
var node = _iterator.Current as IHasXmlNode;
|
||||
// Check IHasXmlNode interface.
|
||||
if (node == null)
|
||||
throw new ArgumentException("IHasXmlNode is missing.");
|
||||
_nodes.Add(node.GetNode());
|
||||
}
|
||||
_done = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads up to the specified index, or until the
|
||||
/// iterator is consumed.
|
||||
/// </summary>
|
||||
private void ReadTo(int to)
|
||||
{
|
||||
while (_nodes.Count <= to)
|
||||
{
|
||||
if (_iterator.MoveNext())
|
||||
{
|
||||
var node = _iterator.Current as IHasXmlNode;
|
||||
// Check IHasXmlNode interface.
|
||||
if (node == null)
|
||||
throw new ArgumentException("IHasXmlNode is missing.");
|
||||
_nodes.Add(node.GetNode());
|
||||
}
|
||||
else
|
||||
{
|
||||
_done = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flags that the iterator has been consumed.
|
||||
/// </summary>
|
||||
private bool Done
|
||||
{
|
||||
get { return _done; }
|
||||
}
|
||||
|
||||
bool _done;
|
||||
|
||||
/// <summary>
|
||||
/// Current count of nodes in the iterator (read so far).
|
||||
/// </summary>
|
||||
private int CurrentPosition
|
||||
{
|
||||
get { return _nodes.Count; }
|
||||
}
|
||||
|
||||
#region XmlNodeListEnumerator
|
||||
|
||||
private class XmlNodeListEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
readonly XmlNodeListIterator _iterator;
|
||||
int _position = -1;
|
||||
|
||||
public XmlNodeListEnumerator(XmlNodeListIterator iterator)
|
||||
{
|
||||
_iterator = iterator;
|
||||
}
|
||||
|
||||
#region IEnumerator Members
|
||||
|
||||
void System.Collections.IEnumerator.Reset()
|
||||
{
|
||||
_position = -1;
|
||||
}
|
||||
|
||||
|
||||
bool System.Collections.IEnumerator.MoveNext()
|
||||
{
|
||||
_position++;
|
||||
_iterator.ReadTo(_position);
|
||||
|
||||
// If we reached the end and our index is still
|
||||
// bigger, there're no more items.
|
||||
if (_iterator.Done && _position >= _iterator.CurrentPosition)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
object System.Collections.IEnumerator.Current
|
||||
{
|
||||
get
|
||||
{
|
||||
return _iterator[_position];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion XmlNodeListEnumerator
|
||||
}
|
||||
|
||||
#endregion XmlNodeListIterator
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
CreateNew();
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Get_Top_Level_Items()
|
||||
{
|
||||
@@ -42,6 +43,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// Creates a new dictionary entry, adds values for all languages assigned, then deletes the
|
||||
/// entry and ensure that all other data is gone too.
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Create_Add_Text_And_Delete()
|
||||
{
|
||||
@@ -64,6 +66,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
///A test for IsTopMostItem
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_IsTopMostItem()
|
||||
{
|
||||
@@ -85,6 +88,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
/// Test the Parent and Children properties and ensures that the relationships work both ways
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Parent_Child_Relationship()
|
||||
{
|
||||
@@ -115,6 +119,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
/// Deletes a parent with existing children and ensures they are all gone.
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Delete_Parent_With_Children()
|
||||
{
|
||||
@@ -166,6 +171,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
/// Guid constructor test
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Contructor_Guid()
|
||||
{
|
||||
@@ -183,6 +189,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
/// key constructor test
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Contructor_Key()
|
||||
{
|
||||
@@ -200,6 +207,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
///A test for ToXml
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_ToXml()
|
||||
{
|
||||
@@ -227,6 +235,7 @@ namespace Umbraco.Tests.BusinessLogic
|
||||
/// <summary>
|
||||
///A test to change the key of an element
|
||||
///</summary>
|
||||
[Ignore]
|
||||
[Test()]
|
||||
public void Dictionary_Change_Key()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Umbraco.Tests
|
||||
};
|
||||
|
||||
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
|
||||
PluginManager.Current.ResolveCacheRefreshers());
|
||||
() => PluginManager.Current.ResolveCacheRefreshers());
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -54,6 +55,8 @@ namespace Umbraco.Tests.ContentStores
|
||||
</Home>
|
||||
<Home id=""1175"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""1045"" sortOrder=""2"" createDate=""2012-07-20T18:08:01"" updateDate=""2012-07-20T18:49:32"" nodeName=""Sub 2"" urlName=""sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1175"" isDoc=""""><content><![CDATA[]]></content>
|
||||
</Home>
|
||||
<Home id=""1177"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""1045"" sortOrder=""2"" createDate=""2012-07-20T18:08:01"" updateDate=""2012-07-20T18:49:32"" nodeName=""Sub'Apostrophe"" urlName=""sub'apostrophe"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1177"" isDoc=""""><content><![CDATA[]]></content>
|
||||
</Home>
|
||||
</Home>
|
||||
<Home id=""1172"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""1045"" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""Test"" urlName=""test"" writerName=""admin"" creatorName=""admin"" path=""-1,1172"" isDoc="""" />
|
||||
</root>";
|
||||
@@ -63,7 +66,7 @@ namespace Umbraco.Tests.ContentStores
|
||||
public void SetUp()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
|
||||
_httpContextFactory = new FakeHttpContextFactory("~/Home");
|
||||
//ensure the StateHelper is using our custom context
|
||||
StateHelper.HttpContext = _httpContextFactory.HttpContext;
|
||||
@@ -103,9 +106,7 @@ namespace Umbraco.Tests.ContentStores
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
//TODO: need to reset everything!
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
UmbracoSettings.ResetSetters();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -155,6 +156,7 @@ namespace Umbraco.Tests.ContentStores
|
||||
[TestCase("/home/sub1", 1173)]
|
||||
[TestCase("/Home/sub1", 1173)]
|
||||
[TestCase("/home/Sub1", 1173)] //test different cases
|
||||
[TestCase("/home/Sub'Apostrophe", 1177)]
|
||||
public void Get_Node_By_Route(string route, int nodeId)
|
||||
{
|
||||
var result = _publishedContentStore.GetDocumentByRoute(_umbracoContext, route, false);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Examine;
|
||||
@@ -14,19 +15,26 @@ using umbraco.BusinessLogic;
|
||||
namespace Umbraco.Tests.ContentStores
|
||||
{
|
||||
[TestFixture]
|
||||
public class PublishMediaStoreTests : BaseWebTest
|
||||
public class PublishMediaStoreTests : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
//we're going to use the same initialization as the PublishedMediaTests
|
||||
PublishedMediaTests.DoInitialization(GetUmbracoContext("/test", 1234));
|
||||
|
||||
var currDir = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory);
|
||||
File.Copy(
|
||||
currDir.Parent.Parent.Parent.GetDirectories("Umbraco.Web.UI")
|
||||
.First()
|
||||
.GetDirectories("config").First()
|
||||
.GetFiles("umbracoSettings.Release.config").First().FullName,
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
PublishedMediaTests.DoTearDown();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Umbraco.Tests
|
||||
};
|
||||
|
||||
DataTypesResolver.Current = new DataTypesResolver(
|
||||
PluginManager.Current.ResolveDataTypes());
|
||||
() => PluginManager.Current.ResolveDataTypes());
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
@@ -15,18 +15,16 @@ namespace Umbraco.Tests
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
{
|
||||
base.Initialize();
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "~/umbraco,~/install/");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd");
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
//reset the app config
|
||||
base.TearDown();
|
||||
//reset the app config
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "");
|
||||
|
||||
}
|
||||
|
||||
[TestCase("/umbraco/umbraco.aspx")]
|
||||
@@ -70,8 +68,8 @@ namespace Umbraco.Tests
|
||||
public void Is_Reserved_By_Route(string url, bool shouldMatch)
|
||||
{
|
||||
//reset the app config, we only want to test routes not the hard coded paths
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "");
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedPaths = "";
|
||||
Umbraco.Core.Configuration.GlobalSettings.ReservedUrls = "";
|
||||
|
||||
var routes = new RouteCollection();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using Umbraco.Tests.BusinessLogic;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture, RequiresSTA]
|
||||
internal abstract class AbstractFileSystemTests
|
||||
{
|
||||
protected IFileSystem _fileSystem;
|
||||
@@ -104,7 +104,7 @@ namespace Umbraco.Tests.IO
|
||||
|
||||
_fileSystem.DeleteDirectory("test", true);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Can_Get_File_Dates()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,13 @@ namespace Umbraco.Tests.IO
|
||||
public class IOHelperTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void IOHelper_ResolveUrl()
|
||||
{
|
||||
var result = IOHelper.ResolveUrl("~/Scripts");
|
||||
Assert.AreEqual("/Scripts", result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for MapPath verifying that HttpContext method (which includes vdirs) matches non-HttpContext method
|
||||
///</summary>
|
||||
|
||||
@@ -9,14 +9,32 @@ using Umbraco.Tests.BusinessLogic;
|
||||
|
||||
namespace Umbraco.Tests.IO
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture, RequiresSTA]
|
||||
internal class PhysicalFileSystemTests : AbstractFileSystemTests
|
||||
{
|
||||
public PhysicalFileSystemTests()
|
||||
: base(new PhysicalFileSystem(AppDomain.CurrentDomain.BaseDirectory,
|
||||
: base(new PhysicalFileSystem(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FileSysTests"),
|
||||
"/Media/"))
|
||||
{ }
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FileSysTests");
|
||||
var files = Directory.GetFiles(path);
|
||||
foreach (var f in files)
|
||||
{
|
||||
File.Delete(f);
|
||||
}
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
|
||||
protected override string ConstructUrl(string path)
|
||||
{
|
||||
return "/Media/" + path;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
@@ -26,6 +27,17 @@ namespace Umbraco.Tests
|
||||
|
||||
var routingContext = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = routingContext.UmbracoContext;
|
||||
|
||||
var currDir = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory);
|
||||
File.Copy(
|
||||
currDir.Parent.Parent.Parent.GetDirectories("Umbraco.Web.UI")
|
||||
.First()
|
||||
.GetDirectories("config").First()
|
||||
.GetFiles("umbracoSettings.Release.config").First().FullName,
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
|
||||
Core.Configuration.UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
|
||||
@@ -8,12 +8,12 @@ using System.Web.Compilation;
|
||||
using NUnit.Framework;
|
||||
using SqlCE4Umbraco;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using umbraco;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.MacroEngines;
|
||||
using umbraco.MacroEngines.Iron;
|
||||
using umbraco.businesslogic;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.editorControls;
|
||||
@@ -24,21 +24,21 @@ using umbraco.cms;
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class PluginManagerTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class PluginManagerTests
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
|
||||
//this ensures its reset
|
||||
PluginManager.Current = new PluginManager(false);
|
||||
//this ensures its reset
|
||||
PluginManager.Current = new PluginManager(false);
|
||||
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
//TODO: Should probably update this so it only searches this assembly and add custom types to be found
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
//TODO: Should probably update this so it only searches this assembly and add custom types to be found
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
{
|
||||
this.GetType().Assembly,
|
||||
typeof(ApplicationStartupHandler).Assembly,
|
||||
@@ -54,286 +54,318 @@ namespace Umbraco.Tests
|
||||
typeof(System.Web.Mvc.ActionResult).Assembly,
|
||||
typeof(TypeFinder).Assembly,
|
||||
typeof(ISqlHelper).Assembly,
|
||||
typeof(DLRScriptingEngine).Assembly,
|
||||
typeof(ICultureDictionary).Assembly,
|
||||
typeof(UmbracoContext).Assembly,
|
||||
typeof(BaseDataType).Assembly
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private DirectoryInfo PrepareFolder()
|
||||
{
|
||||
var assDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
|
||||
var dir = Directory.CreateDirectory(Path.Combine(assDir.FullName, "PluginManager", Guid.NewGuid().ToString("N")));
|
||||
foreach (var f in dir.GetFiles())
|
||||
{
|
||||
f.Delete();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
private DirectoryInfo PrepareFolder()
|
||||
{
|
||||
var assDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
|
||||
var dir = Directory.CreateDirectory(Path.Combine(assDir.FullName, "PluginManager", Guid.NewGuid().ToString("N")));
|
||||
foreach (var f in dir.GetFiles())
|
||||
{
|
||||
f.Delete();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
//[Test]
|
||||
//public void Scan_Vs_Load_Benchmark()
|
||||
//{
|
||||
// var pluginManager = new PluginManager(false);
|
||||
// var watch = new Stopwatch();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var refreshers = pluginManager.ResolveTypes<ICacheRefresher>(false);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
|
||||
//}
|
||||
//[Test]
|
||||
//public void Scan_Vs_Load_Benchmark()
|
||||
//{
|
||||
// var pluginManager = new PluginManager(false);
|
||||
// var watch = new Stopwatch();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var refreshers = pluginManager.ResolveTypes<ICacheRefresher>(false);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
|
||||
//}
|
||||
|
||||
////NOTE: This test shows that Type.GetType is 100% faster than Assembly.Load(..).GetType(...) so we'll use that :)
|
||||
//[Test]
|
||||
//public void Load_Type_Benchmark()
|
||||
//{
|
||||
// var watch = new Stopwatch();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.macroCacheRefresh");
|
||||
// var type3 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.templateCacheRefresh");
|
||||
// var type4 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.presentation.cache.MediaLibraryRefreshers");
|
||||
// var type5 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.presentation.cache.pageRefresher");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
//}
|
||||
////NOTE: This test shows that Type.GetType is 100% faster than Assembly.Load(..).GetType(...) so we'll use that :)
|
||||
//[Test]
|
||||
//public void Load_Type_Benchmark()
|
||||
//{
|
||||
// var watch = new Stopwatch();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.macroCacheRefresh");
|
||||
// var type3 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.templateCacheRefresh");
|
||||
// var type4 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.presentation.cache.MediaLibraryRefreshers");
|
||||
// var type5 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
|
||||
// .GetType("umbraco.presentation.cache.pageRefresher");
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
|
||||
// watch.Reset();
|
||||
// watch.Start();
|
||||
// for (var i = 0; i < 1000; i++)
|
||||
// {
|
||||
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
|
||||
// }
|
||||
// watch.Stop();
|
||||
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
|
||||
//}
|
||||
|
||||
[Test]
|
||||
public void Create_Cached_Plugin_File()
|
||||
{
|
||||
var types = new[] {typeof (PluginManager), typeof (PluginManagerTests), typeof (UmbracoContext)};
|
||||
[Test]
|
||||
public void Detect_Legacy_Plugin_File_List()
|
||||
{
|
||||
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache");
|
||||
var manager = new PluginManager(false);
|
||||
var filePath = Path.Combine(tempFolder, "umbraco-plugins.list");
|
||||
File.WriteAllText(filePath, @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<plugins>
|
||||
<baseType type=""umbraco.interfaces.ICacheRefresher"">
|
||||
<add type=""umbraco.macroCacheRefresh, umbraco, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"" />
|
||||
</baseType>
|
||||
</plugins>");
|
||||
|
||||
var manager = new PluginManager(false);
|
||||
//yes this is silly, none of these types inherit from string, but this is just to test the xml file format
|
||||
manager.UpdateCachedPluginsFile<string>(types);
|
||||
Assert.IsTrue(manager.DetectLegacyPluginListFile());
|
||||
|
||||
var plugins = manager.TryGetCachedPluginsFromFile<string>();
|
||||
Assert.IsTrue(plugins.Success);
|
||||
Assert.AreEqual(3, plugins.Result.Count());
|
||||
var shouldContain = types.Select(x => x.AssemblyQualifiedName);
|
||||
//ensure they are all found
|
||||
Assert.IsTrue(plugins.Result.ContainsAll(shouldContain));
|
||||
}
|
||||
File.Delete(filePath);
|
||||
|
||||
[Test]
|
||||
public void PluginHash_From_String()
|
||||
{
|
||||
var s = "hello my name is someone".GetHashCode().ToString("x", CultureInfo.InvariantCulture);
|
||||
var output = PluginManager.ConvertPluginsHashFromHex(s);
|
||||
Assert.AreNotEqual(0, output);
|
||||
}
|
||||
//now create a valid one
|
||||
File.WriteAllText(filePath, @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<plugins>
|
||||
<baseType type=""umbraco.interfaces.ICacheRefresher"" resolutionType=""FindAllTypes"">
|
||||
<add type=""umbraco.macroCacheRefresh, umbraco, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"" />
|
||||
</baseType>
|
||||
</plugins>");
|
||||
|
||||
[Test]
|
||||
public void Get_Plugins_Hash()
|
||||
{
|
||||
//Arrange
|
||||
var dir = PrepareFolder();
|
||||
var d1 = dir.CreateSubdirectory("1");
|
||||
var d2 = dir.CreateSubdirectory("2");
|
||||
var d3 = dir.CreateSubdirectory("3");
|
||||
var d4 = dir.CreateSubdirectory("4");
|
||||
var f1 = new FileInfo(Path.Combine(d1.FullName, "test1.dll"));
|
||||
var f2 = new FileInfo(Path.Combine(d1.FullName, "test2.dll"));
|
||||
var f3 = new FileInfo(Path.Combine(d2.FullName, "test1.dll"));
|
||||
var f4 = new FileInfo(Path.Combine(d2.FullName, "test2.dll"));
|
||||
var f5 = new FileInfo(Path.Combine(d3.FullName, "test1.dll"));
|
||||
var f6 = new FileInfo(Path.Combine(d3.FullName, "test2.dll"));
|
||||
var f7 = new FileInfo(Path.Combine(d4.FullName, "test1.dll"));
|
||||
f1.CreateText().Close();
|
||||
f2.CreateText().Close();
|
||||
f3.CreateText().Close();
|
||||
f4.CreateText().Close();
|
||||
f5.CreateText().Close();
|
||||
f6.CreateText().Close();
|
||||
f7.CreateText().Close();
|
||||
var list1 = new[] { f1, f2, f3, f4, f5, f6 };
|
||||
var list2 = new[] { f1, f3, f5 };
|
||||
var list3 = new[] { f1, f3, f5, f7 };
|
||||
Assert.IsFalse(manager.DetectLegacyPluginListFile());
|
||||
}
|
||||
|
||||
//Act
|
||||
var hash1 = PluginManager.GetAssembliesHash(list1);
|
||||
var hash2 = PluginManager.GetAssembliesHash(list2);
|
||||
var hash3 = PluginManager.GetAssembliesHash(list3);
|
||||
[Test]
|
||||
public void Create_Cached_Plugin_File()
|
||||
{
|
||||
var types = new[] { typeof(PluginManager), typeof(PluginManagerTests), typeof(UmbracoContext) };
|
||||
|
||||
//Assert
|
||||
var manager = new PluginManager(false);
|
||||
//yes this is silly, none of these types inherit from string, but this is just to test the xml file format
|
||||
manager.UpdateCachedPluginsFile<string>(types, PluginManager.TypeResolutionKind.FindAllTypes);
|
||||
|
||||
//both should be the same since we only create the hash based on the unique folder of the list passed in, yet
|
||||
//all files will exist in those folders still
|
||||
Assert.AreEqual(hash1, hash2);
|
||||
Assert.AreNotEqual(hash1, hash3);
|
||||
}
|
||||
var plugins = manager.TryGetCachedPluginsFromFile<string>(PluginManager.TypeResolutionKind.FindAllTypes);
|
||||
var diffType = manager.TryGetCachedPluginsFromFile<string>(PluginManager.TypeResolutionKind.FindAttributedTypes);
|
||||
|
||||
[Test]
|
||||
public void Ensure_Only_One_Type_List_Created()
|
||||
{
|
||||
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
|
||||
var foundTypes2 = PluginManager.Current.ResolveFindMeTypes();
|
||||
Assert.AreEqual(1,
|
||||
PluginManager.Current.GetTypeLists()
|
||||
.Count(x => x.IsTypeList<IFindMe>(PluginManager.TypeResolutionKind.FindAllTypes)));
|
||||
}
|
||||
Assert.IsTrue(plugins.Success);
|
||||
//this will be false since there is no cache of that type resolution kind
|
||||
Assert.IsFalse(diffType.Success);
|
||||
|
||||
[Test]
|
||||
public void Resolves_Types()
|
||||
{
|
||||
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
|
||||
Assert.AreEqual(2, foundTypes1.Count());
|
||||
}
|
||||
Assert.AreEqual(3, plugins.Result.Count());
|
||||
var shouldContain = types.Select(x => x.AssemblyQualifiedName);
|
||||
//ensure they are all found
|
||||
Assert.IsTrue(plugins.Result.ContainsAll(shouldContain));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_Attributed_Trees()
|
||||
{
|
||||
var trees = PluginManager.Current.ResolveAttributedTrees();
|
||||
Assert.AreEqual(27, trees.Count());
|
||||
}
|
||||
[Test]
|
||||
public void PluginHash_From_String()
|
||||
{
|
||||
var s = "hello my name is someone".GetHashCode().ToString("x", CultureInfo.InvariantCulture);
|
||||
var output = PluginManager.ConvertPluginsHashFromHex(s);
|
||||
Assert.AreNotEqual(0, output);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_Actions()
|
||||
{
|
||||
var actions = PluginManager.Current.ResolveActions();
|
||||
Assert.AreEqual(37, actions.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Get_Plugins_Hash()
|
||||
{
|
||||
//Arrange
|
||||
var dir = PrepareFolder();
|
||||
var d1 = dir.CreateSubdirectory("1");
|
||||
var d2 = dir.CreateSubdirectory("2");
|
||||
var d3 = dir.CreateSubdirectory("3");
|
||||
var d4 = dir.CreateSubdirectory("4");
|
||||
var f1 = new FileInfo(Path.Combine(d1.FullName, "test1.dll"));
|
||||
var f2 = new FileInfo(Path.Combine(d1.FullName, "test2.dll"));
|
||||
var f3 = new FileInfo(Path.Combine(d2.FullName, "test1.dll"));
|
||||
var f4 = new FileInfo(Path.Combine(d2.FullName, "test2.dll"));
|
||||
var f5 = new FileInfo(Path.Combine(d3.FullName, "test1.dll"));
|
||||
var f6 = new FileInfo(Path.Combine(d3.FullName, "test2.dll"));
|
||||
var f7 = new FileInfo(Path.Combine(d4.FullName, "test1.dll"));
|
||||
f1.CreateText().Close();
|
||||
f2.CreateText().Close();
|
||||
f3.CreateText().Close();
|
||||
f4.CreateText().Close();
|
||||
f5.CreateText().Close();
|
||||
f6.CreateText().Close();
|
||||
f7.CreateText().Close();
|
||||
var list1 = new[] { f1, f2, f3, f4, f5, f6 };
|
||||
var list2 = new[] { f1, f3, f5 };
|
||||
var list3 = new[] { f1, f3, f5, f7 };
|
||||
|
||||
[Test]
|
||||
public void Resolves_Trees()
|
||||
{
|
||||
var trees = PluginManager.Current.ResolveTrees();
|
||||
Assert.AreEqual(36, trees.Count());
|
||||
}
|
||||
//Act
|
||||
var hash1 = PluginManager.GetAssembliesHash(list1);
|
||||
var hash2 = PluginManager.GetAssembliesHash(list2);
|
||||
var hash3 = PluginManager.GetAssembliesHash(list3);
|
||||
|
||||
[Test]
|
||||
public void Resolves_Applications()
|
||||
{
|
||||
var apps = PluginManager.Current.ResolveApplications();
|
||||
Assert.AreEqual(7, apps.Count());
|
||||
}
|
||||
//Assert
|
||||
Assert.AreNotEqual(hash1, hash2);
|
||||
Assert.AreNotEqual(hash1, hash3);
|
||||
Assert.AreNotEqual(hash2, hash3);
|
||||
|
||||
[Test]
|
||||
public void Resolves_Action_Handlers()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveActionHandlers();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
Assert.AreEqual(hash1, PluginManager.GetAssembliesHash(list1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_DataTypes()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveDataTypes();
|
||||
Assert.AreEqual(37, types.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Ensure_Only_One_Type_List_Created()
|
||||
{
|
||||
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
|
||||
var foundTypes2 = PluginManager.Current.ResolveFindMeTypes();
|
||||
Assert.AreEqual(1,
|
||||
PluginManager.Current.GetTypeLists()
|
||||
.Count(x => x.IsTypeList<IFindMe>(PluginManager.TypeResolutionKind.FindAllTypes)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_RazorDataTypeModels()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRazorDataTypeModels();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_Types()
|
||||
{
|
||||
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
|
||||
Assert.AreEqual(2, foundTypes1.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_RestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRestExtensions();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_Attributed_Trees()
|
||||
{
|
||||
var trees = PluginManager.Current.ResolveAttributedTrees();
|
||||
Assert.AreEqual(27, trees.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_LegacyRestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveLegacyRestExtensions();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_Actions()
|
||||
{
|
||||
var actions = PluginManager.Current.ResolveActions();
|
||||
Assert.AreEqual(37, actions.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Resolves_XsltExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveXsltExtensions();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_Trees()
|
||||
{
|
||||
var trees = PluginManager.Current.ResolveTrees();
|
||||
Assert.AreEqual(36, trees.Count());
|
||||
}
|
||||
|
||||
[XsltExtension("Blah.Blah")]
|
||||
public class MyXsltExtension
|
||||
{
|
||||
[Test]
|
||||
public void Resolves_Applications()
|
||||
{
|
||||
var apps = PluginManager.Current.ResolveApplications();
|
||||
Assert.AreEqual(7, apps.Count());
|
||||
}
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_Action_Handlers()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveActionHandlers();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
|
||||
[umbraco.presentation.umbracobase.RestExtension("Blah")]
|
||||
public class MyLegacyRestExtension
|
||||
{
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_DataTypes()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveDataTypes();
|
||||
Assert.AreEqual(37, types.Count());
|
||||
}
|
||||
|
||||
[Umbraco.Web.BaseRest.RestExtension("Blah")]
|
||||
public class MyRestExtesion
|
||||
{
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_RazorDataTypeModels()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRazorDataTypeModels();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
}
|
||||
|
||||
public interface IFindMe
|
||||
{
|
||||
[Test]
|
||||
public void Resolves_RestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveRestExtensions();
|
||||
Assert.AreEqual(2, types.Count());
|
||||
}
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Resolves_LegacyRestExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveLegacyRestExtensions();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
|
||||
public class FindMe1 : IFindMe
|
||||
{
|
||||
[Test]
|
||||
public void Resolves_XsltExtensions()
|
||||
{
|
||||
var types = PluginManager.Current.ResolveXsltExtensions();
|
||||
Assert.AreEqual(1, types.Count());
|
||||
}
|
||||
|
||||
}
|
||||
[XsltExtension("Blah.Blah")]
|
||||
public class MyXsltExtension
|
||||
{
|
||||
|
||||
public class FindMe2 : IFindMe
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
[umbraco.presentation.umbracobase.RestExtension("Blah")]
|
||||
public class MyLegacyRestExtension
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Umbraco.Web.BaseRest.RestExtension("Blah")]
|
||||
public class MyRestExtesion
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface IFindMe
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class FindMe1 : IFindMe
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class FindMe2 : IFindMe
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,66 +12,87 @@ using System.Linq;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
public class DynamicNodeTests : DynamicDocumentTestsBase<DynamicNode, DynamicNodeList>
|
||||
{
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
[TestFixture]
|
||||
public class DynamicNodeTests : DynamicDocumentTestsBase<DynamicNode, DynamicNodeList>
|
||||
{
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
//copy the umbraco settings file over
|
||||
var currDir = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory);
|
||||
File.Copy(
|
||||
currDir.Parent.Parent.Parent.GetDirectories("Umbraco.Web.UI")
|
||||
.First()
|
||||
.GetDirectories("config").First()
|
||||
.GetFiles("umbracoSettings.Release.config").First().FullName,
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
//copy the umbraco settings file over
|
||||
var currDir = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory);
|
||||
File.Copy(
|
||||
currDir.Parent.Parent.Parent.GetDirectories("Umbraco.Web.UI")
|
||||
.First()
|
||||
.GetDirectories("config").First()
|
||||
.GetFiles("umbracoSettings.Release.config").First().FullName,
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
|
||||
UmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config, false);
|
||||
UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
|
||||
PluginManager.Current.AssembliesToScan = new[]
|
||||
{
|
||||
typeof(DynamicNode).Assembly
|
||||
};
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
DynamicNode.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
//need to specify a custom callback for unit tests
|
||||
DynamicNode.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
[Test]
|
||||
[Ignore("This test will never work unless DynamicNode is refactored a lot in order to get a list of root nodes since root nodes don't have a parent to look up")]
|
||||
public override void Is_First_Root_Nodes()
|
||||
{
|
||||
base.Is_First_Root_Nodes();
|
||||
}
|
||||
|
||||
PluginManager.Current.AssembliesToScan = null;
|
||||
}
|
||||
[Test]
|
||||
[Ignore("This test will never work unless DynamicNode is refactored a lot in order to get a list of root nodes since root nodes don't have a parent to look up")]
|
||||
public override void Is_Not_First_Root_Nodes()
|
||||
{
|
||||
base.Is_Not_First_Root_Nodes();
|
||||
}
|
||||
|
||||
protected override dynamic GetDynamicNode(int id)
|
||||
{
|
||||
//var template = Template.MakeNew("test", new User(0));
|
||||
//var ctx = GetUmbracoContext("/test", template.Id);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var contentStore = new DefaultPublishedContentStore();
|
||||
var node = new DynamicNode(
|
||||
new DynamicBackingItem(
|
||||
new Node(ctx.GetXml().SelectSingleNode("//*[@id='" + id + "' and @isDoc]"))));
|
||||
Assert.IsNotNull(node);
|
||||
return (dynamic) node;
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
[Ignore("This test will never work unless DynamicNode is refactored a lot in order to get a list of root nodes since root nodes don't have a parent to look up")]
|
||||
public override void Is_Position_Root_Nodes()
|
||||
{
|
||||
base.Is_Position_Root_Nodes();
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PluginManager.Current.AssembliesToScan = null;
|
||||
}
|
||||
|
||||
protected override dynamic GetDynamicNode(int id)
|
||||
{
|
||||
//var template = Template.MakeNew("test", new User(0));
|
||||
//var ctx = GetUmbracoContext("/test", template.Id);
|
||||
var ctx = GetUmbracoContext("/test", 1234);
|
||||
var contentStore = new DefaultPublishedContentStore();
|
||||
var node = new DynamicNode(
|
||||
new DynamicBackingItem(
|
||||
new Node(ctx.GetXml().SelectSingleNode("//*[@id='" + id + "' and @isDoc]"))));
|
||||
Assert.IsNotNull(node);
|
||||
return (dynamic)node;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +1,22 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Models;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class DynamicPublishedContentTests : DynamicDocumentTestsBase<DynamicPublishedContent, DynamicPublishedContentList>
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var rCtx = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = rCtx.UmbracoContext;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
}
|
||||
|
||||
internal DynamicPublishedContent GetNode(int id)
|
||||
|
||||
@@ -7,139 +7,139 @@ using System.Linq;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
public class DynamicXmlTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class DynamicXmlTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Custom_Extension_Method_Legacy()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
[Test]
|
||||
public void Custom_Extension_Method_Legacy()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
|
||||
//we haven't explicitly defined ElementAt so this will dynamically invoke this method
|
||||
var element = dynamicXml.ElementAt(0);
|
||||
//we haven't explicitly defined ElementAt so this will dynamically invoke this method
|
||||
var element = dynamicXml.ElementAt(0);
|
||||
|
||||
Assert.AreEqual("1057", Enumerable.First(element.BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
Assert.AreEqual("1057", Enumerable.First(element.BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Custom_Extension_Method()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new DynamicXml(xml);
|
||||
|
||||
dynamic dynamicXml = typedXml;
|
||||
[Test]
|
||||
public void Custom_Extension_Method()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new DynamicXml(xml);
|
||||
|
||||
//we haven't explicitly defined ElementAt so this will dynamically invoke this method
|
||||
var element = dynamicXml.ElementAt(0);
|
||||
dynamic dynamicXml = typedXml;
|
||||
|
||||
Assert.AreEqual("1057", Enumerable.First(element.BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
//we haven't explicitly defined ElementAt so this will dynamically invoke this method
|
||||
var element = dynamicXml.ElementAt(0);
|
||||
|
||||
[Test]
|
||||
public void Take_Legacy()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
var typedTaken = typedXml.Take(1);
|
||||
var dynamicTaken = dynamicXml.Take(1);
|
||||
Assert.AreEqual("1057", Enumerable.First(element.BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, typedTaken.Count());
|
||||
Assert.AreEqual(1, Enumerable.Count(dynamicTaken));
|
||||
[Test]
|
||||
public void Take_Legacy()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
var typedTaken = typedXml.Take(1);
|
||||
var dynamicTaken = dynamicXml.Take(1);
|
||||
|
||||
Assert.AreEqual("1057", typedTaken.ElementAt(0).BaseElement.Elements().First().Attribute("id").Value);
|
||||
Assert.AreEqual("1057", Enumerable.First(Enumerable.ElementAt(dynamicTaken, 0).BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
Assert.AreEqual(1, typedTaken.Count());
|
||||
Assert.AreEqual(1, Enumerable.Count(dynamicTaken));
|
||||
|
||||
[Test]
|
||||
public void Take()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
var typedTaken = typedXml.Take(1);
|
||||
var dynamicTaken = dynamicXml.Take(1);
|
||||
Assert.AreEqual("1057", typedTaken.ElementAt(0).BaseElement.Elements().First().Attribute("id").Value);
|
||||
Assert.AreEqual("1057", Enumerable.First(Enumerable.ElementAt(dynamicTaken, 0).BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, typedTaken.Count());
|
||||
Assert.AreEqual(1, Enumerable.Count(dynamicTaken));
|
||||
[Test]
|
||||
public void Take()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var typedXml = new DynamicXml(xml);
|
||||
dynamic dynamicXml = typedXml;
|
||||
var typedTaken = typedXml.Take(1);
|
||||
var dynamicTaken = dynamicXml.Take(1);
|
||||
|
||||
Assert.AreEqual("1057", typedTaken.ElementAt(0).BaseElement.Elements().First().Attribute("id").Value);
|
||||
Assert.AreEqual("1057", Enumerable.First(Enumerable.ElementAt(dynamicTaken, 0).BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
Assert.AreEqual(1, typedTaken.Count());
|
||||
Assert.AreEqual(1, Enumerable.Count(dynamicTaken));
|
||||
|
||||
[Test]
|
||||
public void Ensure_Legacy_Objects_Are_Returned()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var mediaItems = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
//Debug.WriteLine("full xml = {0}", mediaItems.ToXml());
|
||||
Assert.AreEqual("1057", typedTaken.ElementAt(0).BaseElement.Elements().First().Attribute("id").Value);
|
||||
Assert.AreEqual("1057", Enumerable.First(Enumerable.ElementAt(dynamicTaken, 0).BaseElement.Elements()).Attribute("id").Value);
|
||||
}
|
||||
|
||||
if (mediaItems.Count() != 0)
|
||||
{
|
||||
foreach (dynamic item in mediaItems)
|
||||
{
|
||||
Type itemType = item.GetType();
|
||||
Debug.WriteLine("item type = {0}", itemType);
|
||||
dynamic image = item.Image;
|
||||
[Test]
|
||||
public void Ensure_Legacy_Objects_Are_Returned()
|
||||
{
|
||||
var xml = "<DAMP fullMedia=\"\"><mediaItem><Image id=\"1057\" version=\"d58d5c16-153e-4896-892f-a722e45a69af\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:55:29\" updateDate=\"2012-11-05T16:55:44\" nodeName=\"test12\" urlName=\"test12\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1057\"><umbracoFile>/media/54/tulips.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>620888</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:55:34\"><crop name=\"thumbCrop\" x=\"154\" y=\"1\" x2=\"922\" y2=\"768\" url=\"/media/54/tulips_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem><mediaItem><Image id=\"1055\" version=\"4df1f08a-3552-45f2-b4bf-fa980c762f4a\" parentID=\"-1\" level=\"1\" writerID=\"0\" nodeType=\"1032\" template=\"0\" sortOrder=\"1\" createDate=\"2012-11-05T16:29:58\" updateDate=\"2012-11-05T16:30:27\" nodeName=\"Test\" urlName=\"test\" writerName=\"admin\" nodeTypeAlias=\"Image\" path=\"-1,1055\"><umbracoFile>/media/41/hydrangeas.jpg</umbracoFile><umbracoWidth>1024</umbracoWidth><umbracoHeight>768</umbracoHeight><umbracoBytes>595284</umbracoBytes><umbracoExtension>jpg</umbracoExtension><newsCrops><crops date=\"2012-11-05T16:30:18\"><crop name=\"thumbCrop\" x=\"133\" y=\"0\" x2=\"902\" y2=\"768\" url=\"/media/41/hydrangeas_thumbCrop.jpg\" /></crops></newsCrops></Image></mediaItem></DAMP>";
|
||||
var mediaItems = new global::umbraco.MacroEngines.DynamicXml(xml);
|
||||
//Debug.WriteLine("full xml = {0}", mediaItems.ToXml());
|
||||
|
||||
Type imageType = image.GetType();
|
||||
Debug.WriteLine("image type = {0}", imageType);
|
||||
|
||||
//ensure they are the same
|
||||
Assert.AreEqual(itemType, imageType);
|
||||
if (mediaItems.Count() != 0)
|
||||
{
|
||||
foreach (dynamic item in mediaItems)
|
||||
{
|
||||
Type itemType = item.GetType();
|
||||
Debug.WriteLine("item type = {0}", itemType);
|
||||
dynamic image = item.Image;
|
||||
|
||||
//ensure they are legacy
|
||||
Assert.AreEqual(typeof(global::umbraco.MacroEngines.DynamicXml), itemType);
|
||||
Assert.AreEqual(typeof(global::umbraco.MacroEngines.DynamicXml), imageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Type imageType = image.GetType();
|
||||
Debug.WriteLine("image type = {0}", imageType);
|
||||
|
||||
/// <summary>
|
||||
/// Test the current Core class
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Find_Test_Core_Class()
|
||||
{
|
||||
RunFindTest(x => new DynamicXml(x));
|
||||
}
|
||||
//ensure they are the same
|
||||
Assert.AreEqual(itemType, imageType);
|
||||
|
||||
/// <summary>
|
||||
/// Tests the macroEngines legacy class
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Find_Test_Legacy_Class()
|
||||
{
|
||||
RunFindTest(x => new global::umbraco.MacroEngines.DynamicXml(x));
|
||||
}
|
||||
//ensure they are legacy
|
||||
Assert.AreEqual(typeof(global::umbraco.MacroEngines.DynamicXml), itemType);
|
||||
Assert.AreEqual(typeof(global::umbraco.MacroEngines.DynamicXml), imageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RunFindTest(Func<string, dynamic> getDynamicXml)
|
||||
{
|
||||
var xmlstring = @"<test>
|
||||
/// <summary>
|
||||
/// Test the current Core class
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Find_Test_Core_Class()
|
||||
{
|
||||
RunFindTest(x => new DynamicXml(x));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the macroEngines legacy class
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void Find_Test_Legacy_Class()
|
||||
{
|
||||
RunFindTest(x => new global::umbraco.MacroEngines.DynamicXml(x));
|
||||
}
|
||||
|
||||
private void RunFindTest(Func<string, dynamic> getDynamicXml)
|
||||
{
|
||||
var xmlstring = @"<test>
|
||||
<item id='1' name='test 1' value='found 1'/>
|
||||
<item id='2' name='test 2' value='found 2'/>
|
||||
<item id='3' name='test 3' value='found 3'/>
|
||||
</test>";
|
||||
|
||||
dynamic dXml = getDynamicXml(xmlstring);
|
||||
dynamic dXml = getDynamicXml(xmlstring);
|
||||
|
||||
var result1 = dXml.Find("@name", "test 1");
|
||||
var result2 = dXml.Find("@name", "test 2");
|
||||
var result3 = dXml.Find("@name", "test 3");
|
||||
var result4 = dXml.Find("@name", "dont find");
|
||||
var result1 = dXml.Find("@name", "test 1");
|
||||
var result2 = dXml.Find("@name", "test 2");
|
||||
var result3 = dXml.Find("@name", "test 3");
|
||||
var result4 = dXml.Find("@name", "dont find");
|
||||
|
||||
Assert.AreEqual("found 1", result1.value);
|
||||
Assert.AreEqual("found 2", result2.value);
|
||||
Assert.AreEqual("found 3", result3.value);
|
||||
Assert.Throws<RuntimeBinderException>(() =>
|
||||
{
|
||||
//this will throw because result4 is not found
|
||||
var temp = result4.value;
|
||||
});
|
||||
}
|
||||
Assert.AreEqual("found 1", result1.value);
|
||||
Assert.AreEqual("found 2", result2.value);
|
||||
Assert.AreEqual("found 3", result3.value);
|
||||
Assert.Throws<RuntimeBinderException>(() =>
|
||||
{
|
||||
//this will throw because result4 is not found
|
||||
var temp = result4.value;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Lucene.Net.Documents;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Tests.TestHelpers.ExamineHelpers;
|
||||
using umbraco.MacroEngines;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
public class LegacyExamineBackedMediaTests : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
UmbracoSettings.UmbracoLibraryCacheDuration = 1800;
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Children_Are_Sorted()
|
||||
{
|
||||
var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
|
||||
var indexInit = new IndexInitializer();
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var searcher = indexInit.GetUmbracoSearcher(newIndexFolder);
|
||||
var result = searcher.Search(searcher.CreateSearchCriteria().Id(1111).Compile());
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(1, result.TotalItemCount);
|
||||
|
||||
var searchItem = result.First();
|
||||
var backedMedia = new ExamineBackedMedia(searchItem, indexer, searcher);
|
||||
var children = backedMedia.ChildrenAsList.Value;
|
||||
|
||||
var currSort = 0;
|
||||
for (var i = 0; i < children.Count(); i++)
|
||||
{
|
||||
Assert.GreaterOrEqual(children[i].SortOrder, currSort);
|
||||
currSort = children[i].SortOrder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Result_Has_All_Values()
|
||||
{
|
||||
var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
|
||||
var indexInit = new IndexInitializer();
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var searcher = indexInit.GetUmbracoSearcher(newIndexFolder);
|
||||
var result = searcher.Search(searcher.CreateSearchCriteria().Id(1111).Compile());
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(1, result.TotalItemCount);
|
||||
|
||||
var searchItem = result.First();
|
||||
var backedMedia = new ExamineBackedMedia(searchItem, indexer, searcher);
|
||||
|
||||
Assert.AreEqual(searchItem.Id, backedMedia.Id);
|
||||
Assert.AreEqual(searchItem.Fields["sortOrder"], backedMedia.SortOrder.ToString());
|
||||
Assert.AreEqual(searchItem.Fields["urlName"], backedMedia.UrlName);
|
||||
Assert.AreEqual(DateTools.StringToDate(searchItem.Fields["createDate"]), backedMedia.CreateDate);
|
||||
Assert.AreEqual(DateTools.StringToDate(searchItem.Fields["updateDate"]), backedMedia.UpdateDate);
|
||||
Assert.AreEqual(Guid.Parse(searchItem.Fields["version"]), backedMedia.Version);
|
||||
Assert.AreEqual(searchItem.Fields["level"], backedMedia.Level.ToString());
|
||||
Assert.AreEqual(searchItem.Fields["writerID"], backedMedia.WriterID.ToString());
|
||||
Assert.AreEqual(searchItem.Fields["writerID"], backedMedia.CreatorID.ToString()); //there's only writerId in the xml
|
||||
Assert.AreEqual(searchItem.Fields["writerName"], backedMedia.CreatorName);
|
||||
Assert.AreEqual(searchItem.Fields["writerName"], backedMedia.WriterName); //tehre's only writer name in the xml
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for tests for published content and published media
|
||||
/// </summary>
|
||||
public abstract class PublishedContentTestBase : BaseRoutingTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var rCtx = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = rCtx.UmbracoContext;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
PublishedMediaStoreResolver.Current = new PublishedMediaStoreResolver(new DefaultPublishedMediaStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
PublishedMediaStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
/// Tests the methods on IPublishedContent using the DefaultPublishedContentStore
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class PublishedContentTests : BaseWebTest
|
||||
public class PublishedContentTests : PublishedContentTestBase
|
||||
{
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
@@ -62,38 +62,12 @@ namespace Umbraco.Tests.PublishedContent
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var umbCtx = GetUmbracoContext("/test", 1234);
|
||||
UmbracoContext.Current = umbCtx;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
|
||||
}
|
||||
|
||||
internal IPublishedContent GetNode(int id)
|
||||
|
||||
@@ -24,68 +24,24 @@ using System.Linq;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Tests the typed extension methods on IPublishedContent using the DefaultPublishedMediaStore
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class PublishedMediaTests : BaseWebTest
|
||||
[TestFixture, RequiresSTA]
|
||||
public class PublishedMediaTests : PublishedContentTestBase
|
||||
{
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
DoInitialization(GetUmbracoContext("/test", 1234));
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
UmbracoSettings.UmbracoLibraryCacheDuration = 1800;
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared with PublishMediaStoreTests
|
||||
/// </summary>
|
||||
/// <param name="umbContext"></param>
|
||||
internal static void DoInitialization(UmbracoContext umbContext)
|
||||
{
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
UmbracoSettings.UmbracoLibraryCacheDuration = 1800;
|
||||
|
||||
UmbracoContext.Current = umbContext;
|
||||
PublishedMediaStoreResolver.Current = new PublishedMediaStoreResolver(new DefaultPublishedMediaStore());
|
||||
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
}
|
||||
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
DoTearDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared with PublishMediaStoreTests
|
||||
/// </summary>
|
||||
internal static void DoTearDown()
|
||||
{
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
PublishedMediaStoreResolver.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,7 +64,33 @@ namespace Umbraco.Tests.PublishedContent
|
||||
return GetNode(id, GetUmbracoContext("/test", 1234));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test]
|
||||
public void Ensure_Children_Sorted_With_Examine()
|
||||
{
|
||||
var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
|
||||
var indexInit = new IndexInitializer();
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111);
|
||||
var rootChildren = publishedMedia.Children().ToArray();
|
||||
var currSort = 0;
|
||||
for (var i = 0; i < rootChildren.Count(); i++)
|
||||
{
|
||||
Assert.GreaterOrEqual(rootChildren[i].SortOrder, currSort);
|
||||
currSort = rootChildren[i].SortOrder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Children_With_Examine()
|
||||
{
|
||||
var newIndexFolder = new DirectoryInfo(Path.Combine("App_Data\\CWSIndexSetTest", Guid.NewGuid().ToString()));
|
||||
@@ -116,7 +98,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder));
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111);
|
||||
@@ -136,7 +120,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder));
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111);
|
||||
@@ -156,7 +142,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder));
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 1111);
|
||||
@@ -176,7 +164,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder));
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113);
|
||||
@@ -192,7 +182,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var indexer = indexInit.GetUmbracoIndexer(newIndexFolder);
|
||||
indexer.RebuildIndex();
|
||||
|
||||
var store = new DefaultPublishedMediaStore(indexInit.GetUmbracoSearcher(newIndexFolder));
|
||||
var store = new DefaultPublishedMediaStore(
|
||||
indexInit.GetUmbracoSearcher(newIndexFolder),
|
||||
indexInit.GetUmbracoIndexer(newIndexFolder));
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = store.GetDocumentById(GetUmbracoContext("/test", 1234), 3113);
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
@@ -11,8 +12,18 @@ using Umbraco.Web;
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
public class StronglyTypedQueryTests : BaseWebTest
|
||||
public class StronglyTypedQueryTests : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
@@ -68,7 +79,8 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.IsNotNull(doc);
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void Type_Test()
|
||||
{
|
||||
@@ -78,6 +90,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.AreEqual("John Smith", result[1].ArticleAuthor);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void As_Test()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Resolvers
|
||||
};
|
||||
|
||||
ActionsResolver.Current = new ActionsResolver(
|
||||
PluginManager.Current.ResolveActions());
|
||||
() => PluginManager.Current.ResolveActions());
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Tests.Resolvers
|
||||
{
|
||||
[TestFixture]
|
||||
public class LazyManyObjectResolverTests
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Resolution.IsFrozen = false;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_Lazy_Type_Resolution()
|
||||
{
|
||||
var resolver = new LazyResolver(new[] {new Lazy<Type>(() => typeof (TransientObject3))});
|
||||
resolver.AddType<TransientObject1>();
|
||||
resolver.AddType(new Lazy<Type>(() => typeof(TransientObject2)));
|
||||
|
||||
Resolution.Freeze();
|
||||
|
||||
Assert.IsFalse(resolver.HasResolvedTypes);
|
||||
|
||||
var instances1 = resolver.Objects;
|
||||
|
||||
Assert.IsTrue(resolver.HasResolvedTypes);
|
||||
|
||||
Assert.AreEqual(3, instances1.Count());
|
||||
Assert.IsTrue(instances1.Select(x => x.GetType()).ContainsAll(new []{typeof(TransientObject1), typeof(TransientObject2), typeof(TransientObject3)}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Type_List_Delegates_Combination()
|
||||
{
|
||||
Func<IEnumerable<Type>> types = () => new[] { typeof(TransientObject3), typeof(TransientObject2) };
|
||||
|
||||
var resolver = new LazyResolver(types);
|
||||
resolver.AddTypeListDelegate(() => new[] { typeof(TransientObject1)});
|
||||
|
||||
Resolution.Freeze();
|
||||
|
||||
var instances1 = resolver.Objects;
|
||||
|
||||
Assert.AreEqual(3, instances1.Count());
|
||||
Assert.IsTrue(instances1.Select(x => x.GetType()).ContainsAll(new[] { typeof(TransientObject1), typeof(TransientObject2), typeof(TransientObject3) }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Type_List_Delegates_And_Lazy_Type_Combination()
|
||||
{
|
||||
Func<IEnumerable<Type>> types = () => new[] { typeof(TransientObject3) };
|
||||
|
||||
var resolver = new LazyResolver(types);
|
||||
resolver.AddType(new Lazy<Type>(() => typeof(TransientObject2)));
|
||||
resolver.AddType<TransientObject1>();
|
||||
|
||||
Resolution.Freeze();
|
||||
|
||||
var instances1 = resolver.Objects;
|
||||
|
||||
Assert.AreEqual(3, instances1.Count());
|
||||
Assert.IsTrue(instances1.Select(x => x.GetType()).ContainsAll(new[] { typeof(TransientObject1), typeof(TransientObject2), typeof(TransientObject3) }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Throws_If_Duplication()
|
||||
{
|
||||
Func<IEnumerable<Type>> types = () => new[] { typeof(TransientObject3), typeof(TransientObject2), typeof(TransientObject1) };
|
||||
|
||||
var resolver = new LazyResolver(types);
|
||||
//duplicate, but will not throw here
|
||||
resolver.AddType<TransientObject1>();
|
||||
|
||||
Resolution.Freeze();
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
{
|
||||
var instances = resolver.Objects;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Test classes
|
||||
|
||||
private interface ITestInterface
|
||||
{
|
||||
}
|
||||
|
||||
private class TransientObject1 : ITestInterface
|
||||
{
|
||||
}
|
||||
|
||||
private class TransientObject2 : ITestInterface
|
||||
{
|
||||
}
|
||||
|
||||
private class TransientObject3 : ITestInterface
|
||||
{
|
||||
}
|
||||
|
||||
private sealed class LazyResolver : LazyManyObjectsResolverBase<LazyResolver, ITestInterface>
|
||||
{
|
||||
public LazyResolver()
|
||||
: base(ObjectLifetimeScope.Transient)
|
||||
{
|
||||
}
|
||||
|
||||
public LazyResolver(IEnumerable<Lazy<Type>> values)
|
||||
:base (values, ObjectLifetimeScope.Transient)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LazyResolver(Func<IEnumerable<Type>> typeList)
|
||||
: base(typeList, ObjectLifetimeScope.Transient)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<ITestInterface> Objects
|
||||
{
|
||||
get { return Values; }
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Resolvers
|
||||
};
|
||||
|
||||
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
|
||||
PluginManager.Current.ResolveMacroRenderings());
|
||||
() => PluginManager.Current.ResolveMacroRenderings());
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Umbraco.Tests.Resolvers
|
||||
Assert.IsFalse(object.ReferenceEquals(instances1.Single(), instances3.Single()));
|
||||
}
|
||||
|
||||
#region
|
||||
#region Test classes
|
||||
|
||||
private interface ITestInterface
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Resolvers
|
||||
};
|
||||
|
||||
PackageActionsResolver.Current = new PackageActionsResolver(
|
||||
PluginManager.Current.ResolvePackageActions());
|
||||
() => PluginManager.Current.ResolvePackageActions());
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
@@ -9,12 +9,6 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByAliasTests : BaseRoutingTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
|
||||
@@ -9,12 +9,6 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByNiceUrlAndTemplateTests : BaseRoutingTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
[TestCase("/blah")]
|
||||
[TestCase("/default.aspx/blah")] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
|
||||
[TestCase("/home/Sub1/blah")]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Configuration;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Routing;
|
||||
using umbraco.BusinessLogic;
|
||||
@@ -10,11 +11,15 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByNiceUrlTests : BaseRoutingTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
@@ -23,7 +28,8 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TestCase("/", 1046)]
|
||||
[TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
|
||||
[TestCase("/Sub1", 1173)]
|
||||
@@ -35,14 +41,13 @@ namespace Umbraco.Tests.Routing
|
||||
// we've made it return "/test-page" => we have to support that url back in the lookup...
|
||||
[TestCase("/home", 1046)]
|
||||
[TestCase("/test-page", 1172)]
|
||||
|
||||
public void Match_Document_By_Url_Hide_Top_Level(string urlString, int expectedId)
|
||||
{
|
||||
var routingContext = GetRoutingContext(urlString);
|
||||
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docreq = new PublishedContentRequest(url, routingContext);
|
||||
var lookup = new LookupByNiceUrl();
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
var lookup = new LookupByNiceUrl(false);
|
||||
SettingsForTests.HideTopLevelNodeFromPath = true;
|
||||
|
||||
var result = lookup.TrySetDocument(docreq);
|
||||
|
||||
@@ -57,6 +62,7 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestCase("/", 1046)]
|
||||
[TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
|
||||
[TestCase("/home", 1046)]
|
||||
@@ -68,8 +74,9 @@ namespace Umbraco.Tests.Routing
|
||||
var routingContext = GetRoutingContext(urlString);
|
||||
var url = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docreq = new PublishedContentRequest(url, routingContext);
|
||||
var lookup = new LookupByNiceUrl();
|
||||
|
||||
var lookup = new LookupByNiceUrl(false);
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
var result = lookup.TrySetDocument(docreq);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
|
||||
@@ -18,16 +18,8 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
base.Initialize();
|
||||
InitializeLanguagesAndDomains();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void InitializeLanguagesAndDomains()
|
||||
{
|
||||
var domains = Domain.GetDomains();
|
||||
@@ -154,7 +146,7 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
SetDomains3();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
SettingsForTests.HideTopLevelNodeFromPath = true;
|
||||
|
||||
var routingContext = GetRoutingContext(url);
|
||||
var uri = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
@@ -193,7 +185,7 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
SetDomains4();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
SettingsForTests.HideTopLevelNodeFromPath = true;
|
||||
|
||||
var routingContext = GetRoutingContext(url);
|
||||
var uri = routingContext.UmbracoContext.CleanedUmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -13,15 +15,17 @@ namespace Umbraco.Tests.Routing
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
var currDir = new DirectoryInfo(TestHelper.CurrentAssemblyDirectory);
|
||||
File.Copy(
|
||||
currDir.Parent.Parent.Parent.GetDirectories("Umbraco.Web.UI")
|
||||
.First()
|
||||
.GetDirectories("config").First()
|
||||
.GetFiles("umbracoSettings.Release.config").First().FullName,
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
SettingsForTests.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
}
|
||||
|
||||
internal override IRoutesCache GetRoutesCache()
|
||||
@@ -33,11 +37,14 @@ namespace Umbraco.Tests.Routing
|
||||
/// This checks that when we retreive a NiceUrl for multiple items that there are no issues with cache overlap
|
||||
/// and that they are all cached correctly.
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Ensure_Cache_Is_Correct()
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
SettingsForTests.AddTrailingSlash = false; // (cached routes have none)
|
||||
|
||||
var samples = new Dictionary<int, string> {
|
||||
{ 1046, "/home" },
|
||||
@@ -84,22 +91,22 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
|
||||
// test hideTopLevelNodeFromPath false
|
||||
[TestCase(1046, "/home")]
|
||||
[TestCase(1173, "/home/sub1")]
|
||||
[TestCase(1174, "/home/sub1/sub2")]
|
||||
[TestCase(1176, "/home/sub1/sub-3")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/home/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
[TestCase(1046, "/home/")]
|
||||
[TestCase(1173, "/home/sub1/")]
|
||||
[TestCase(1174, "/home/sub1/sub2/")]
|
||||
[TestCase(1176, "/home/sub1/sub-3/")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1/")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2/")]
|
||||
[TestCase(1175, "/home/sub-2/")]
|
||||
[TestCase(1172, "/test-page/")]
|
||||
|
||||
public void Get_Nice_Url_Not_Hiding_Top_Level(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
@@ -109,21 +116,21 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// test hideTopLevelNodeFromPath true
|
||||
[TestCase(1046, "/")]
|
||||
[TestCase(1173, "/sub1")]
|
||||
[TestCase(1174, "/sub1/sub2")]
|
||||
[TestCase(1176, "/sub1/sub-3")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/sub-2")]
|
||||
[TestCase(1172, "/test-page")] // not hidden because not first root
|
||||
[TestCase(1173, "/sub1/")]
|
||||
[TestCase(1174, "/sub1/sub2/")]
|
||||
[TestCase(1176, "/sub1/sub-3/")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1/")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2/")]
|
||||
[TestCase(1175, "/sub-2/")]
|
||||
[TestCase(1172, "/test-page/")] // not hidden because not first root
|
||||
|
||||
public void Get_Nice_Url_Hiding_Top_Level(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = true;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
@@ -134,18 +141,18 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
var routingContext = GetRoutingContext("http://example.com/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
SettingsForTests.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
Assert.AreEqual("http://example.com/home/sub1/custom-sub-1/", routingContext.NiceUrlProvider.GetNiceUrl(1177));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -153,14 +160,14 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
var routingContext = GetRoutingContext("http://example.com/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("#", routingContext.NiceUrlProvider.GetNiceUrl(999999));
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = true;
|
||||
SettingsForTests.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("#", routingContext.NiceUrlProvider.GetNiceUrl(999999));
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("#", routingContext.NiceUrlProvider.GetNiceUrl(999999));
|
||||
}
|
||||
|
||||
@@ -14,20 +14,11 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class NiceUrlsProviderWithDomainsTests : BaseRoutingTest
|
||||
{
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
}
|
||||
|
||||
internal override IRoutesCache GetRoutesCache()
|
||||
{
|
||||
return new DefaultRoutesCache(false);
|
||||
}
|
||||
|
||||
|
||||
void InitializeLanguagesAndDomains()
|
||||
{
|
||||
var domains = Domain.GetDomains();
|
||||
@@ -181,24 +172,23 @@ namespace Umbraco.Tests.Routing
|
||||
// with one simple domain "domain1.com"
|
||||
// basic tests
|
||||
[TestCase(1001, "http://domain1.com", false, "/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/1001-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/1001-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
// absolute tests
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/1001-1")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/1001-1/")]
|
||||
// different current tests
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/1001-1")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/1001-1/")]
|
||||
[TestCase(1001, "https://domain1.com", false, "/")]
|
||||
[TestCase(10011, "https://domain1.com", false, "/1001-1")]
|
||||
|
||||
[TestCase(10011, "https://domain1.com", false, "/1001-1/")]
|
||||
public void Get_Nice_Url_SimpleDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains1();
|
||||
@@ -210,25 +200,24 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// with one complete domain "http://domain1.com/foo"
|
||||
// basic tests
|
||||
[TestCase(1001, "http://domain1.com", false, "/foo")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/foo/1001-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(1001, "http://domain1.com", false, "/foo/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/foo/1001-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
// absolute tests
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/foo/1001-1")]
|
||||
[TestCase(1001, "http://domain1.com", true, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "http://domain1.com", true, "http://domain1.com/foo/1001-1/")]
|
||||
// different current tests
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/foo/1001-1")]
|
||||
[TestCase(1001, "https://domain1.com", false, "http://domain1.com/foo")]
|
||||
[TestCase(10011, "https://domain1.com", false, "http://domain1.com/foo/1001-1")]
|
||||
|
||||
[TestCase(1001, "http://domain2.com", false, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "http://domain2.com", false, "http://domain1.com/foo/1001-1/")]
|
||||
[TestCase(1001, "https://domain1.com", false, "http://domain1.com/foo/")]
|
||||
[TestCase(10011, "https://domain1.com", false, "http://domain1.com/foo/1001-1/")]
|
||||
public void Get_Nice_Url_SimpleWithSchemeAndPath(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains2();
|
||||
@@ -239,18 +228,17 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
|
||||
// with one domain, not at root
|
||||
[TestCase(1001, "http://domain1.com", false, "/1001")]
|
||||
[TestCase(1001, "http://domain1.com", false, "/1001/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/1001-1-1")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
|
||||
[TestCase(100111, "http://domain1.com", false, "/1001-1-1/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
public void Get_Nice_Url_DeepDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains3();
|
||||
@@ -262,24 +250,23 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// with nested domains
|
||||
[TestCase(1001, "http://domain1.com", false, "/")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/en")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/en/1001-1-1")]
|
||||
[TestCase(10012, "http://domain1.com", false, "/fr")]
|
||||
[TestCase(100121, "http://domain1.com", false, "/fr/1001-2-1")]
|
||||
[TestCase(10013, "http://domain1.com", false, "/1001-3")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002")]
|
||||
[TestCase(10011, "http://domain1.com", false, "/en/")]
|
||||
[TestCase(100111, "http://domain1.com", false, "/en/1001-1-1/")]
|
||||
[TestCase(10012, "http://domain1.com", false, "/fr/")]
|
||||
[TestCase(100121, "http://domain1.com", false, "/fr/1001-2-1/")]
|
||||
[TestCase(10013, "http://domain1.com", false, "/1001-3/")]
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
[TestCase(1003, "http://domain3.com", false, "/")]
|
||||
[TestCase(10031, "http://domain3.com", false, "/en")]
|
||||
[TestCase(100321, "http://domain3.com", false, "/fr/1003-2-1")]
|
||||
|
||||
[TestCase(10031, "http://domain3.com", false, "/en/")]
|
||||
[TestCase(100321, "http://domain3.com", false, "/fr/1003-2-1/")]
|
||||
public void Get_Nice_Url_NestedDomains(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains4();
|
||||
|
||||
@@ -293,9 +280,9 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains4();
|
||||
@@ -329,14 +316,14 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// use the cache
|
||||
Assert.AreEqual("/", routingContext.NiceUrlProvider.GetNiceUrl(1001, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en", routingContext.NiceUrlProvider.GetNiceUrl(10011, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr", routingContext.NiceUrlProvider.GetNiceUrl(10012, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/1001-2-1", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1001-3", routingContext.NiceUrlProvider.GetNiceUrl(10013, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1002", routingContext.NiceUrlProvider.GetNiceUrl(1002, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/", routingContext.NiceUrlProvider.GetNiceUrl(10011, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/", routingContext.NiceUrlProvider.GetNiceUrl(10012, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/fr/1001-2-1/", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1001-3/", routingContext.NiceUrlProvider.GetNiceUrl(10013, new Uri("http://domain1.com"), false));
|
||||
Assert.AreEqual("/1002/", routingContext.NiceUrlProvider.GetNiceUrl(1002, new Uri("http://domain1.com"), false));
|
||||
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain2.com"), false));
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1/", routingContext.NiceUrlProvider.GetNiceUrl(100121, new Uri("http://domain2.com"), false));
|
||||
}
|
||||
|
||||
void CheckRoute(IDictionary<int, string> routes, IDictionary<string, int> ids, int id, string route)
|
||||
@@ -352,24 +339,24 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
var routingContext = GetRoutingContext("http://domain1.com/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains4();
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
Assert.AreEqual("/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
SettingsForTests.UseDomainPrefixes = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
routingContext.NiceUrlProvider.EnforceAbsoluteUrls = true;
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111));
|
||||
Assert.AreEqual("http://domain3.com/en/1003-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100311));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -377,8 +364,8 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
var routingContext = GetRoutingContext("http://domain1.com/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains5();
|
||||
@@ -389,9 +376,9 @@ namespace Umbraco.Tests.Routing
|
||||
// all of them
|
||||
// including the local one - duplicate?! - then must manually exclude?
|
||||
Assert.AreEqual(3, result.Count());
|
||||
Assert.IsTrue(result.Contains("http://domain1.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1a.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1b.com/en/1001-1-1"));
|
||||
Assert.IsTrue(result.Contains("http://domain1.com/en/1001-1-1/"));
|
||||
Assert.IsTrue(result.Contains("http://domain1a.com/en/1001-1-1/"));
|
||||
Assert.IsTrue(result.Contains("http://domain1b.com/en/1001-1-1/"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Umbraco.Tests.Routing
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
System.Configuration.ConfigurationManager.AppSettings.Set("umbracoPath", "~/umbraco");
|
||||
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||
|
||||
SurfaceControllerResolver.Current = new SurfaceControllerResolver(
|
||||
PluginManager.Current.ResolveSurfaceControllers());
|
||||
@@ -36,7 +36,6 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
base.TearDown();
|
||||
RouteTable.Routes.Clear();
|
||||
System.Configuration.ConfigurationManager.AppSettings.Set("umbracoPath", "");
|
||||
SurfaceControllerResolver.Reset();
|
||||
}
|
||||
|
||||
@@ -64,7 +63,8 @@ namespace Umbraco.Tests.Routing
|
||||
}
|
||||
|
||||
//test all template name styles to match the ActionName
|
||||
[TestCase("home-page")]
|
||||
[TestCase("home-\\234^^*32page")]
|
||||
[TestCase("home-page")]
|
||||
[TestCase("Home-Page")]
|
||||
[TestCase("HomePage")]
|
||||
[TestCase("homePage")]
|
||||
@@ -84,7 +84,9 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
handler.GetHandlerForRoute(routingContext.UmbracoContext.HttpContext.Request.RequestContext, docRequest);
|
||||
Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
|
||||
Assert.AreEqual("HomePage", routeData.Values["action"].ToString());
|
||||
Assert.AreEqual(
|
||||
global::umbraco.cms.helpers.Casing.SafeAlias(templateName),
|
||||
routeData.Values["action"].ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ namespace Umbraco.Tests.Routing
|
||||
//create the module
|
||||
_module = new UmbracoModule();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoConfigurationStatus", Umbraco.Core.Configuration.GlobalSettings.CurrentVersion);
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "~/umbraco,~/install/");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd");
|
||||
SettingsForTests.ConfigurationStatus = Core.Configuration.GlobalSettings.CurrentVersion;
|
||||
SettingsForTests.ReservedPaths = "~/umbraco,~/install/";
|
||||
SettingsForTests.ReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd";
|
||||
|
||||
//create the not found handlers config
|
||||
using (var sw = File.CreateText(Umbraco.Core.IO.IOHelper.MapPath(Umbraco.Core.IO.SystemFiles.NotFoundhandlersConfig, false)))
|
||||
@@ -78,11 +78,6 @@ namespace Umbraco.Tests.Routing
|
||||
base.TearDown();
|
||||
|
||||
_module.DisposeIfDisposable();
|
||||
|
||||
//reset the app config
|
||||
ConfigurationManager.AppSettings.Set("umbracoConfigurationStatus", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "");
|
||||
}
|
||||
|
||||
// do not test for /base here as it's handled before EnsureUmbracoRoutablePage is called
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace Umbraco.Tests.Routing
|
||||
[Test]
|
||||
public void DoNotPolluteCache()
|
||||
{
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false"); // ignored w/domains
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
InitializeLanguagesAndDomains();
|
||||
SetDomains1();
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// get the nice url for 100111
|
||||
routingContext = GetRoutingContext(url);
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, true));
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111, true));
|
||||
|
||||
// check that the proper route has been cached
|
||||
var cachedRoutes = ((DefaultRoutesCache)routingContext.UmbracoContext.RoutesCache).GetCachedRoutes();
|
||||
@@ -60,19 +60,10 @@ namespace Umbraco.Tests.Routing
|
||||
//Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes
|
||||
|
||||
// what's the nice url now?
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111)); // good
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.NiceUrlProvider.GetNiceUrl(100111)); // good
|
||||
//Assert.AreEqual("http://domain1.com/1001-1/1001-1-1", routingContext.NiceUrlProvider.GetNiceUrl(100111, true)); // bad
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
|
||||
}
|
||||
|
||||
internal override IRoutesCache GetRoutesCache()
|
||||
{
|
||||
return new DefaultRoutesCache(false);
|
||||
|
||||
@@ -16,14 +16,6 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class uQueryGetNodeIdByUrlTests : BaseRoutingTest
|
||||
{
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
}
|
||||
|
||||
internal override IRoutesCache GetRoutesCache()
|
||||
{
|
||||
return new DefaultRoutesCache(false);
|
||||
@@ -70,10 +62,9 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
public void GetNodeIdByUrl_Not_Hiding_Top_Level_Absolute(int nodeId, string url)
|
||||
{
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
Assert.AreEqual(nodeId, global::umbraco.uQuery.GetNodeIdByUrl("http://example.com" + url));
|
||||
}
|
||||
@@ -89,9 +80,9 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
public void GetNodeIdByUrl_Not_Hiding_Top_Level_Relative(int nodeId, string url)
|
||||
{
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "false");
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes = false;
|
||||
SettingsForTests.UseDirectoryUrls = true;
|
||||
SettingsForTests.HideTopLevelNodeFromPath = false;
|
||||
SettingsForTests.UseDomainPrefixes = false;
|
||||
|
||||
Assert.AreEqual(nodeId, global::umbraco.uQuery.GetNodeIdByUrl(url));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,38 @@ namespace Umbraco.Tests
|
||||
[TestFixture]
|
||||
public class StringExtensionsTests
|
||||
{
|
||||
|
||||
[TestCase("This is a string to encrypt")]
|
||||
[TestCase("This is a string to encrypt\nThis is a second line")]
|
||||
[TestCase(" White space is preserved ")]
|
||||
[TestCase("\nWhite space is preserved\n")]
|
||||
public void Encrypt_And_Decrypt(string input)
|
||||
{
|
||||
var encrypted = input.EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(input, encrypted);
|
||||
Assert.AreEqual(input, decrypted);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void Encrypt_And_Decrypt_Long_Value()
|
||||
{
|
||||
// Generate a really long string
|
||||
char[] chars = { 'a', 'b', 'c', '1', '2', '3', '\n' };
|
||||
|
||||
string valueToTest = string.Empty;
|
||||
|
||||
// Create a string 7035 chars long
|
||||
for (int i = 0; i < 1005; i++)
|
||||
for (int j = 0; j < chars.Length; j++)
|
||||
valueToTest += chars[j].ToString();
|
||||
|
||||
var encrypted = valueToTest.ToString().EncryptWithMachineKey();
|
||||
var decrypted = encrypted.DecryptWithMachineKey();
|
||||
Assert.AreNotEqual(valueToTest, encrypted);
|
||||
Assert.AreEqual(valueToTest, decrypted);
|
||||
}
|
||||
|
||||
[TestCase("Hello this is my string", " string", "Hello this is my")]
|
||||
[TestCase("Hello this is my string strung", " string", "Hello this is my string strung")]
|
||||
[TestCase("Hello this is my string string", " string", "Hello this is my")]
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project DefaultTargets="RunTests" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<MSBuildCommunityTasksPath>..\..\tools\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets" />
|
||||
|
||||
<Target Name="RunTests">
|
||||
|
||||
<ItemGroup>
|
||||
<TestAssemblies Include=".\bin\Debug\Umbraco.Tests.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<NUnit ToolPath="..\..\tools\NUnit\" Assemblies="@(TestAssemblies)" OutputXmlFile=".\NUnitTestResults.xml" />
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -12,18 +12,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
[TestFixture, RequiresSTA]
|
||||
public abstract class BaseRoutingTest : BaseWebTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a new RoutingContext
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace Umbraco.Tests.TestHelpers
|
||||
[SetUp]
|
||||
public virtual void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
SettingsForTests.Reset();
|
||||
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", TestHelper.CurrentAssemblyDirectory);
|
||||
|
||||
@@ -52,7 +54,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
Cache.ClearAllCache();
|
||||
|
||||
UmbracoSettings.ResetSetters();
|
||||
SettingsForTests.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -48,37 +48,35 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers
|
||||
new[]
|
||||
{
|
||||
new TestIndexField { Name = "id", EnableSorting = true, Type = "Number" },
|
||||
new TestIndexField { Name = "nodeName", EnableSorting = true },
|
||||
new TestIndexField { Name = "version" },
|
||||
new TestIndexField { Name = "parentID" },
|
||||
new TestIndexField { Name = "level" },
|
||||
new TestIndexField { Name = "writerID" },
|
||||
new TestIndexField { Name = "creatorID" },
|
||||
new TestIndexField { Name = "nodeType" },
|
||||
new TestIndexField { Name = "template" },
|
||||
new TestIndexField { Name = "sortOrder", EnableSorting = true, Type = "Number"},
|
||||
new TestIndexField { Name = "createDate", EnableSorting = true, Type = "DateTime" },
|
||||
new TestIndexField { Name = "updateDate", EnableSorting = true, Type = "DateTime" },
|
||||
new TestIndexField { Name = "nodeName", EnableSorting = true },
|
||||
new TestIndexField { Name = "urlName" },
|
||||
new TestIndexField { Name = "writerName" },
|
||||
new TestIndexField { Name = "path" },
|
||||
new TestIndexField { Name = "creatorName" },
|
||||
new TestIndexField { Name = "nodeTypeAlias" },
|
||||
new TestIndexField { Name = "parentID" }
|
||||
new TestIndexField { Name = "path" }
|
||||
},
|
||||
Enumerable.Empty<IIndexField>(),
|
||||
//new[]
|
||||
// {
|
||||
// new TestIndexField { Name = "headerText" },
|
||||
// new TestIndexField { Name = "bodyText" },
|
||||
// new TestIndexField { Name = "metaDescription" },
|
||||
// new TestIndexField { Name = "metaKeywords" },
|
||||
// new TestIndexField { Name = "bodyTextColOne" },
|
||||
// new TestIndexField { Name = "bodyTextColTwo" },
|
||||
// new TestIndexField { Name = "xmlStorageTest" }
|
||||
// },
|
||||
Enumerable.Empty<string>(),
|
||||
//new[]
|
||||
// {
|
||||
// "CWS_Home",
|
||||
// "CWS_Textpage",
|
||||
// "CWS_TextpageTwoCol",
|
||||
// "CWS_NewsEventsList",
|
||||
// "CWS_NewsItem",
|
||||
// "CWS_Gallery",
|
||||
// "CWS_EventItem",
|
||||
// "Image",
|
||||
// },
|
||||
new string[] { },
|
||||
new[]
|
||||
{
|
||||
new TestIndexField { Name = "headerText" },
|
||||
new TestIndexField { Name = "bodyText" },
|
||||
new TestIndexField { Name = "metaDescription" },
|
||||
new TestIndexField { Name = "metaKeywords" },
|
||||
new TestIndexField { Name = "bodyTextColOne" },
|
||||
new TestIndexField { Name = "bodyTextColTwo" },
|
||||
new TestIndexField { Name = "xmlStorageTest" }
|
||||
},
|
||||
Enumerable.Empty<string>(),
|
||||
Enumerable.Empty<string>(),
|
||||
-1),
|
||||
d,
|
||||
new TestDataService(),
|
||||
@@ -95,53 +93,12 @@ namespace Umbraco.Tests.TestHelpers.ExamineHelpers
|
||||
{
|
||||
return new UmbracoExamineSearcher(d, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
|
||||
}
|
||||
//public SimpleDataIndexer GetSimpleIndexer(DirectoryInfo d)
|
||||
//{
|
||||
// var i = new SimpleDataIndexer(new IndexCriteria(
|
||||
// new IIndexField[] { },
|
||||
// new[]
|
||||
// {
|
||||
// new TestIndexField { Name = "Author" },
|
||||
// new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime" },
|
||||
// new TestIndexField { Name = "Title" },
|
||||
// new TestIndexField { Name = "Photographer" },
|
||||
// new TestIndexField { Name = "YearCreated", Type = "Date.Year" },
|
||||
// new TestIndexField { Name = "MonthCreated", Type = "Date.Month" },
|
||||
// new TestIndexField { Name = "DayCreated", Type = "Date.Day" },
|
||||
// new TestIndexField { Name = "HourCreated", Type = "Date.Hour" },
|
||||
// new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" },
|
||||
// new TestIndexField { Name = "SomeNumber", Type = "Number" },
|
||||
// new TestIndexField { Name = "SomeFloat", Type = "Float" },
|
||||
// new TestIndexField { Name = "SomeDouble", Type = "Double" },
|
||||
// new TestIndexField { Name = "SomeLong", Type = "Long" }
|
||||
// },
|
||||
// new string[] { },
|
||||
// new string[] { },
|
||||
// -1),
|
||||
// d,
|
||||
// new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
|
||||
// new TestSimpleDataProvider(),
|
||||
// new[] { "Documents", "Pictures" },
|
||||
// false);
|
||||
// i.IndexingError += IndexingError;
|
||||
|
||||
// return i;
|
||||
//}
|
||||
|
||||
public LuceneSearcher GetLuceneSearcher(DirectoryInfo d)
|
||||
{
|
||||
return new LuceneSearcher(d, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
|
||||
}
|
||||
//public PDFIndexer GetPdfIndexer(DirectoryInfo d)
|
||||
//{
|
||||
// var i = new PDFIndexer(d,
|
||||
// new TestDataService(),
|
||||
// new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
|
||||
// false);
|
||||
|
||||
// i.IndexingError += IndexingError;
|
||||
|
||||
// return i;
|
||||
//}
|
||||
|
||||
public MultiIndexSearcher GetMultiSearcher(DirectoryInfo pdfDir, DirectoryInfo simpleDir, DirectoryInfo conventionDir, DirectoryInfo cwsDir)
|
||||
{
|
||||
var i = new MultiIndexSearcher(new[] { pdfDir, simpleDir, conventionDir, cwsDir }, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
<media>
|
||||
<node id="1111" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="-1" level="1" writerID="0" nodeType="1031" template="0" sortOrder="2" createDate="2010-05-19T15:26:08" updateDate="2010-05-19T15:26:09" nodeName="Product Images" urlName="productimages" writerName="Administrator" nodeTypeAlias="Folder" path="-1,1111">
|
||||
<data alias="contents"></data>
|
||||
<node id="2222" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="1111" level="1" writerID="0" nodeType="1031" template="0" sortOrder="2" createDate="2010-05-19T15:26:08" updateDate="2010-05-19T15:26:09" nodeName="Product Images" urlName="productimages" writerName="Administrator" nodeTypeAlias="Folder" path="-1,1111,2222">
|
||||
<node id="2222" version="902e13f7-5793-482a-9e06-cd94eebd1de0" parentID="1111" level="2" writerID="0" nodeType="1031" template="0" sortOrder="2" createDate="2010-05-19T15:26:08" updateDate="2010-05-19T15:26:09" nodeName="Product Images" urlName="productimages" writerName="Administrator" nodeTypeAlias="Folder" path="-1,1111,2222">
|
||||
<data alias="contents"></data>
|
||||
<node id="2112" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="2222" level="2" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Sam's Umbraco Image" urlName="acnestressscrub" writerName="Administrator" nodeTypeAlias="Image" path="-1,1111,2222,2112">
|
||||
<node id="2112" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="2222" level="3" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Sam's Umbraco Image" urlName="acnestressscrub" writerName="Administrator" nodeTypeAlias="Image" path="-1,1111,2222,2112">
|
||||
<data alias="umbracoFile"><![CDATA[/media/1234/blah.pdf]]></data>
|
||||
<data alias="umbracoWidth">115</data>
|
||||
<data alias="umbracoHeight">268</data>
|
||||
<data alias="umbracoBytes">10726</data>
|
||||
<data alias="umbracoExtension">jpg</data>
|
||||
<node id="3113" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd33" parentID="2112" level="3" writerID="0" nodeType="1032" template="0" sortOrder="2" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Another Umbraco Image" urlName="acnestressscrub" writerName="Administrator" nodeTypeAlias="Image" path="-1,1111,2222,2112,3113">
|
||||
<node id="3113" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd33" parentID="2112" level="4" writerID="0" nodeType="1032" template="0" sortOrder="2" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Another Umbraco Image" urlName="acnestressscrub" writerName="Administrator" nodeTypeAlias="Image" path="-1,1111,2222,2112,3113">
|
||||
<data alias="umbracoFile"><![CDATA[/media/1234/blah.pdf]]></data>
|
||||
<data alias="umbracoWidth">115</data>
|
||||
<data alias="umbracoHeight">268</data>
|
||||
@@ -26,21 +26,21 @@
|
||||
<data alias="umbracoBytes">10726</data>
|
||||
<data alias="umbracoExtension">jpg</data>
|
||||
</node>
|
||||
<node id="1114" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="String thoery" urlName="stringtheory" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1114">
|
||||
<node id="1114" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="3" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="String thoery" urlName="stringtheory" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1114">
|
||||
<data alias="umbracoFile"><![CDATA[/App_Data/StringTheory.pdf]]></data>
|
||||
<data alias="umbracoWidth">115</data>
|
||||
<data alias="umbracoHeight">268</data>
|
||||
<data alias="umbracoBytes">10726</data>
|
||||
<data alias="umbracoExtension">jpg</data>
|
||||
</node>
|
||||
<node id="1115" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Umbraco Contour" urlName="umbracocontour" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1115">
|
||||
<node id="1115" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="5" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="Umbraco Contour" urlName="umbracocontour" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1115">
|
||||
<data alias="umbracoFile"><![CDATA[/App_Data/UmbracoContour.pdf]]></data>
|
||||
<data alias="umbracoWidth">115</data>
|
||||
<data alias="umbracoHeight">268</data>
|
||||
<data alias="umbracoBytes">10726</data>
|
||||
<data alias="umbracoExtension">jpg</data>
|
||||
</node>
|
||||
<node id="1116" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="PDF Standards" urlName="pdfstandards" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1116">
|
||||
<node id="1116" version="5b3e46ab-3e37-4cfa-ab70-014234b5bd39" parentID="1111" level="2" writerID="0" nodeType="1032" template="0" sortOrder="4" createDate="2010-05-19T17:32:46" updateDate="2010-05-19T17:32:46" nodeName="PDF Standards" urlName="pdfstandards" writerName="Administrator" nodeTypeAlias="File" path="-1,1111,1116">
|
||||
<data alias="umbracoFile"><![CDATA[/App_Data/PDFStandards.pdf]]></data>
|
||||
<data alias="umbracoWidth">115</data>
|
||||
<data alias="umbracoHeight">268</data>
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
class SettingsForTests
|
||||
{
|
||||
// umbracoSettings
|
||||
|
||||
public static bool UseLegacyXmlSchema
|
||||
{
|
||||
get { return UmbracoSettings.UseLegacyXmlSchema; }
|
||||
set { UmbracoSettings.UseLegacyXmlSchema = value; }
|
||||
}
|
||||
|
||||
public static bool AddTrailingSlash
|
||||
{
|
||||
get { return UmbracoSettings.AddTrailingSlash; }
|
||||
set { UmbracoSettings.AddTrailingSlash = value; }
|
||||
}
|
||||
|
||||
public static bool UseDomainPrefixes
|
||||
{
|
||||
get { return UmbracoSettings.UseDomainPrefixes; }
|
||||
set { UmbracoSettings.UseDomainPrefixes = value; }
|
||||
}
|
||||
|
||||
public static string SettingsFilePath
|
||||
{
|
||||
get { return UmbracoSettings.SettingsFilePath; }
|
||||
set { UmbracoSettings.SettingsFilePath = value; }
|
||||
}
|
||||
|
||||
// from appSettings
|
||||
|
||||
private static readonly IDictionary<string, string> SavedAppSettings = new Dictionary<string, string>();
|
||||
|
||||
static void SaveSetting(string key)
|
||||
{
|
||||
SavedAppSettings[key] = ConfigurationManager.AppSettings[key];
|
||||
}
|
||||
|
||||
static void SaveSettings()
|
||||
{
|
||||
SaveSetting("umbracoHideTopLevelNodeFromPath");
|
||||
SaveSetting("umbracoUseDirectoryUrls");
|
||||
SaveSetting("umbracoPath");
|
||||
SaveSetting("umbracoReservedPaths");
|
||||
SaveSetting("umbracoReservedUrls");
|
||||
SaveSetting("umbracoConfigurationStatus");
|
||||
}
|
||||
|
||||
public static bool HideTopLevelNodeFromPath
|
||||
{
|
||||
get { return GlobalSettings.HideTopLevelNodeFromPath; }
|
||||
set { ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", value ? "true" : "false"); }
|
||||
}
|
||||
|
||||
public static bool UseDirectoryUrls
|
||||
{
|
||||
get { return GlobalSettings.UseDirectoryUrls; }
|
||||
set { ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", value ? "true" : "false"); }
|
||||
}
|
||||
|
||||
public static string UmbracoPath
|
||||
{
|
||||
get { return GlobalSettings.Path; }
|
||||
set { ConfigurationManager.AppSettings.Set("umbracoPath", value); }
|
||||
}
|
||||
|
||||
public static string ReservedPaths
|
||||
{
|
||||
get { return GlobalSettings.ReservedPaths; }
|
||||
set { GlobalSettings.ReservedPaths = value; }
|
||||
}
|
||||
|
||||
public static string ReservedUrls
|
||||
{
|
||||
get { return GlobalSettings.ReservedUrls; }
|
||||
set { GlobalSettings.ReservedUrls = value; }
|
||||
}
|
||||
|
||||
public static string ConfigurationStatus
|
||||
{
|
||||
get { return GlobalSettings.ConfigurationStatus; }
|
||||
set { ConfigurationManager.AppSettings.Set("umbracoConfigurationStatus", value); }
|
||||
}
|
||||
|
||||
// reset & defaults
|
||||
|
||||
static SettingsForTests()
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
UmbracoSettings.ResetSetters();
|
||||
GlobalSettings.ResetCache();
|
||||
foreach (var kvp in SavedAppSettings)
|
||||
ConfigurationManager.AppSettings.Set(kvp.Key, kvp.Value);
|
||||
|
||||
// set some defaults that are wrong in the config file?!
|
||||
// this is annoying, really
|
||||
HideTopLevelNodeFromPath = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@
|
||||
<AssemblyName>Umbraco.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -31,16 +33,22 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Examine, Version=0.1.42.2941, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="Examine, Version=0.1.48.2941, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Examine.0.1.48.2941\lib\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Umbraco.Web.UI\bin\Lucene.Net.dll</HintPath>
|
||||
<Reference Include="Lucene.Net">
|
||||
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
|
||||
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Rhino.Mocks">
|
||||
<HintPath>..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll</HintPath>
|
||||
@@ -55,16 +63,17 @@
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UmbracoExamine, Version=0.1.42.2941, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Umbraco.Web.UI\bin\UmbracoExamine.dll</HintPath>
|
||||
<Reference Include="UmbracoExamine">
|
||||
<HintPath>..\packages\UmbracoExamine.0.1.42.2941\lib\UmbracoExamine.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BusinessLogic\DictionaryTest.cs" />
|
||||
<Compile Include="ContentStores\PublishMediaStoreTests.cs" />
|
||||
<Compile Include="PublishedContent\DynamicXmlTests.cs" />
|
||||
<Compile Include="PublishedContent\LegacyExamineBackedMediaTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentDataTableTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentTestBase.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedMediaTests.cs" />
|
||||
<Compile Include="PublishedContent\StronglyTypedQueryTests.cs" />
|
||||
@@ -86,6 +95,7 @@
|
||||
<Compile Include="ObjectExtensionsTests.cs" />
|
||||
<Compile Include="ContentStores\PublishContentStoreTests.cs" />
|
||||
<Compile Include="DataTypeFactoryTests.cs" />
|
||||
<Compile Include="Resolvers\LazyManyObjectResolverTests.cs" />
|
||||
<Compile Include="Routing\LookupByNiceUrlWithDomainsTests.cs" />
|
||||
<Compile Include="Routing\NiceUrlsProviderWithDomainsTests.cs" />
|
||||
<Compile Include="Routing\uQueryGetNodeIdByUrlTests.cs" />
|
||||
@@ -93,6 +103,7 @@
|
||||
<Compile Include="Surface\PluginControllerAreaTests.cs" />
|
||||
<Compile Include="Templates\MasterPageHelperTests.cs" />
|
||||
<Compile Include="TestHelpers\BaseRoutingTest.cs" />
|
||||
<Compile Include="TestHelpers\SettingsForTests.cs" />
|
||||
<Compile Include="GlobalSettingsTests.cs" />
|
||||
<Compile Include="Routing\LookupByAliasTests.cs" />
|
||||
<Compile Include="Routing\LookupByIdTests.cs" />
|
||||
@@ -208,6 +219,7 @@
|
||||
<PostBuildEvent>xcopy "$(ProjectDir)"..\..\lib\SQLCE4\amd64\*.* "$(TargetDir)amd64\" /Y /F /E /D
|
||||
xcopy "$(ProjectDir)"..\..\lib\SQLCE4\x86\*.* "$(TargetDir)x86\" /Y /F /E /D</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Examine" version="0.1.48.2941" targetFramework="net40" />
|
||||
<package id="log4net" version="2.0.0" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.0.12054" targetFramework="net40" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net40" />
|
||||
<package id="NUnit" version="2.6.2" targetFramework="net40" />
|
||||
<package id="RhinoMocks" version="3.6.1" targetFramework="net40" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
|
||||
<package id="UmbracoExamine" version="0.1.42.2941" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -5,6 +5,18 @@
|
||||
<appender-ref ref="ConsoleAppender" />
|
||||
</root>
|
||||
|
||||
<logger name="Umbraco.Core.PluginManager">
|
||||
<level value="WARN" />
|
||||
</logger>
|
||||
|
||||
<logger name="Umbraco.Core.Persistence.Database">
|
||||
<level value="WARN" />
|
||||
</logger>
|
||||
|
||||
<logger name="Umbraco.Core.Persistence.Migrations.Initial.BaseDataCreation">
|
||||
<level value="WARN" />
|
||||
</logger>
|
||||
|
||||
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
|
||||
<target value="Console.Out" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
@@ -101,24 +103,24 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\CookComputing.XmlRpcV2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Examine, Version=0.9.0.0, Culture=en-AU, processorArchitecture=MSIL">
|
||||
<Reference Include="Examine, Version=0.1.48.2941, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\Examine.dll</HintPath>
|
||||
<HintPath>..\packages\Examine.0.1.48.2941\lib\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HtmlAgilityPack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\HtmlAgilityPack.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.83.1.0, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\Lucene.Net.dll</HintPath>
|
||||
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Helpers">
|
||||
<HintPath>..\..\lib\WebPages\Microsoft.Web.Helpers.dll</HintPath>
|
||||
@@ -128,13 +130,13 @@
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Our.Umbraco.uGoLive">
|
||||
<HintPath>..\..\lib\Our.Umbraco.uGoLive.dll</HintPath>
|
||||
<HintPath>..\packages\uGoLive.1.4.0\lib\Our.Umbraco.uGoLive.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Our.Umbraco.uGoLive.47x">
|
||||
<HintPath>..\..\lib\Our.Umbraco.uGoLive.47x.dll</HintPath>
|
||||
<HintPath>..\packages\uGoLive.1.4.0\lib\Our.Umbraco.uGoLive.47x.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Our.Umbraco.uGoLive.Checks">
|
||||
<HintPath>..\..\lib\Our.Umbraco.uGoLive.Checks.dll</HintPath>
|
||||
<HintPath>..\packages\uGoLive.1.4.0\lib\Our.Umbraco.uGoLive.Checks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
@@ -256,7 +258,7 @@
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">
|
||||
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
|
||||
<Name>umbraco.presentation</Name>
|
||||
<Name>Umbraco.Web</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\umbraco.providers\umbraco.providers.csproj">
|
||||
<Project>{D7636876-0756-43CB-A192-138C6F0D5E42}</Project>
|
||||
@@ -288,6 +290,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Umbraco\developer\Macros\EditMacro.aspx.cs">
|
||||
<DependentUpon>editMacro.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\developer\Macros\EditMacro.aspx.designer.cs">
|
||||
@@ -414,6 +417,7 @@
|
||||
<DependentUpon>UI.xml</DependentUpon>
|
||||
</None>
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Umbraco\config\lang\en_us.xml" />
|
||||
<Content Include="Umbraco\config\lang\he.xml" />
|
||||
<Content Include="Umbraco\config\lang\ja.xml" />
|
||||
<Content Include="Umbraco\config\lang\pl.xml" />
|
||||
@@ -653,6 +657,7 @@
|
||||
<Content Include="umbraco_client\tinymce3\langs\da.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\de.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\en.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\en_us.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\fi.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\fr.js" />
|
||||
<Content Include="umbraco_client\tinymce3\langs\he.js" />
|
||||
@@ -984,6 +989,10 @@
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\js\dialog.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\en.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\en_us.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\it.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\it_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\ru.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\ru_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracocss\langs\zh.js" />
|
||||
@@ -994,8 +1003,14 @@
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\img\ajax-loader.gif" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\img\embed.gif" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\js\dialog.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\de.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\de_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\en.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\en_us.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\it.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\it_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\ru.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\ru_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoembed\langs\zh.js" />
|
||||
@@ -1003,6 +1018,7 @@
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\editor_plugin_src.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\js\image.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\langs\he_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\langs\ja_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracoimg\langs\ru_dlg.js" />
|
||||
@@ -1010,6 +1026,7 @@
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\editor_plugin_src.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\js\umbracolink.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\langs\he_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\langs\ja_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracolink\langs\ru_dlg.js" />
|
||||
@@ -1020,6 +1037,8 @@
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\js\dialog.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\en.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\en_us.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\he.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\he_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\plugins\umbracomacro\langs\ja.js" />
|
||||
@@ -1187,6 +1206,8 @@
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\de_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\en.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\en_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\en_us.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\en_us_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\es.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\es_dlg.js" />
|
||||
<Content Include="umbraco_client\tinymce3\themes\umbraco\langs\fr.js" />
|
||||
@@ -1787,6 +1808,23 @@
|
||||
<DependentUpon>applications.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\EmptyTemplate.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Gallery.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListAncestorsFromCurrentPage.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesFromChangeableSource.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesFromCurrentPage.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesOrderedByDate.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesOrderedByName.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesOrderedByProperty.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListChildPagesWithDoctype.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListDescendantsFromCurrentPage.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListImagesFromMediaFolder.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\MultinodeTree-picker.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\TwitterFeed.cshtml" />
|
||||
<None Include="umbraco_client\CodeMirror\js\mode\coffeescript\LICENSE" />
|
||||
<None Include="umbraco_client\CodeMirror\js\mode\pascal\LICENSE" />
|
||||
<None Include="umbraco_client\CodeMirror\js\mode\perl\LICENSE" />
|
||||
@@ -1810,14 +1848,8 @@
|
||||
<Content Include="Umbraco\masterpages\umbracoDialog.Master" />
|
||||
<Content Include="Umbraco\Search\QuickSearchHandler.ashx" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Breadcrumb.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\ListSubPagesByDateAndLimit.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Macro-Parameters.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Media.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Navigation.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\Paging.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\SelectChildrenByDocumentType.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\SiteMap.cshtml" />
|
||||
<Content Include="Umbraco\scripting\templates\cshtml\UsingRelatedLinks.cshtml" />
|
||||
<None Include="Umbraco\scripting\templates\py\SubpagesAsThumnbnails.py" />
|
||||
<None Include="Umbraco\scripting\templates\py\SubpagesFromAChangeableSource.py" />
|
||||
<None Include="Umbraco\scripting\templates\py\SubpagesFromCurrentPage.py" />
|
||||
@@ -2270,10 +2302,6 @@
|
||||
<None Include="web.Template.UMBRACOELISE.Debug.config">
|
||||
<DependentUpon>Web.Template.config</DependentUpon>
|
||||
</None>
|
||||
<None Include="web.Template.UMBRACORATI.Debug.config">
|
||||
<DependentUpon>Web.Template.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="web.Template.ssaolap01.Debug.config">
|
||||
<DependentUpon>Web.Template.config</DependentUpon>
|
||||
</None>
|
||||
@@ -2378,4 +2406,5 @@ xcopy "$(ProjectDir)"..\..\lib\SQLCE4\x86\*.* "$(TargetDir)x86\" /Y /F /E /D</Po
|
||||
<PropertyGroup>
|
||||
<!--<PostBuildEvent>xcopy "$(ProjectDir)..\..\lib\*.dll" "$(TargetDir)*.dll" /Y</PostBuildEvent>-->
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
</Project>
|
||||
@@ -8,20 +8,7 @@ More information and documentation can be found on CodePlex: http://umbracoexami
|
||||
-->
|
||||
<ExamineLuceneIndexSets>
|
||||
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
|
||||
<IndexAttributeFields>
|
||||
<add Name="id" />
|
||||
<add Name="nodeName" />
|
||||
<add Name="updateDate" />
|
||||
<add Name="writerName" />
|
||||
<add Name="path" />
|
||||
<add Name="nodeTypeAlias" />
|
||||
<add Name="parentID" />
|
||||
</IndexAttributeFields>
|
||||
<IndexUserFields />
|
||||
<IncludeNodeTypes/>
|
||||
<ExcludeNodeTypes />
|
||||
</IndexSet>
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/"/>
|
||||
|
||||
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
|
||||
@@ -34,9 +21,6 @@ More information and documentation can be found on CodePlex: http://umbracoexami
|
||||
<add Name="email" />
|
||||
<add Name="nodeTypeAlias" />
|
||||
</IndexAttributeFields>
|
||||
<IndexUserFields/>
|
||||
<IncludeNodeTypes/>
|
||||
<ExcludeNodeTypes />
|
||||
</IndexSet>
|
||||
|
||||
<!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
|
||||
|
||||
@@ -7,36 +7,19 @@ Index/Search providers can be defined in the UmbracoSettings.config
|
||||
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
|
||||
-->
|
||||
<ExamineLuceneIndexSets>
|
||||
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
|
||||
<IndexAttributeFields>
|
||||
<add Name="id" />
|
||||
<add Name="nodeName" />
|
||||
<add Name="updateDate" />
|
||||
<add Name="writerName" />
|
||||
<add Name="path" />
|
||||
<add Name="nodeTypeAlias" />
|
||||
<add Name="parentID" />
|
||||
</IndexAttributeFields>
|
||||
<IndexUserFields />
|
||||
<IncludeNodeTypes/>
|
||||
<ExcludeNodeTypes />
|
||||
</IndexSet>
|
||||
|
||||
|
||||
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
|
||||
<IndexAttributeFields>
|
||||
<add Name="id" />
|
||||
<add Name="nodeName"/>
|
||||
<add Name="updateDate" />
|
||||
<add Name="writerName" />
|
||||
<add Name="loginName" />
|
||||
<add Name="email" />
|
||||
<add Name="nodeTypeAlias" />
|
||||
</IndexAttributeFields>
|
||||
<IndexUserFields/>
|
||||
<IncludeNodeTypes/>
|
||||
<ExcludeNodeTypes />
|
||||
</IndexSet>
|
||||
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
|
||||
|
||||
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
|
||||
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
|
||||
<IndexAttributeFields>
|
||||
<add Name="id" />
|
||||
<add Name="nodeName"/>
|
||||
<add Name="updateDate" />
|
||||
<add Name="writerName" />
|
||||
<add Name="loginName" />
|
||||
<add Name="email" />
|
||||
<add Name="nodeTypeAlias" />
|
||||
</IndexAttributeFields>
|
||||
</IndexSet>
|
||||
</ExamineLuceneIndexSets>
|
||||
@@ -2,19 +2,19 @@
|
||||
<!-- this is the pre-4.10 rest configuration -->
|
||||
<!-- you should use BaseRestExtensions.config instead -->
|
||||
<RestExtensions>
|
||||
<!-- available for backward compatibility only -->
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracobase.library.member" alias="currentMember">
|
||||
<permission method="login" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="id" allowAll="true" />
|
||||
<permission method="data" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="setProperty" allowAll="false" />
|
||||
</ext>
|
||||
<!-- here for backward compatibility only -->
|
||||
<!-- because really, it should not be enabled by default -->
|
||||
<ext assembly="Runway.Blog" type="Runway.Blog.Library.Base" alias="umbBlog">
|
||||
<permission method="CreateComment" returnXml="false" allowAll="true" />
|
||||
<permission method="GetGravatarImage" returnXml="false" allowAll="true" />
|
||||
</ext>
|
||||
<!-- available for backward compatibility only -->
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracobase.library.member" alias="currentMember">
|
||||
<permission method="login" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="id" allowAll="true" />
|
||||
<permission method="data" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="setProperty" allowAll="false" />
|
||||
</ext>
|
||||
<!-- here for backward compatibility only -->
|
||||
<!-- because really, it should not be enabled by default -->
|
||||
<ext assembly="Runway.Blog" type="Runway.Blog.Library.Base" alias="umbBlog">
|
||||
<permission method="CreateComment" returnXml="false" allowAll="true" />
|
||||
<permission method="GetGravatarImage" returnXml="false" allowAll="true" />
|
||||
</ext>
|
||||
</RestExtensions>
|
||||
@@ -1,15 +1,22 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
|
||||
|
||||
<%
|
||||
// NH: Adds this inline check to avoid a simple codebehind file in the legacy project!
|
||||
if (!umbraco.cms.helpers.url.ValidateProxyUrl(Request["url"], Request.Url.AbsoluteUri))
|
||||
{
|
||||
throw new ArgumentException("Can't redirect to the requested url - it's not local or an approved proxy url", "url");
|
||||
}
|
||||
%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>The website is restarting</title>
|
||||
<META HTTP-EQUIV=REFRESH CONTENT="10; URL=<%=Request["url"] %>">
|
||||
<meta http-equiv="REFRESH" content="10; URL=<%=Request["url"] %>">
|
||||
</head>
|
||||
<body>
|
||||
<h1>The website is restarting</h1>
|
||||
<p>Please wait for 10s while we prepare to serve the page you have requested...</p>
|
||||
|
||||
|
||||
<p style="border-top: 1px solid #ccc; padding-top: 10px;">
|
||||
<small>You can modify the design of this page by editing /config/splashes/booting.aspx</small>
|
||||
</p>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- what file extension that should cause umbraco to create thumbnails -->
|
||||
<imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif</imageFileTypes>
|
||||
<!-- what attributes that are allowed in the editor on an img tag -->
|
||||
<allowedAttributes>alt,border,class,style,align,id,name,onclick,usemap</allowedAttributes>
|
||||
<allowedAttributes>src,alt,border,class,style,align,id,name,onclick,usemap</allowedAttributes>
|
||||
<!-- automatically updates dimension, filesize and extension attributes on upload -->
|
||||
<autoFillImageProperties>
|
||||
<uploadField alias="umbracoFile">
|
||||
@@ -236,4 +236,17 @@
|
||||
<!--<link application="content" applicationUrl="dashboard.aspx" language="en" userType="Administrators" helpUrl="http://www.xyz.no?{0}/{1}/{2}/{3}" /> -->
|
||||
</help>
|
||||
|
||||
<!--
|
||||
web.routing
|
||||
@trySkipIisCustomErrors
|
||||
Tries to skip IIS custom errors.
|
||||
Starting with IIS 7.5, this must be set to true for Umbraco 404 pages to show. Else, IIS will take
|
||||
over and render its build-in error page. See MS doc for HttpResponseBase.TrySkipIisCustomErrors.
|
||||
The default value is false, for backward compatibility reasons, which means that IIS _will_ take
|
||||
over, and _prevent_ Umbraco 404 pages to show.
|
||||
-->
|
||||
<web.routing
|
||||
trySkipIisCustomErrors="false">
|
||||
</web.routing>
|
||||
|
||||
</settings>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- what file extension that should cause umbraco to create thumbnails -->
|
||||
<imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif</imageFileTypes>
|
||||
<!-- what attributes that are allowed in the editor on an img tag -->
|
||||
<allowedAttributes>alt,border,class,style,align,id,name,onclick,usemap</allowedAttributes>
|
||||
<allowedAttributes>src,alt,border,class,style,align,id,name,onclick,usemap</allowedAttributes>
|
||||
<!-- automatically updates dimension, filesize and extension attributes on upload -->
|
||||
<autoFillImageProperties>
|
||||
<uploadField alias="umbracoFile">
|
||||
@@ -192,4 +192,17 @@
|
||||
<!--<link application="content" applicationUrl="dashboard.aspx" language="en" userType="Administrators" helpUrl="http://www.xyz.no?{0}/{1}/{2}/{3}" /> -->
|
||||
</help>
|
||||
|
||||
<!--
|
||||
web.routing
|
||||
@trySkipIisCustomErrors
|
||||
Tries to skip IIS custom errors.
|
||||
Starting with IIS 7.5, this must be set to true for Umbraco 404 pages to show. Else, IIS will take
|
||||
over and render its build-in error page. See MS doc for HttpResponseBase.TrySkipIisCustomErrors.
|
||||
The default value is false, for backward compatibility reasons, which means that IIS _will_ take
|
||||
over, and _prevent_ Umbraco 404 pages to show.
|
||||
-->
|
||||
<web.routing
|
||||
trySkipIisCustomErrors="false">
|
||||
</web.routing>
|
||||
|
||||
</settings>
|
||||
@@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<!--<package id="ClientDependency" version="1.5.1.0" targetFramework="net40" />
|
||||
<package id="ClientDependency-Mvc" version="1.5.1.0" targetFramework="net40" />-->
|
||||
<package id="Examine" version="0.1.48.2941" targetFramework="net40" />
|
||||
<package id="log4net" version="2.0.0" targetFramework="net40" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="3.0.20105.1" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="1.0.20105.408" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="1.0.20105.408" targetFramework="net40" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
|
||||
<package id="uGoLive" version="1.4.0" targetFramework="net40" />
|
||||
</packages>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user