Compare commits

...

180 Commits

Author SHA1 Message Date
Sebastiaan Janssen c250fa560e Restrict the NuGet .Core dependency to the same version. 2013-02-28 15:08:30 -01:00
Sebastiaan Janssen b017e8690a Fix errors in log caused by no prevalues beind selected. 2013-02-28 09:53:57 -01:00
Shannon Deminick 8a9680e75c updated unit test logic 2013-02-27 23:13:48 +06:00
Shannon Deminick 36c66e676a Fixed unit tests 2013-02-27 22:35:27 +06:00
Sebastiaan Janssen ba530061a0 Merge 2013-02-27 13:53:14 -01:00
Sebastiaan Janssen 89ae3bc143 Add RevertToCleanInstall.bat to 4.11.5 too, it's handy. 2013-02-27 13:51:58 -01:00
Shannon Deminick 3951f59d09 Merge 2013-02-27 20:46:06 +06:00
Shannon Deminick cd8c998ebf Fixes: U4-1788 - ensures internal reserved paths and urls (that cannot be modified) are stored staticly in code,
Also fixes that the _reservedPathsCache and _reservedUrlsCache actually works, before we were doing an
object.ReferenceEquals comparison which would never have worked and it was also not thread safe.
2013-02-27 20:42:11 +06:00
Sebastiaan Janssen 2cb544591b Pull in new translations 2013-02-27 12:43:21 -01:00
Stephan 1b1b5c047c U4-1779 - Web.BaseRest supports rest extensions over multiple classes 2013-02-26 16:52:06 -01:00
Sebastiaan Janssen fa5b9e5689 Typo: U4-512 "Memebertype saved" 2013-02-26 17:29:53 -01:00
Sebastiaan Janssen c26df8da6f U4-591 Access bug in dashboard 2013-02-26 15:48:22 -01:00
Shannon Deminick 1e02d85fca Fixes: #U4-1773 (backport fix from 6.0.1) 2013-02-26 21:35:09 +06:00
Shannon Deminick d1dc2331f8 Merge 2013-02-26 21:15:31 +06:00
Shannon Deminick d503deb8c5 reverted member index config, for pre 6.1 we will still need to manually set the member fields. 2013-02-26 21:07:59 +06:00
Morten Christensen 0859b92aaf Fixes U4-1781 so Saved is called when saving a DataTypeDefinition in the backoffice 2013-02-26 13:59:08 -01:00
Sebastiaan Janssen 695d26434c U4-600 Wrong membersearch.png path in MemberSearch.ascx 2013-02-26 09:48:14 -01:00
Shannon Deminick a19de645e4 Merge 2013-02-26 00:59:06 +06:00
Shannon Deminick de9a27db10 Updates to latest Examine lib (another bug fixed) 2013-02-26 00:45:42 +06:00
Sebastiaan Janssen b6d5b7d603 Fixes U4-1776 SafeAlias culture problem 2013-02-25 13:33:51 -01:00
Sebastiaan Janssen 93d7cf4dc3 Fixes U4-1776 SafeAlias culture problem 2013-02-25 13:28:54 -01:00
Tom Fulton 0c42596dc8 Fixed: U4-1678 Saving a Media should show a SpeechBubble 2013-02-25 08:39:18 -01:00
Sebastiaan Janssen 8cf9c1ba97 Fixes: U4-1769 Dictionary Item with "Illigal" character can not be deleted 2013-02-22 14:15:22 -01:00
Shannon Deminick 7a47d63b48 Fixed remaining tests 2013-02-22 19:55:22 +06:00
Sebastiaan Janssen 4648a8c103 Fixes U4-1746 Duplicate image source (src) when inserting resized image in tiny
mce (richtext editor)
2013-02-22 11:41:01 -01:00
Sebastiaan Janssen 87947871d1 Have to add new Examine version to Web.UI as well, else the build output from
build.bat file will not be able to find it.
2013-02-22 09:57:58 -01:00
Sebastiaan Janssen 87fee572ff Enable nuget package restore for teamcity, upgrade examine dll 2013-02-22 09:47:23 -01:00
Shannon Deminick 89f7a3ec63 Clearly these files shouldn't be deleted :P 2013-02-22 06:23:03 +06:00
Shannon Deminick 7092a9ccbb Reverted the macro engines and web proj's, it would seem as though 4.x on the build server hasn't
been configured for nuget package restor (or something like that)
2013-02-22 06:05:10 +06:00
Shannon Deminick e9ea9b5e1b Updates DynamicNode with some performance enhancements especially around things like HasProperty and GetProperty.
Also when it returned children, it was actually re-iterating over all children (going to the repo to find them even though
they were already resolved).
2013-02-22 05:44:17 +06:00
Shannon Deminick fd1efb29ec Fixes issue when saving settings to web.config, not sure how this error never came up before. Was missing a "\" between the path and "web.config".
Using Path.Combine is much safer than just string.Concat!
2013-02-22 04:45:20 +06:00
Shannon Deminick cf4781153e Fixes: #U4-873, #U4-888 - fixes media sorting in razor + MVC. Updates Nunit libs and Examine lib. Adds unit tests to
support new sorting fixes. Fixes up a few other issues with the legacy ExamineBackedMedia class, it will now handle all data
stored in Examine. Simplifies the Examine internal index sets to include all data.
2013-02-22 04:12:24 +06:00
Shannon Deminick ebed142cd5 Another fix for file sys test 2013-02-21 23:47:16 +06:00
Shannon Deminick d162aba14a Fix for file system test 2013-02-21 23:07:37 +06:00
Shannon Deminick ec075f5807 Merge 2013-02-21 22:38:38 +06:00
Sebastiaan Janssen dca90e6316 Merge 2013-02-21 15:09:20 -01:00
Sebastiaan Janssen df31fafec5 Update en_us umbracoembed file, had the wrong content 2013-02-21 15:06:37 -01:00
Shannon Deminick 828dc64035 Backports fix for FullpathToRoot in GlobalSettings... not sure how some unit tests have been working this whole time.
Changes UseLegacySchema default value to false... was set to true!?
un-ignores LookupByNiceUrl tests and still ensures it doesn't require a database to test by passing in an optional parameter
to LookupByNiceUrl to specify if we want to include domain lookups or not (default is true)
2013-02-21 22:02:56 +06:00
Shannon Deminick 0b74164a8e New base test class for anything relating to published content/media, un-ignores strongly typed tests. 2013-02-21 21:01:00 +06:00
Shannon Deminick 62be1b1267 un-ignores Can_Get_File_Dates in AbstractFileSystemTests... not sure why it was ignored seems to work properly. 2013-02-21 20:42:49 +06:00
Sebastiaan Janssen 85ae7e764f Merge 2013-02-21 08:52:48 -01:00
Sebastiaan Janssen 3daa624627 Fixes U4-1668 4.11.4 NiceUrl property on dynamicnode does not work until a
property has been requested from the dynamic node
2013-02-21 08:52:23 -01:00
Shannon Deminick d8af1aaf7b Changed logging in unit tests to filter out things we don't need to see 2013-02-21 03:13:16 +06:00
Shannon Deminick f2d105d8b9 Fixed #U4-814 and got all possible unit tests that were not working for DynamicNode but were working for
DynamicPublishedContent working. And fixed up the DynamicPublishedContent unit tests as these weren't working at all...
but seemed to say they did on the build server. strange.
2013-02-21 05:44:44 +06:00
Stephan 5b0a8c0668 Tests - fix build broken by back-porting 6.x code 2013-02-20 10:12:41 -01:00
Stephan c3ccf3a609 Tests - cleanup settings handling for more reliable tests 2013-02-19 18:01:52 -01:00
Stephan 60bbede408 U4-1441 - fix, fix and fix! 2013-02-19 17:49:49 -01:00
Stephan 1d0299af89 U4-1611 - bugfix 2013-02-19 13:58:16 -01:00
Shannon Deminick c2d0e255df Fixes: #U4-1537 2013-02-19 20:17:17 +06:00
Shannon Deminick 005d3e7d64 Removes area routing for local surface controllers and BeginUmbracoForm, adds strongly typed Html.Action<T>
method for rendering SurfaceController child actions regardless of area (so you don't have to specify).
All relates to #U4-1727
2013-02-19 06:19:26 +06:00
Shannon Deminick 12f8638223 Fixes: #U4-1727 2013-02-19 06:18:51 +06:00
Shannon Deminick e3f9e8c842 Fixes: #U4-552 2013-02-19 03:42:19 +06:00
Shannon Deminick a475f72d50 Fixes: #U4-1695 2013-02-19 02:25:57 +06:00
Shannon Deminick a559ef9f90 Fixes: #U4-1732 2013-02-19 00:59:21 +06:00
Sebastiaan Janssen be83302b14 Fixes U4-1451 2013-02-18 13:22:12 -01:00
Sebastiaan Janssen 83d7ea9ef1 Ignoring wrong unit test for now 2013-02-18 12:53:15 -01:00
Sebastiaan Janssen 95024442de Copy the umbracoSettings for PublishMediaStoreTests as well 2013-02-18 12:22:53 -01:00
Sebastiaan Janssen 69f54b5f22 Copy the umbracoSettings for LibraryTests as well 2013-02-18 11:57:58 -01:00
Sebastiaan Janssen 3404f95b2e Forgot one trailing slash in previous commit 2013-02-18 11:42:45 -01:00
Sebastiaan Janssen e56738481b Adding trailing slash to failing routing tests.
The issue with these tests might again be because of the UmbracoSettings file, which has the trailing slash setting. But with the settings being reset after teardown the tests were still failing, so made these minor corrections which shoudl correspond to the default setting.
2013-02-18 11:38:07 -01:00
Sebastiaan Janssen cb59dc353b Update version to 4.11.5 2013-02-18 10:31:43 -01:00
Sebastiaan Janssen d1b75eac08 Update wrong config path in unit tests 2013-02-18 10:31:17 -01:00
Sebastiaan Janssen 8fabd4e4ed Merge 2013-02-15 12:05:46 -01:00
Sebastiaan Janssen 564d92bed7 Possible fix for TeamCity 2013-02-15 12:05:25 -01:00
Shannon Deminick 95f103ccc2 Merge 2013-02-15 18:55:50 +06:00
Stephan 0ace2fdae7 U4-1611 - fix xpath special chars escaping issues in published content store 2013-02-14 16:31:45 -01:00
Stephan 5da3541584 U4-1441 - bugfix 2013-02-14 16:27:27 -01:00
Shannon Deminick ef86d2f1f1 Manually applies patch for #U4-1718 2013-02-14 23:26:29 +06:00
Sebastiaan Janssen a10a6d1af8 Need to wrap the login javascript in a placeholder for Concorde 2013-02-14 09:06:15 -01:00
Stephan 6d87174cc1 U4-1441 - improve logging 2013-02-08 07:54:16 -01:00
Stephan 9af9c3fe77 U4-1441 - change trySkipIisCustomError config key 2013-02-08 07:36:35 -01:00
Stephan 9cedf5da4c U4-1441 - make trySkipIisCustomError value a setting 2013-02-08 08:08:36 -01:00
Shannon Deminick 906d675dca Merge 2013-02-07 02:09:32 +06:00
Shannon Deminick f1b3105202 Patch for #U4-1653 - media library cache refresh issue 2013-02-06 20:56:47 +06:00
Shannon Deminick 3ebb213916 Patches installer issue. 2013-02-06 19:18:42 +06:00
Stephan a65ca205de U4-1441 - fix issue with IIS taking over custom errors 2013-02-05 16:29:10 -01:00
Stephan 3e1120612b Update version number 2013-02-04 12:00:58 -01:00
Stephan 8d06d39a62 Create branch for 4.11.5 2013-02-04 11:59:30 -01:00
Stephan da7fea47c6 U4-1441 - refactor (fix) legacy NotFoundHandler support 2013-02-03 14:34:04 -01:00
Shannon Deminick f2442b25f6 Close 4.11.4 branch 2013-02-01 19:25:12 +06:00
Sebastiaan Janssen 300d3ff09b Added tag Release-4.11.4 for changeset e02f5aebb87e 2013-02-01 08:41:26 -01:00
Sebastiaan Janssen e6337b8f14 Properly reference uGoLive MyGet package 2013-02-01 08:38:13 -01:00
Sebastiaan Janssen 2be785ace3 Merge 2013-02-01 08:16:18 -01:00
Sebastiaan Janssen 5e2d991fab Update uGoLive 2013-02-01 08:16:10 -01:00
Morten Christensen 536cb4caf1 Fixes U4-1571 2013-02-01 07:42:51 -01:00
Morten Christensen 27745ea141 Fixes U4-1483 2013-02-01 07:35:48 -01:00
Sebastiaan Janssen 5289c55740 Translation updates 2013-02-01 07:24:21 -01:00
Sebastiaan Janssen 791773fc8a Add some more translations 2013-02-01 07:23:33 -01:00
Shannon Deminick 1da27e6c2b Removes all upgrade script stuff since we've deployed the fix in a package. 2013-02-01 06:42:42 +06:00
Shannon Deminick a909b7904e Fixes uGoLive ascx 2013-02-01 05:29:54 +06:00
Shannon Deminick 1b1abce7da Merge 2013-01-31 04:48:29 +06:00
Shannon Deminick fbc10be381 Reverted logic of Document to be what it used to be... Published and HasPublishedVersion() are the same and will
return the same thing, though we've kept the lazy loading and optimizations.
2013-01-31 04:46:51 +06:00
Shannon Deminick 61f2647b62 missing file 2013-01-31 04:26:47 +06:00
Shannon Deminick a5bea7fc59 Added the ability to automate any c# scripts for an upgrade process. I realize this is superceded already in 6.0
but we need a way to do this in 4.x too especially for this release since we need to run a script to fix some db
issues. I've added a framework using an UpgradeScriptManager and another install step + unit tests for some of the
UpgradeScriptManager methods.
2013-01-31 04:26:37 +06:00
Sebastiaan Janssen b9be5c2561 Also implement optimization in fdfa687e6f41 to v4: no need to try and republish
the child pages if the page you are trying to publish was already published
2013-01-30 15:01:38 -01:00
Shannon Deminick 97556de447 Changed methods created yesterday to internal so we can port to 6+ nicely. 2013-01-30 18:58:42 +06:00
netaddicts d5bde0d8df Makes sure preview is not using cached versions of any macro 2013-01-24 11:00:15 -01:00
Sebastiaan Janssen cc5ca0b5fe Fixing U4-359 Previewing new nested pages doesn't work 2013-01-30 09:21:43 -01:00
Shannon Deminick 0cb9cc6840 just cleaned up some code formatting. 2013-01-30 07:59:15 +06:00
Shannon Deminick d38d7b1ff4 Updates all code calling UnPublishSingleNode & UpdateDocumentCache to pass in the already existing Document object if there is one
instead of the ID... this'll save a another ton of SQL calls.
2013-01-30 07:59:03 +06:00
Shannon Deminick 2d87f933d5 Updates Document's Published property to return true if the document is 100% published (viewable on the front-end)
Reverts Document's HasPublishedVersion() to return true if the document has any published version (may or may not be viewable on the front-end)
Updates the Document's new UpdatePublishedOnDescendants to set both the Published and PathPublished fields.
Reverts some stuff in the editContent to use HasPublishedContent() to set the _documentHasPublishedVersion field.
Reverts the BaseContentTree to use the Published property now that it returns the correct value.
Updates the editContent method to use the UpdateDocumentCache overload accepting an object so there's not another N+1 SQL call made.
2013-01-30 07:57:31 +06:00
Shannon Deminick a734a0cff7 Fixes unit tests for Umbraco_Route_User_Defined_Controller_Action 2013-01-30 05:37:32 +06:00
Shannon Deminick d0ace55d03 Fixes: #U4-1593 - Content tree doesn't check for correct publish state. 2013-01-30 05:04:31 +06:00
Shannon Deminick 3fda0308ac Fixes: #U4-1594 - SQL for SqlOptimizedSingle not correct for published state
Fixes: #U4-1596 - new GetPathPublishedDescendants method on Document for optimizations
Fixes: #U4-1595 - Obsoletes HasPublishedVersion() method and ensures lazy loading of Published property,
as well as ensuring that the backing property is set correctly on first load (optmization)
Fixes: #U4-1597 - PathPublished property should be set in an optimized way and/or lazy loaded if it cannot be
2013-01-30 04:56:28 +06:00
Shannon Deminick d796b2afc1 Fixes: #U4-1170 - template with hyphen or dash 2013-01-29 21:19:16 +06:00
Shannon Deminick f95cfc2ee0 Changes v4.x config transforms 2013-01-29 21:18:17 +06:00
Shannon Deminick c5d1439422 Fixes: #U4-1458 - due to a null check on PublishedContentRequest on UmbracoContext 2013-01-29 08:35:09 +06:00
Shannon Deminick 5e9f4559b6 Fixes: #U4-1536 2013-01-29 07:49:14 +06:00
Shannon Deminick 4bbb0441a6 Merge 2013-01-29 05:50:50 +06:00
Shannon Deminick 4cf1d7d9a4 Fixes: #U4-1577 - HasPublishedVersion checks for trashed 2013-01-29 05:48:18 +06:00
Shannon Deminick a6a3ddca75 Fixes: #U4-1580 - m_SQLOptimizedMany includes the 'trashed' flag which can be used by business logic. 2013-01-29 05:37:14 +06:00
Shannon Deminick 27cfa85d3a Fixes: #U4-1579 - moving a node doesn't update the descendants of that node's level or path. 2013-01-29 04:39:44 +06:00
Shannon Deminick a9e1e7b634 Updating: #U4-1491 - Updated HasPublishedVersion() to ensure it checks for 'newest' 2013-01-29 03:42:58 +06:00
leekelleher 9f5f920c81 MNTP: Corrected a typo in the example XPath (additional apostrophe) 2013-01-28 17:18:20 +00:00
Shannon Deminick f9a0d91299 Fixes: #U4-1527 - Creates a public property on UmbracoHelper to return the currently assigned IPublishedContent of the UmbracoHelper. 2013-01-25 06:04:10 +03:00
Shannon Deminick 82c2560822 Ensures all resolvers are sealed. Changes CacheRefreshersResolver, DataTypesResolver, MacroFieldEditorsResolver, PackageActionsResolver, ActionsResolver
to all be lazy resolvers as they are not needed instantly on app startup (not needed by the front-end) This will
make app startup a lot quicker. Fixes ActionsResolver to not use the PluginManager to resolve the types when it
is instantiating them since these are passed in the ctor. Updates all unit tests to use lazy delegate for these resolvers
and they are all passing.
2013-01-23 18:40:40 +03:00
Shannon Deminick f467b8cb6c Adds more functionality for LazyManyObjectsResolverBase - adding type list delegates for lazy resolution. 2013-01-23 17:39:07 +03:00
Shannon Deminick aea1a03453 Updates ManyObjectsResolverBase to properly check for resolution freezing and fixes a few issues found regarding
inheritance in complex situations like the new LazyManyObjectsResolverBase.
Creates the new LazyManyObjectsResolverBase to lazily resolve types in order to create them. This is for
work item : #U4-1522
Adds unit test to support.
2013-01-23 07:45:00 +03:00
Shannon Deminick 1568e5f19c updated comments. 2013-01-23 01:44:01 +03:00
Shannon Deminick 8dff47db78 Merge 2013-01-23 01:39:45 +03:00
Shannon Deminick 987e48733a Merge 2013-01-23 01:39:25 +03:00
pcw@pcw-PC.shout.local ac5142443a Fixed EncryptWithMachineKey to handle values longer than FormsAuthentication.Encrypt max length limit
http://issues.umbraco.org/issue/U4-1455
2013-01-15 20:40:28 +00:00
pcw@pcw-PC.shout.local 44360d83aa Fixed EncryptWithMachineKey to handle values longer than FormsAuthentication.Encrypt max length limit
http://issues.umbraco.org/issue/U4-1455
2013-01-15 20:20:05 +00:00
pcw@pcw-PC.shout.local 021cb817d4 Fixed EncryptWithMachineKey to handle values longer than FormsAuthentication.Encrypt max length limit
http://issues.umbraco.org/issue/U4-1455
2013-01-15 20:17:12 +00:00
pcw@pcw-PC.shout.local f4f91fba78 Fixed EncryptWithMachineKey to handle values longer than FormsAuthentication.Encrypt max length limit
http://issues.umbraco.org/issue/U4-1455
2013-01-15 20:09:29 +00:00
pcw@pcw-PC.shout.local dec5e8ad6c Fixed EncryptWithMachineKey to handle values longer than FormsAuthentication.Encrypt max length limit
http://issues.umbraco.org/issue/U4-1455
2013-01-15 20:07:07 +00:00
Sebastiaan Janssen a6b2196c10 Make sure the filename gets set correctly if we're building the release locally 2013-01-15 16:18:24 -01:00
Max Rotvel 4321c8d24e Fix part of U4-1355 by making umbracoembed translatable and supply da lang files 2013-01-15 14:33:25 -01:00
NielsHartvig@UMBRACORATI.localdomain 4cff3a3c28 Fixed U4-1439 4.11.2 DataEditorSetting not working for UserControl wrapper. 2013-01-15 13:18:37 -01:00
Shannon Deminick 5458c9a310 Adds Encryption/Decryption string extension methods that work in medium trust, with unit tests. 2013-01-15 01:35:10 +03:00
Shannon Deminick 0045ec353f Apply patch for #U4-1156 - IFileSystem public changes. 2013-01-15 01:27:44 +03:00
Shannon Deminick 716d3e95f1 Imported patches from 6.0 for #U4-1453, #U4-1454 2013-01-15 00:58:11 +03:00
Shannon Deminick beeb28f390 Fixes #U4-1467 2013-01-15 00:23:40 +03:00
Sebastiaan Janssen 080e8816a5 Remove non-existing files from project.. 2013-01-14 17:01:32 -01:00
Sebastiaan Janssen f7eb323bd5 Updated razor templates 2013-01-14 14:04:33 -01:00
Sebastiaan Janssen 0f484fdf49 Improve build so that you can't forget to set the version number, the version in
GlobalSettings.cs will be updated with the version configured in build.bat
2013-01-14 10:55:59 -01:00
Sebastiaan Janssen d779422bf4 U4-1457 Missing File for "English (US)" Language Option 2013-01-14 09:08:23 -01:00
Stephan 11ea698969 U4-1017 - more explicit error message on internal cache errors 2013-01-12 10:40:42 -01:00
Shannon Deminick 0e0e6b5c41 Fixes: #U4-1451 2013-01-13 23:24:02 +03:00
Sebastiaan Janssen 4c218621c6 Fixes: #U4-1405 - Added DynamicXmlConverter's 2013-01-14 08:57:49 -01:00
Sebastiaan Janssen c150a91e50 Update uGoLive & Fixes U4-1447 uGolive result: Unable to find node
/configuration/system.web/compilation/@debug in config file web.config
2013-01-14 08:43:50 -01:00
Sebastiaan Janssen 7be9a0a987 Update version to 4.11.4 2013-01-14 08:42:54 -01:00
Sebastiaan Janssen 50589c0911 Removed tag Release-4.11.3.1 2013-01-12 17:30:08 -01:00
Sebastiaan Janssen e61ae618e8 Added tag Release-4.11.3.1 for changeset e4d0c7e74055 2013-01-12 17:30:05 -01:00
Sebastiaan Janssen 930e6a0989 Forgot some parenthesis .. 2013-01-12 17:29:48 -01:00
Sebastiaan Janssen 7c50b32684 Merge with 4.11.3 2013-01-12 17:06:10 -01:00
Sebastiaan Janssen 0f7daf7ebd Closing branch 4.11.3 2013-01-12 17:05:45 -01:00
Sebastiaan Janssen 12cbc2a9c5 Added tag Release-4.11.3 for changeset baa44b79cf90 2013-01-12 17:04:25 -01:00
Sebastiaan Janssen 959d263619 Update the build files to build more automatically (like v6) 2013-01-12 17:02:52 -01:00
Sebastiaan Janssen 6a1fb52b25 Fixes U4-1442 This must be a bug. 4.11.2.2 can't create Macro. 2013-01-12 14:41:21 -01:00
Sebastiaan Janssen 18cd043421 Open branch for 4.11.3 and updated version number 2013-01-12 14:24:27 -01:00
Sebastiaan Janssen ddb2f82aba Added tag Release-4.11.2.2 for changeset 54cde33b809d 2013-01-11 12:31:27 -01:00
Sebastiaan Janssen 6c99e7951f Forgot to update the version for 4.11.2.1 - oops.. Updating again! 2013-01-11 12:25:23 -01:00
Sebastiaan Janssen e44e745761 Merge with 4.11.2 2013-01-11 09:35:46 -01:00
Sebastiaan Janssen 30c11439e4 Re-closing branch 4.11.2 2013-01-11 09:34:55 -01:00
Sebastiaan Janssen 0883f621f6 Update NuGet and making automation better for the dummy files 2013-01-11 09:24:47 -01:00
Sebastiaan Janssen 2d0784d1e5 Added tag Release-4.11.2.1 for changeset 77db220b89e1 2013-01-11 08:31:58 -01:00
Sebastiaan Janssen af0011f32a Fixes U4-1432 4.11.2 - Tinymce strips 'src' attribute from images 2013-01-11 08:23:31 -01:00
Sebastiaan Janssen ab6c5ac21a Added tag Release-4.11.2 for changeset 73711b806a40 2013-01-10 11:05:52 -01:00
Sebastiaan Janssen 227a38fb98 Removed tag 4.11.2 2013-01-10 11:05:43 -01:00
Sebastiaan Janssen 06f9dee649 Added tag 4.11.2 for changeset 73711b806a40 2013-01-10 11:05:34 -01:00
Sebastiaan Janssen 75680192bb Merge 4.11.2 into default 2013-01-10 11:05:13 -01:00
Sebastiaan Janssen a53efb394f Closing 4.11.2 branch 2013-01-10 10:54:56 -01:00
Stephan 6cb3fcf9ad U4-1411 - fix post-4.9 regression in NotFoundHandler url 2013-01-08 16:41:31 -01:00
Sebastiaan Janssen e5878554bd Fixes U4-1482 Regression - RTE unable to edit hyperlink on image 2013-01-21 14:21:29 -01:00
Sebastiaan Janssen 44c8c4b5b8 Revert 024896ba7bcf as it's a breaking change 2013-01-18 08:47:38 -01:00
Shannon Deminick c0b5525dd7 Removed 'Boot' method from WebBootManager as it was never supposed to be there in the first place.
Removed test code from 'SurfaceController'.
Added comments to IApplicationEventHandler.
2013-01-18 02:31:51 +03:00
Sebastiaan Janssen 36f8a8e1dd Fixed U4-1492 Insert image in RTE gives null reference error 2013-01-17 14:17:04 -01:00
Sebastiaan Janssen 16f73b56ab Weird failing test for getting the date of a file, works only 10% of the time.. 2013-01-17 09:53:47 -01:00
Sebastiaan Janssen 47dc2e6214 Merge 2013-01-17 09:18:12 -01:00
Sebastiaan Janssen c6483f0380 Revert e4bb9041cf54 as it was a breaking change 2013-01-17 09:16:45 -01:00
NielsHartvig@UMBRACORATI.localdomain 168b38b2a3 Update to U4-1485 for 4.11.4 2013-01-17 08:47:42 -01:00
NielsHartvig@UMBRACORATI.localdomain 70ca4ac913 Fixes U4-1485 Booting.aspx has potential Open Redirect flaw 2013-01-17 08:38:09 -01:00
Sebastiaan Janssen 72099192b5 My bad, teamcity wasn't building the test project before running tests :) 2013-01-16 17:01:00 -01:00
Sebastiaan Janssen ea48128869 The nunit console runner is being such a tease, ignoring the [Ignore] attribute 2013-01-16 16:44:50 -01:00
Sebastiaan Janssen f0b22146c8 Ignore tests that have been failing for AGES 2013-01-16 16:31:15 -01:00
Sebastiaan Janssen fe0d94687a Use the original workaround for now 2013-01-16 16:25:54 -01:00
Sebastiaan Janssen 238c3d38e8 Un-ignore .exe files 2013-01-16 15:37:31 -01:00
Sebastiaan Janssen 6af4f1f2c6 Corrected the path for the tools folder 2013-01-16 15:21:43 -01:00
Sebastiaan Janssen e215fb056f Work around for TeamCity NUnit test runner see:
http://umbraco.com/follow-us/blog-archive/2013/1/16/make-teamcity-respect-failing-nunit-tests-and-stop-the-build.aspx
2013-01-16 15:19:45 -01:00
267 changed files with 18654 additions and 15895 deletions
+3 -2
View File
@@ -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
+11
View File
@@ -16,3 +16,14 @@ f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.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
-3
View File
@@ -1,3 +0,0 @@
NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec
NuGet.exe pack NuSpecs\UmbracoCms.nuspec
REM pause
+17 -1
View File
@@ -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
View File
@@ -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 -1
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core</id>
<version>4.11.2</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" />
+5 -2
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms</id>
<version>4.11.2</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.2" />
<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>
+128
View File
@@ -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
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file not shown.
+152
View File
@@ -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>
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -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.2";
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;
}
}
+5 -5
View File
@@ -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());
+1 -1
View File
@@ -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)
+2 -1
View File
@@ -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('&');
}
+78 -78
View File
@@ -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
}
}
}
}
+1 -2
View File
@@ -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;
+2 -3
View File
@@ -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);
+1 -2
View File
@@ -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)
+3 -4
View File
@@ -9,16 +9,15 @@ 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)
@@ -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; }
}
}
}
+2 -2
View File
@@ -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)
{
@@ -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)
+69 -9
View File
@@ -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;
+9
View File
@@ -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">
+312
View File
@@ -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
}
}
+16
View File
@@ -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;
}
}
}
+41
View File
@@ -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";
}
}
+51
View File
@@ -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();
}
}
}
+178
View File
@@ -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]
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Umbraco.Tests
};
DataTypesResolver.Current = new DataTypesResolver(
PluginManager.Current.ResolveDataTypes());
() => PluginManager.Current.ResolveDataTypes());
Resolution.Freeze();
}
+6 -8
View File
@@ -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()
{
+7
View File
@@ -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;
+12
View File
@@ -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()
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")]
+19
View File
@@ -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>
+4 -2
View File
@@ -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;
}
}
}
+21 -9
View File
@@ -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">
+5 -1
View File
@@ -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">
+32 -19
View File
@@ -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>
@@ -655,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" />
@@ -1000,6 +1003,8 @@
<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" />
@@ -1803,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" />
@@ -1826,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" />
@@ -2286,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>
@@ -2394,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-->
+15 -32
View File
@@ -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>
@@ -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>
+4 -2
View File
@@ -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>
@@ -103,6 +103,7 @@
<key alias="nodeName">Page Title</key>
<key alias="otherElements">Properties</key>
<key alias="parentNotPublished">This document is published but is not visible because the parent '%0%' is unpublished</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error)</key>
<key alias="publish">Publish</key>
<key alias="publishStatus">Publication Status</key>
<key alias="releaseDate">Publish at</key>
@@ -203,8 +204,8 @@
<area alias="editdatatype">
<key alias="addPrevalue">Add prevalue</key>
<key alias="dataBaseDatatype">Database datatype</key>
<key alias="guid">Data Editor GUID</key>
<key alias="renderControl">Render control</key>
<key alias="guid">Property editor GUID</key>
<key alias="renderControl">Property editor</key>
<key alias="rteButtons">Buttons</key>
<key alias="rteEnableAdvancedSettings">Enable advanced settings for</key>
<key alias="rteEnableContextMenu">Enable context menu</key>
@@ -734,7 +735,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="sortPleaseWait"><![CDATA[ Please wait. Items are being sorted, this can take a while.<br/> <br/> Do not close this window during sorting]]></key>
</area>
<area alias="speechBubbles">
<key alias="contentPublishedFailedByEvent">Publising was cancelled by a 3rd party add-in</key>
<key alias="contentPublishedFailedByEvent">Publishing was cancelled by a 3rd party add-in</key>
<key alias="contentTypeDublicatePropertyType">Property type already exists</key>
<key alias="contentTypePropertyTypeCreated">Property type created</key>
<key alias="contentTypePropertyTypeCreatedText"><![CDATA[Name: %0% <br /> DataType: %1%]]></key>
@@ -748,13 +749,15 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="cssSavedText">Stylesheet saved without any errors</key>
<key alias="dataTypeSaved">Datatype saved</key>
<key alias="dictionaryItemSaved">Dictionary item saved</key>
<key alias="editContentPublishedFailedByParent">Publising failed because the parent page isn't published</key>
<key alias="editContentPublishedFailedByParent">Publishing failed because the parent page isn't published</key>
<key alias="editContentPublishedHeader">Content published</key>
<key alias="editContentPublishedText">and visible at the website</key>
<key alias="editContentSavedHeader">Content saved</key>
<key alias="editContentSavedText">Remember to publish to make changes visible</key>
<key alias="editContentSendToPublish">Sent For Approval</key>
<key alias="editContentSendToPublishText">Changes have been sent for approval</key>
<key alias="editMediaSaved">Media saved</key>
<key alias="editMediaSavedText"></key>
<key alias="editMemberSaved">Member saved</key>
<key alias="editStylesheetPropertySaved">Stylesheet Property Saved</key>
<key alias="editStylesheetSaved">Stylesheet saved</key>
@@ -963,4 +966,4 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="userTypes">User types</key>
<key alias="writer">Writer</key>
</area>
</language>
</language>
@@ -102,6 +102,7 @@
<key alias="nodeName">Page Title</key>
<key alias="otherElements">Properties</key>
<key alias="parentNotPublished">This document is published but is not visible because the parent '%0%' is unpublished</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error)</key>
<key alias="publish">Publish</key>
<key alias="publishStatus">Publication Status</key>
<key alias="releaseDate">Publish at</key>
@@ -202,8 +203,8 @@
<area alias="editdatatype">
<key alias="addPrevalue">Add prevalue</key>
<key alias="dataBaseDatatype">Database datatype</key>
<key alias="guid">Data Editor GUID</key>
<key alias="renderControl">Render control</key>
<key alias="guid">Property editor GUID</key>
<key alias="renderControl">Property editor</key>
<key alias="rteButtons">Buttons</key>
<key alias="rteEnableAdvancedSettings">Enable advanced settings for</key>
<key alias="rteEnableContextMenu">Enable context menu</key>
@@ -733,7 +734,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="sortPleaseWait"><![CDATA[ Please wait. Items are being sorted, this can take a while.<br/> <br/> Do not close this window during sorting]]></key>
</area>
<area alias="speechBubbles">
<key alias="contentPublishedFailedByEvent">Publising was cancelled by a 3rd party add-in</key>
<key alias="contentPublishedFailedByEvent">Publishing was cancelled by a 3rd party add-in</key>
<key alias="contentTypeDublicatePropertyType">Property type already exists</key>
<key alias="contentTypePropertyTypeCreated">Property type created</key>
<key alias="contentTypePropertyTypeCreatedText"><![CDATA[Name: %0% <br /> DataType: %1%]]></key>
@@ -747,13 +748,15 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="cssSavedText">Stylesheet saved without any errors</key>
<key alias="dataTypeSaved">Datatype saved</key>
<key alias="dictionaryItemSaved">Dictionary item saved</key>
<key alias="editContentPublishedFailedByParent">Publising failed because the parent page isn't published</key>
<key alias="editContentPublishedFailedByParent">Publishing failed because the parent page isn't published</key>
<key alias="editContentPublishedHeader">Content published</key>
<key alias="editContentPublishedText">and visible at the website</key>
<key alias="editContentSavedHeader">Content saved</key>
<key alias="editContentSavedText">Remember to publish to make changes visible</key>
<key alias="editContentSendToPublish">Sent For Approval</key>
<key alias="editContentSendToPublishText">Changes have been sent for approval</key>
<key alias="editMediaSaved">Media saved</key>
<key alias="editMediaSavedText"></key>
<key alias="editMemberSaved">Member saved</key>
<key alias="editStylesheetPropertySaved">Stylesheet Property Saved</key>
<key alias="editStylesheetSaved">Stylesheet saved</key>
@@ -961,4 +964,4 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="userTypes">User types</key>
<key alias="writer">Writer</key>
</area>
</language>
</language>
File diff suppressed because it is too large Load Diff
@@ -659,6 +659,10 @@ Per gestire il tuo sito web, è sufficiente aprire il back office di Umbraco e i
<key alias="fileSavedHeader"><![CDATA[File salvato]]></key>
<key alias="fileSavedText"><![CDATA[File salvato con successo]]></key>
<key alias="languageSaved"><![CDATA[Lingua salvata]]></key>
<key alias="partialViewSavedHeader">Partial view salvata</key>
<key alias="partialViewSavedText">Partial view salvata senza errori!</key>
<key alias="partialViewErrorHeader">Partial view non salvata</key>
<key alias="partialViewErrorText">Errore durante il salvataggio del file.</key>
<key alias="pythonErrorHeader"><![CDATA[Script Python non salvato]]></key>
<key alias="pythonErrorText"><![CDATA[A causa di un errore lo script Python non può essere salvato]]></key>
<key alias="pythonSavedHeader"><![CDATA[Script Python salvato]]></key>
+29 -5
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<language alias="ja" intName="Japanese" localName="日本語" lcid="17" culture="ja-JP">
<creator>
<name>umbraco</name>
@@ -15,8 +15,6 @@
<key alias="disable">無効</key>
<key alias="emptyTrashcan">ごみ箱を空にする</key>
<key alias="exportDocumentType">ドキュメントタイプの書出</key>
<key alias="exportDocumentTypeAsCode">.NETの書き出し</key>
<key alias="exportDocumentTypeAsCode-Full">.NETの書き出し</key>
<key alias="importDocumentType">ドキュメントタイプの読込</key>
<key alias="importPackage">パッケージの読み込み</key>
<key alias="liveEdit">ライブ編集</key>
@@ -25,6 +23,7 @@
<key alias="notify">メール通知</key>
<key alias="protect">一般公開</key>
<key alias="publish">公開</key>
<key alias="unpublish">公開を止める</key>
<key alias="refreshNode">最新の情報に更新</key>
<key alias="republish">サイトのリフレッシュ</key>
<key alias="rights">アクセス権</key>
@@ -38,6 +37,7 @@
</area>
<area alias="assignDomain">
<key alias="addNew">ドメインの割り当て</key>
<key alias="invalidDomain">適当でないホスト名</key>
<key alias="domain">ドメイン</key>
<key alias="domainCreated">ドメイン '%0%' が新たに割り当てられました</key>
<key alias="domainDeleted">ドメイン '%0%' は削除されました</key>
@@ -71,6 +71,7 @@
<key alias="saveAndPublish">保存及び公開</key>
<key alias="saveToPublish">保存して承認に送る</key>
<key alias="showPage">プレビュー</key>
<key alias="showPageDisabled">テンプレートが指定されていないのでプレビューは無効になっています</key>
<key alias="styleChoose">スタイルの選択</key>
<key alias="styleShow">スタイルの表示</key>
<key alias="tableInsert">表の挿入</key>
@@ -90,6 +91,7 @@
<key alias="itemNotPublished">このページは公開されていません</key>
<key alias="lastPublished">公開日時</key>
<key alias="mediatype">メディアタイプ</key>
<key alias="mediaLinks">メディアの項目へのリンク</key>
<key alias="membergroup">メンバーグループ</key>
<key alias="memberrole">役割</key>
<key alias="membertype">メンバータイプ</key>
@@ -324,6 +326,7 @@
<key alias="welcome">ようこそ...</key>
<key alias="width"></key>
<key alias="yes">はい</key>
<key alias="folder">フォルダー</key>
</area>
<area alias="graphicheadline">
<key alias="backgroundcolor">背景色</key>
@@ -482,6 +485,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="notAllowedByContentType">現在のノードは、ドキュメントタイプの設定により選択されたノードの子になることはできません。</key>
<key alias="notAllowedByPath">ノードは、自分のサブページには移動できません</key>
<key alias="notValid">子ドキュメントで権限がないので、その操作はできません。</key>
<key alias="relateToOriginal">コピーしたものを元と関係づける</key>
</area>
<area alias="notifications">
<key alias="editNotifications">%0% への通知を編集</key>
@@ -586,8 +590,13 @@ Runwayをインストールして作られた新しいウェブサイトがど
</area>
<area alias="publish">
<key alias="contentPublishedFailedByEvent"><![CDATA[
サードパーティのエクステンションがキャンセルされたので、%0% は発行できませんでした。
サードパーティのエクステンションがキャンセルされたので、%0% は公開できませんでした。
]]></key>
<key alias="contentPublishedFailedByParent">
<![CDATA[
親ページが公開されていないので、%0% は公開できませんでした。
]]>
</key>
<key alias="includeUnpublished">非公開の子ページも含めます</key>
<key alias="inProgress">公開を進めています - 少々お待ちください...</key>
<key alias="inProgressCounter">%1% ページ中 %0% ページが公開されました...</key>
@@ -648,6 +657,9 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="tab">タブ</key>
<key alias="tabname">タブの名前</key>
<key alias="tabs">タブ</key>
<key alias="contentTypeEnabled">マスターコンテンツタイプが有効</key>
<key alias="contentTypeUses">このコンテンツタイプの使用</key>
<key alias="asAContentMasterType">マスターコンテンツタイプについては、マスターコンテンツタイプからのタブは表示されず、マスターコンテンツタイプでのみ編集することができます。</key>
</area>
<area alias="sort">
<key alias="sortDone">ソートが完了しました。</key>
@@ -682,6 +694,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="editTemplateSaved">テンプレートを保存しました</key>
<key alias="editUserError">ユーザーの保存時にエラーが発生しました (ログを確認してください)</key>
<key alias="editUserSaved">ユーザーを保存しました</key>
<key alias="editUserTypeSaved">ユーザータイプを保存しました</key>
<key alias="fileErrorHeader">ファイルは未保存です</key>
<key alias="fileErrorText">ファイルを保存できません。アクセス権を確認してください。</key>
<key alias="fileSavedHeader">ファイルを保存しました</key>
@@ -700,6 +713,11 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="xsltPermissionErrorText">XSLTを保存できません。アクセス権を確認してください。</key>
<key alias="xsltSavedHeader">XSLTを保存しました</key>
<key alias="xsltSavedText">XSLTにエラーはありません</key>
<key alias="contentUnpublished">コンテンツは公開されていません</key>
<key alias="partialViewSavedHeader">部分ビュー保存しました</key>
<key alias="partialViewSavedText">部分ビューをエラーなしで保存しました!</key>
<key alias="partialViewErrorHeader">部分ビューは保存されていません</key>
<key alias="partialViewErrorText">ファイルを保存するときにエラーが発生しました。</key>
</area>
<area alias="stylesheet">
<key alias="aliasHelp">CSSシンタックスを使用 例: h1, .redHeader, .blueTex</key>
@@ -727,6 +745,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="chooseField">フィールドの選択</key>
<key alias="convertLineBreaks">改行コードの変換</key>
<key alias="convertLineBreaksHelp">改行コードをhtmlタグ &amp;lt;br&amp;gt; に変換する</key>
<key alias="customFields">カスタムフィールド</key>
<key alias="dateOnly">日付のみ表示</key>
<key alias="formatAsDate">日付の形式</key>
<key alias="htmlEncode">HTMLエンコード</key>
@@ -740,6 +759,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="recursive">再帰的</key>
<key alias="removeParagraph">段落タグの消去</key>
<key alias="removeParagraphHelp">段落タグ &amp;lt;P&amp;gt; を消去します</key>
<key alias="standardFields">標準フィールド</key>
<key alias="uppercase">大文字変換</key>
<key alias="urlEncode">URLエンコード</key>
<key alias="urlEncodeHelp">文字列をURLで使用可能な文字列に変換する</key>
@@ -833,6 +853,8 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="administrators">管理者</key>
<key alias="categoryField">フィールドのカテゴリー</key>
<key alias="changePassword">パスワードの変更</key>
<key alias="newPassword">新パスワード</key>
<key alias="confirmNewPassword">新パスワードの確認</key>
<key alias="changePasswordDescription">Umbracoの管理画面にアクセスするためのパスワードを変更するには、以下のフォームに新しいパスワード入力して「パスワードの変更」ボタンをクリックしてください。</key>
<key alias="contentChannel">コンテントチャンネル</key>
<key alias="defaultToLiveEditing">ログオン後ライブ編集にリダイレクト</key>
@@ -851,6 +873,8 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="passwordConfirm">新しいパスワードの確認</key>
<key alias="passwordEnterNew">新しいパスワードの入力</key>
<key alias="passwordIsBlank">パスワードは空白にできません!</key>
<key alias="passwordCurrent">現在のパスワード</key>
<key alias="passwordInvalid">現在のパスワードが正しくない</key>
<key alias="passwordIsDifferent">新しいパスワードと確認のパスワードが一致しません。再度入力してください!</key>
<key alias="passwordMismatch">確認のパスワードは新しいパスワードと一致しません!</key>
<key alias="permissionReplaceChildren">子ノードのアクセス権を置き換える</key>
@@ -864,4 +888,4 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="userTypes">ユーザーの種類</key>
<key alias="writer">投稿者</key>
</area>
</language>
</language>
@@ -187,8 +187,8 @@
<area alias="editdatatype">
<key alias="addPrevalue">Adicionar valor prévio</key>
<key alias="dataBaseDatatype">Tipo de Dados do Banco de Dados</key>
<key alias="guid">GUID do Editor de Dados</key>
<key alias="renderControl">Mostrar controle</key>
<key alias="guid">GUID do Editor de Propriedades</key>
<key alias="renderControl">Editor de Propriedades</key>
<key alias="rteButtons">Botões</key>
<key alias="rteEnableAdvancedSettings">Habilitar configurações avançadas para</key>
<key alias="rteEnableContextMenu">Habilitar menu de contexto</key>
@@ -832,4 +832,4 @@ Para fechar a tarefa de tradução vá até os detalhes e clique no botão "Fech
<key alias="userTypes">Tipos de usuários</key>
<key alias="writer">Escrevente</key>
</area>
</language>
</language>
@@ -32,6 +32,7 @@
<key alias="sort">Сортировать</key>
<key alias="toPublish">Направить на публикацию</key>
<key alias="translate">Перевести</key>
<key alias="unpublish">Скрыть</key>
<key alias="update">Обновить</key>
</area>
<area alias="assignDomain">
@@ -682,6 +683,7 @@
<key alias="contentTypeTabCreated">Вкладка создана</key>
<key alias="contentTypeTabDeleted">Вкладка удалена</key>
<key alias="contentTypeTabDeletedText">Вкладка с идентификатором (id): %0% удалена</key>
<key alias="contentUnpublished">Документ скрыт (публикация отменена)</key>
<key alias="cssErrorHeader">Стиль CSS не сохранен</key>
<key alias="cssSavedHeader">Стиль CSS сохранен</key>
<key alias="cssSavedText">Стиль CSS сохранен без ошибок</key>
@@ -706,6 +708,10 @@
<key alias="fileSavedHeader">Файл сохранен</key>
<key alias="fileSavedText">Файл сохранен без ошибок</key>
<key alias="languageSaved">Язык сохранен</key>
<key alias="partialViewErrorHeader">Представление не сохранено</key>
<key alias="partialViewErrorText">Произошла ошибка при сохранении файла</key>
<key alias="partialViewSavedHeader">Представление сохранено</key>
<key alias="partialViewSavedText">Представление сохранено без ошибок</key>
<key alias="pythonErrorHeader">Cкрипт Python не сохранен</key>
<key alias="pythonErrorText">Cкрипт Python не может быть сохранен в связи с ошибками</key>
<key alias="pythonSavedHeader">Cкрипт Python сохранен</key>
@@ -869,7 +875,7 @@
<key alias="loginname">Имя входа (логин)</key>
<key alias="mediastartnode">Начальный узел в Медиа-библиотеке</key>
<key alias="modules">Разделы</key>
<key alias="newPassword">Сменить пароль</key>
<key alias="newPassword">Новый пароль</key>
<key alias="noConsole">Отключить доступ к административной панели Umbraco</key>
<key alias="password">Пароль</key>
<key alias="passwordChanged">Ваш пароль доступа изменен!</key>
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More