2009-09-07 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Mon, 7 Sep 2009 11:07:43 +0000 (11:07 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Mon, 7 Sep 2009 11:07:43 +0000 (11:07 -0000)
* HostingEnvironment.cs: MapPath checks if HttpContext.Request
actually exists before using it.

2009-09-07  Marek Habersack  <mhabersack@novell.com>

* XmlSiteMapProviderTest.cs: added

* StaticSiteMapProviderTest.cs: added test for FindSiteMapNode

2009-09-07  Marek Habersack  <mhabersack@novell.com>

* XmlSiteMapProvider.cs: do not allow the provider to be
intialized more than once.
Initialize throws if it finds unknown attributes in the
'attributes' collection.
AddNode checks its arguments and throws if they are null or aren't
from the same provider.
FindStartingNode throws exceptions in several erroneous situations
now.
Added private method GetConfigDocument which performs several
checks on the source .sitemap file and throws exceptions if it
finds any errors.
BuildSiteMap clears provider state before building the map.
BuildSiteMapRecursive correctly deals with custom providers. Fixes
bug #465696
FindSiteMapNode maps url before searching. Fixes bug #465696

* VirtualPathUtility.cs: Combine a bit more efficient

* StaticSiteMapProvider.cs: FindSiteMap node checks if rawUrl is
relative to application root and if yes, makes it absolute.
MapUrl converts both rooted and not rooted urls to absolute.

* SiteMapProvider.cs: check if HttpContext.Request exists before
using it in FindSiteMapnode

* SiteMap.cs: Providers collection must be read-only.

2009-09-07  Marek Habersack  <mhabersack@novell.com>

* Makefile (TEST_RESOURCE_FILES): added
Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap
Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap

2009-09-07  Marek Habersack  <mhabersack@novell.com>

* Tests/TestSiteMapProvider.cs: added

svn path=/trunk/mcs/; revision=141420

38 files changed:
mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Makefile
mcs/class/System.Web/System.Web.Hosting/ChangeLog
mcs/class/System.Web/System.Web.Hosting/HostingEnvironment.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/SiteMap.cs
mcs/class/System.Web/System.Web/SiteMapProvider.cs
mcs/class/System.Web/System.Web/StaticSiteMapProvider.cs
mcs/class/System.Web/System.Web/VirtualPathUtility.cs
mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
mcs/class/System.Web/System.Web_test.dll.sources
mcs/class/System.Web/Test/System.Web/ChangeLog
mcs/class/System.Web/Test/System.Web/StaticSiteMapProviderTest.cs
mcs/class/System.Web/Test/System.Web/XmlSiteMapProviderTest.cs [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/ChangeLog
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Global.asax.cs
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config.1.1
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.1.1
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap [new file with mode: 0644]
mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Tests/TestSiteMapProvider.cs [new file with mode: 0644]

index 9a926848170bab41d571cf34633366c663a22e80..257aef094aaba9a6e6edd877e7808341521ae7df 100644 (file)
@@ -1,3 +1,17 @@
+2009-09-07  Marek Habersack  <mhabersack@novell.com>
+
+       * Makefile (TEST_RESOURCE_FILES): added
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap
+
 2009-08-26  Marek Habersack  <mhabersack@novell.com>
 
        * Makefile (TEST_RESOURCE_FILES): added
index 93b8116cbea03cf95ed177dd3c1bd7df1ad224c3..fb2d7f2193b271076c9314187de4333fd0cea9f4 100644 (file)
@@ -83,6 +83,16 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config \
        Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.1.1 \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap \
+       Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap \
        Test/mainsoft/NunitWebResources/menuclass.aspx \
        Test/mainsoft/NunitWebResources/FormView.aspx \
        Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx \
index 078059617409907f0a520d4ee47991b5e906488a..3b97ca27efdb44d13cf2cf74e65d224d81a877fd 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-07  Marek Habersack  <mhabersack@novell.com>
+
+       * HostingEnvironment.cs: MapPath checks if HttpContext.Request
+       actually exists before using it.
+
 2009-08-26  Marek Habersack  <mhabersack@novell.com>
 
        * IApplicationHost.cs: added
index b55a360d4f1f279f9162bd435ee1b864e5173cf4..2d71bdd77bfbe58c8910b08dc45d237da3bc4b4b 100644 (file)
@@ -147,10 +147,11 @@ namespace System.Web.Hosting {
                                throw new ArgumentNullException ("virtualPath");
                        
                        HttpContext context = HttpContext.Current;
-                       if (context == null)
+                       HttpRequest req = context == null ? null : context.Request;
+                       if (req == null)
                                return null;
 
-                       return context.Request.MapPath (virtualPath);
+                       return req.MapPath (virtualPath);
                }
 
                public static void RegisterObject (IRegisteredObject obj)
index 92283d067b3703cbb83dbca4fc81792bf3ec1493..720fb6611a875f8dfc08b38e7e28fa891ceec6aa 100644 (file)
@@ -1,3 +1,32 @@
+2009-09-07  Marek Habersack  <mhabersack@novell.com>
+
+       * XmlSiteMapProvider.cs: do not allow the provider to be
+       intialized more than once.
+       Initialize throws if it finds unknown attributes in the
+       'attributes' collection.
+       AddNode checks its arguments and throws if they are null or aren't
+       from the same provider.
+       FindStartingNode throws exceptions in several erroneous situations
+       now.
+       Added private method GetConfigDocument which performs several
+       checks on the source .sitemap file and throws exceptions if it
+       finds any errors.
+       BuildSiteMap clears provider state before building the map.
+       BuildSiteMapRecursive correctly deals with custom providers. Fixes
+       bug #465696
+       FindSiteMapNode maps url before searching. Fixes bug #465696
+
+       * VirtualPathUtility.cs: Combine a bit more efficient
+
+       * StaticSiteMapProvider.cs: FindSiteMap node checks if rawUrl is
+       relative to application root and if yes, makes it absolute.
+       MapUrl converts both rooted and not rooted urls to absolute.
+
+       * SiteMapProvider.cs: check if HttpContext.Request exists before
+       using it in FindSiteMapnode
+
+       * SiteMap.cs: Providers collection must be read-only.
+
 2009-09-04  Marek Habersack  <mhabersack@novell.com>
 
        * HttpRuntime.cs: retrieve real Mono version from the runtime and
index 6d3b8103abb2ecf20b6b94a3eb29359d140f087d..7d852dccfde181ddaf14073c0f93d10b5b0e6c42 100644 (file)
@@ -49,6 +49,7 @@ namespace System.Web {
                                                throw new InvalidOperationException ("This feature is currently disabled.  Please enable it in the system.web/siteMap section in the web.config file.");
 
                                        providers = section.ProvidersInternal;
+                                       providers.SetReadOnly ();
                                        provider = providers[section.DefaultProvider];
 
                                        if (provider == null)
index b0b41dfe607d5d83188f2ada095539a509954cea..47d1c5d928e8bf9741aae39faad4641b220558f2 100644 (file)
@@ -74,10 +74,14 @@ namespace System.Web {
                {
                        if (context == null)
                                return null;
+
+                       HttpRequest req = context.Request;
+                       if (req == null)
+                               return null;
                        
-                       SiteMapNode ret = this.FindSiteMapNode (context.Request.RawUrl);
+                       SiteMapNode ret = this.FindSiteMapNode (req.RawUrl);
                        if (ret == null)
-                               ret = this.FindSiteMapNode (context.Request.Path);
+                               ret = this.FindSiteMapNode (req.Path);
                        return ret;
                }
 
index c2e763fbd6f49f27383278b9126050b981de0a77..3549dc38357da6590008a84a4cf2b6f2a6df0d06 100644 (file)
@@ -33,6 +33,7 @@
 
 #if NET_2_0
 using System.Collections.Generic;
+using System.Web.Util;
 
 namespace System.Web
 {
@@ -69,7 +70,7 @@ namespace System.Web
                                                        "StaticSiteMapProvider requires that sitemap nodes have unique URLs.",
                                                        node.Url
                                                ));
-                               
+
                                        urlToNode.Add (url, node);
                                }
                                keyToNode.Add (node.Key, node);
@@ -110,7 +111,12 @@ namespace System.Web
                        
                        BuildSiteMap();
                        SiteMapNode node;
-                       urlToNode.TryGetValue (MapUrl (rawUrl), out node);
+                       if (VirtualPathUtility.IsAppRelative (rawUrl))
+                               rawUrl = VirtualPathUtility.ToAbsolute (rawUrl, HttpRuntime.AppDomainAppVirtualPath, false);
+                       
+                       if (!urlToNode.TryGetValue (rawUrl, out node))
+                               return null;
+                       
                        return CheckAccessibility (node);
                }
 
@@ -202,12 +208,17 @@ namespace System.Web
                        return (node != null && IsAccessibleToUser (HttpContext.Current, node)) ? node : null;
                }
 
-               string MapUrl (string url)
+               internal string MapUrl (string url)
                {
+                       if (String.IsNullOrEmpty (url))
+                               return url;
+
+                       string appVPath = HttpRuntime.AppDomainAppVirtualPath;
+
                        if (VirtualPathUtility.IsAppRelative (url))
-                               return VirtualPathUtility.ToAbsolute (url);
+                               return VirtualPathUtility.ToAbsolute (url, appVPath, false);
                        else
-                               return url;
+                               return VirtualPathUtility.ToAbsolute (UrlUtils.Combine (appVPath, url), appVPath, false);
                }
        }
 }
index 01ac43e19c54b81bb51b32b3fdb9e383c14d9615..67ed9e4a52cd79f3ba95a40f6e4095b7de813acb 100644 (file)
@@ -78,13 +78,13 @@ namespace System.Web {
                        if (IsRooted (relativePath))
                                return Normalize (relativePath);
 
-                       if (basePath [basePath.Length - 1] != '/') {
-                               if (basePath.Length > 1) {
+                       int basePathLen = basePath.Length;
+                       if (basePath [basePathLen - 1] != '/') {
+                               if (basePathLen > 1) {
                                        int lastSlash = basePath.LastIndexOf ('/');
                                        if (lastSlash >= 0)
                                                basePath = basePath.Substring (0, lastSlash + 1);
-                               }
-                               else { // "~" only
+                               } else { // "~" only
                                        basePath += "/";
                                }
                        }
index 9c4e5be7f2627c5c96d2c25c69f362211ce454d1..3f00a15f760a193d58f1bb25726e97fde3081ef0 100644 (file)
@@ -4,9 +4,10 @@
 // Authors:
 //     Ben Maurer (bmaurer@users.sourceforge.net)
 //     Lluis Sanchez Gual (lluis@novell.com)
+//     Marek Habersack <mhabersack@novell.com>
 //
 // (C) 2003 Ben Maurer
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2009 Novell, Inc (http://www.novell.com)
 //
 
 //
@@ -39,6 +40,7 @@ using System.Configuration.Provider;
 using System.Globalization;
 using System.Text;
 using System.Xml;
+using System.Web.Hosting;
 using System.Web.Util;
 using System.IO;
 
@@ -49,8 +51,7 @@ namespace System.Web
                static readonly char [] seperators = { ';', ',' };
                static readonly StringComparison stringComparison = HttpRuntime.RunningOnWindows ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
                
-               bool building;
-               string file;
+               bool initialized;
                string fileVirtualPath;
                SiteMapNode root = null;
                List <FileSystemWatcher> watchers;
@@ -77,9 +78,33 @@ namespace System.Web
                
                protected internal override void AddNode (SiteMapNode node, SiteMapNode parentNode)
                {
-                       base.AddNode (node, parentNode);
+                       if (node == null)
+                               throw new ArgumentNullException ("node");
+
+                       if (parentNode == null)
+                               throw new ArgumentNullException ("parentNode");
+
+                       SiteMapProvider nodeProvider = node.Provider;
+                       if (nodeProvider != this)
+                               throw new ArgumentException ("SiteMapNode '" + node + "' cannot be found in current provider, only nodes in the same provider can be added.",
+                                                            "node");
+
+                       SiteMapProvider parentNodeProvider = parentNode.Provider;
+                       if (nodeProvider != parentNodeProvider)
+                               throw new ArgumentException ("SiteMapNode '" + parentNode + "' cannot be found in current provider, only nodes in the same provider can be added.",
+                                                            "parentNode");
+
+                       AddNodeNoCheck (node, parentNode);
                }
 
+               void AddNodeNoCheck (SiteMapNode node, SiteMapNode parentNode)
+               {
+                       base.AddNode (node, parentNode);
+                       SiteMapProvider nodeProvider = node.Provider;
+                       if (nodeProvider != this)
+                               RegisterChildProvider (nodeProvider.Name, nodeProvider);
+               }
+               
                protected virtual void AddProvider (string providerName, SiteMapNode parentNode)
                {
                        if (parentNode == null)
@@ -107,65 +132,195 @@ namespace System.Web
                        ChildProviders.Add (smp);
                }
                
-               XmlNode FindStartingNode (string file, string virtualPath, out bool enableLocalization)
+               XmlNode FindStartingNode (string virtualPath, out bool enableLocalization)
                {
-                       if (String.Compare (Path.GetExtension (file), ".sitemap", stringComparison) != 0)
-                               throw new InvalidOperationException (
-                                       String.Format ("The file {0} has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.",
-                                                      String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
-                       if (!File.Exists (file))
-                               throw new InvalidOperationException (
-                                       String.Format ("The file '{0}' required by XmlSiteMapProvider does not exist.",
-                                                      String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
-                       
-                       XmlDocument d = new XmlDocument ();
-                       d.Load (file);
+                       XmlDocument d = GetConfigDocument (virtualPath);
+                       XmlElement docElement = d.DocumentElement;
 
-                       XmlNode enloc = d.DocumentElement.Attributes ["enableLocalization"];
+                       if (String.Compare ("siteMap", docElement.Name, StringComparison.Ordinal) != 0)
+                               throw new ConfigurationErrorsException ("Top element must be 'siteMap'");
+                       
+                       XmlNode enloc = docElement.Attributes ["enableLocalization"];
                        if (enloc != null && !String.IsNullOrEmpty (enloc.Value))
                                enableLocalization = (bool) Convert.ChangeType (enloc.Value, typeof (bool));
                        else
                                enableLocalization = false;
-                                       
-                       XmlNode nod = d.DocumentElement ["siteMapNode"];
-                       if (nod == null)
-                               throw new HttpException ("Invalid site map file: " + Path.GetFileName (file));
 
-                       return nod;
+                       XmlNodeList childNodes = docElement.ChildNodes;
+                       XmlNode node = null;
+                       
+                       foreach (XmlNode child in childNodes) {
+                               if (String.Compare ("siteMapNode", child.Name, StringComparison.Ordinal) != 0)
+                                       // Only <siteMapNode> is allowed at the top
+                                       throw new ConfigurationErrorsException ("Only <siteMapNode> elements are allowed at the document top level.");
+                               
+                               if (node != null)
+                                       // Only one <siteMapNode> is allowed at the top
+                                       throw new ConfigurationErrorsException ("Only one <siteMapNode> element is allowed at the document top level.");
+                               
+                               node = child;
+                       }
+                       
+                       if (node == null)
+                               throw new ConfigurationErrorsException ("Missing <siteMapNode> element at the document top level.");
+                       
+                       return node;
                }
-               
+
+               XmlDocument GetConfigDocument (string virtualPath)
+               {
+                       if (String.IsNullOrEmpty (virtualPath))
+                               throw new ArgumentException ("The siteMapFile attribute must be specified on the XmlSiteMapProvider");
+                       
+                       string file = HostingEnvironment.MapPath (virtualPath);
+                       if (file == null)
+                               throw new HttpException ("Virtual path '" + virtualPath + "' cannot be mapped to physical path.");
+                       
+                       if (String.Compare (Path.GetExtension (file), ".sitemap", stringComparison) != 0)
+                               throw new InvalidOperationException (String.Format ("The file {0} has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.",
+                                                                                   String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
+                       
+                       if (!File.Exists (file))
+                               throw new InvalidOperationException (String.Format ("The file '{0}' required by XmlSiteMapProvider does not exist.",
+                                                                                   String.IsNullOrEmpty (virtualPath) ? Path.GetFileName (file) : virtualPath));
+
+                       ResourceKey = Path.GetFileName (file);
+                       CreateWatcher (file);
+                       
+                       XmlDocument d = new XmlDocument ();
+                       d.Load (file);
+
+                       return d;
+               }
+
                public override SiteMapNode BuildSiteMap ()
                {
                        if (root != null)
                                return root;
+                       
                        // Whenever you call AddNode, it tries to find dups, and will call this method
                        // Is this a bug in MS??
-                       if (building)
-                               return null;
-                       
                        lock (this_lock) {
-                               try {
-                                       building = true;
-                                       if (root != null)
-                                               return root;
-
-                                       bool enableLocalization;
-                                       XmlNode node = FindStartingNode (file, fileVirtualPath, out enableLocalization);
-                                       EnableLocalization = enableLocalization;
-                                       SiteMapNode builtRoot = BuildSiteMapRecursive (node, EnableLocalization);
-
-                                       if (builtRoot != root) {
-                                               root = builtRoot;
-                                               AddNode (root);
-                                       }
-                               } finally {
-                                       building = false;
+                               if (root != null)
+                                       return root;
+
+                               Clear ();
+                               bool enableLocalization;
+                               XmlNode node = FindStartingNode (fileVirtualPath, out enableLocalization);
+                               EnableLocalization = enableLocalization;
+                               BuildSiteMapRecursive (node, null);
+
+                               // if (builtRoot != root) {
+                               //      root = builtRoot;
+                               //      AddNode (root);
+                               // }
+
+                               return root;
+                       }
+               }
+
+               SiteMapNode ConvertToSiteMapNode (XmlNode xmlNode)
+               {
+                       bool localize = EnableLocalization;
+                       string url = GetOptionalAttribute (xmlNode, "url");
+                       string title = GetOptionalAttribute (xmlNode, "title");
+                       string description = GetOptionalAttribute (xmlNode, "description");
+                       string roles = GetOptionalAttribute (xmlNode, "roles");
+                       string implicitResourceKey = GetOptionalAttribute (xmlNode, "resourceKey");
+                               
+                       // var keywordsList = new List <string> ();
+                       // if (keywords != null && keywords.Length > 0) {
+                       //      foreach (string s in keywords.Split (seperators)) {
+                       //              string ss = s.Trim ();
+                       //              if (ss.Length > 0)
+                       //                      keywordsList.Add (ss);
+                       //      }
+                       // }
+                               
+                       var rolesList = new List <string> ();
+                       if (roles != null && roles.Length > 0) {
+                               foreach (string s in roles.Split (seperators)) {
+                                       string ss = s.Trim ();
+                                       if (ss.Length > 0)
+                                               rolesList.Add (ss);
                                }
+                       }
+
+                       url = base.MapUrl (url);
+
+                       NameValueCollection attributes = null;
+                       NameValueCollection explicitResourceKeys = null;
+                       if (localize)
+                               CollectLocalizationInfo (xmlNode, ref title, ref description, ref attributes, ref explicitResourceKeys);
+                       else
+                               foreach (XmlNode att in xmlNode.Attributes)
+                                       PutInCollection (att.Name, att.Value, ref attributes);
+
+                       string key = Guid.NewGuid ().ToString ();
+                       return new SiteMapNode (this, key, url, title, description, rolesList.AsReadOnly (),
+                                               attributes, explicitResourceKeys, implicitResourceKey);         
+               }
+
+               void BuildSiteMapRecursive (XmlNode xmlNode, SiteMapNode parent)
+               {
+                       if (xmlNode.Name != "siteMapNode")
+                               throw new ConfigurationException ("incorrect element name", xmlNode);
+                       
+                       string attrValue = GetNonEmptyOptionalAttribute (xmlNode, "provider");
+                       if (attrValue != null) {
+                               SiteMapProvider provider = SiteMap.Providers [attrValue];
+                               if (provider == null)
+                                       throw new ProviderException ("Provider with name [" + attrValue + "] was not found.");
+
+                               provider.ParentProvider = this;
+                               SiteMapNode providerRoot = provider.GetRootNodeCore();
+
+                               if (parent == null)
+                                       root = providerRoot;
+                               else
+                                       AddNodeNoCheck (providerRoot, parent);
+                               return;
+                       }
+
+                       attrValue = GetNonEmptyOptionalAttribute (xmlNode, "siteMapFile");
+                       if (attrValue != null) {
+                               var nvc = new NameValueCollection ();
+                               nvc.Add ("siteMapFile", attrValue);
+
+                               string description = GetOptionalAttribute (xmlNode, "description");
+                               if (!String.IsNullOrEmpty (description))
+                                       nvc.Add ("description", description);
+
+                               string name = MapUrl (attrValue);                               
+                               var provider = new XmlSiteMapProvider ();
+                               provider.Initialize (name, nvc);
                                
-                               return root;
+                               SiteMapNode providerRoot = provider.GetRootNodeCore ();
+                               if (parent == null)
+                                       root = providerRoot;
+                               else
+                                       AddNodeNoCheck (providerRoot, parent);
+                               return;
+                       }
+
+                       SiteMapNode curNode = ConvertToSiteMapNode (xmlNode);
+                       if (parent == null)
+                               root = curNode;
+                       else
+                               AddNodeNoCheck (curNode, parent);
+                       
+                       XmlNodeList childNodes = xmlNode.ChildNodes;
+                       if (childNodes == null || childNodes.Count < 1)
+                               return;
+                       
+                       foreach (XmlNode child in childNodes) {
+                               if (child.NodeType != XmlNodeType.Element)
+                                       continue;
+
+                               BuildSiteMapRecursive (child, curNode);
                        }
                }
-               
+
                string GetNonEmptyOptionalAttribute (XmlNode n, string name)
                {
                        return System.Web.Configuration.HandlersUtil.ExtractAttributeValue (name, n, true);
@@ -247,90 +402,6 @@ namespace System.Web
                                PutInCollection (att.Name, value, ref attributes);
                        }
                }
-               
-               SiteMapNode BuildSiteMapRecursive (XmlNode xmlNode, bool localize)
-               {
-                       if (xmlNode.Name != "siteMapNode")
-                               throw new ConfigurationException ("incorrect element name", xmlNode);
-                       
-                       string provider = GetNonEmptyOptionalAttribute (xmlNode, "provider");
-                       string siteMapFile = GetNonEmptyOptionalAttribute (xmlNode, "siteMapFile");
-                       
-                       if (provider != null) {
-                               SiteMapProvider smp = SiteMap.Providers [provider];
-                               if (smp == null)
-                                       throw new ProviderException ("Provider with name [" + provider + "] was not found.");
-
-                               smp.ParentProvider = this;
-                               SiteMapNode root = smp.GetRootNodeCore();
-                               RegisterChildProvider (provider, smp);
-                               
-                               return root;
-                       } else if (siteMapFile != null) {
-                               if (file.Length == 0)
-                                       throw new InvalidOperationException ("The 'siteMapFile' attribute cannot be an empty string.");
-                               string realPath = HttpContext.Current.Request.MapPath (siteMapFile);
-                               bool enableLocalization;
-                               XmlNode node = FindStartingNode (realPath, siteMapFile, out enableLocalization);
-
-                               CreateWatcher (realPath);
-                               return BuildSiteMapRecursive (node, enableLocalization);
-                       } else {
-                               string url = GetOptionalAttribute (xmlNode, "url");
-                               string title = GetOptionalAttribute (xmlNode, "title");
-                               string description = GetOptionalAttribute (xmlNode, "description");
-                               string keywords = GetOptionalAttribute (xmlNode, "keywords");
-                               string roles = GetOptionalAttribute (xmlNode, "roles");
-                               string implicitResourceKey = GetOptionalAttribute (xmlNode, "resourceKey");
-                               
-                               ArrayList keywordsList = new ArrayList ();
-                               if (keywords != null && keywords.Length > 0) {
-                                       foreach (string s in keywords.Split (seperators)) {
-                                               string ss = s.Trim ();
-                                               if (ss.Length > 0)
-                                                       keywordsList.Add (ss);
-                                       }
-                               }
-                               
-                               ArrayList rolesList = new ArrayList ();
-                               if (roles != null && roles.Length > 0) {
-                                       foreach (string s in roles.Split (seperators)) {
-                                               string ss = s.Trim ();
-                                               if (ss.Length > 0)
-                                                       rolesList.Add (ss);
-                                       }
-                               }
-
-                               if (!string.IsNullOrEmpty (url)) {
-                                       if (UrlUtils.IsRelativeUrl (url))
-                                               url = UrlUtils.Combine (HttpRuntime.AppDomainAppVirtualPath, url);
-                               }
-
-                               NameValueCollection attributes = null;
-                               NameValueCollection explicitResourceKeys = null;
-                               if (localize)
-                                       CollectLocalizationInfo (xmlNode, ref title, ref description, ref attributes,
-                                                                ref explicitResourceKeys);
-                               else
-                                       foreach (XmlNode att in xmlNode.Attributes)
-                                               PutInCollection (att.Name, att.Value, ref attributes);
-
-                               string key = Guid.NewGuid ().ToString ();
-                               SiteMapNode node = new SiteMapNode (this, key, url, title, description,
-                                                                   ArrayList.ReadOnly (rolesList),
-                                                                   attributes,
-                                                                   explicitResourceKeys,
-                                                                   implicitResourceKey);
-                                       
-                               foreach (XmlNode child in xmlNode.ChildNodes) {
-                                       if (child.NodeType != XmlNodeType.Element)
-                                               continue;
-                                       AddNode (BuildSiteMapRecursive (child, EnableLocalization), node);
-                               }
-                               
-                               return node;
-                       }
-               }
 
                protected override void Clear ()
                {
@@ -356,12 +427,13 @@ namespace System.Web
                
                public override SiteMapNode FindSiteMapNode (string rawUrl)
                {
-                       SiteMapNode node = base.FindSiteMapNode (rawUrl);
+                       string url = base.MapUrl (rawUrl);
+                       SiteMapNode node = base.FindSiteMapNode (url);
                        if (node != null)
                                return node;
 
                        foreach (SiteMapProvider smp in ChildProviders) {
-                               node = smp.FindSiteMapNode (rawUrl);
+                               node = smp.FindSiteMapNode (url);
                                if (node != null)
                                        return node;
                        }
@@ -386,23 +458,27 @@ namespace System.Web
 
                public override void Initialize (string name, NameValueCollection attributes)
                {
-                       base.Initialize (name, attributes);
-                       fileVirtualPath = attributes ["siteMapFile"];
-                       if (String.IsNullOrEmpty (fileVirtualPath))
-                               throw new ArgumentException ("The siteMapFile attribute must be specified on the XmlSiteMapProvider.");
-
-                       HttpContext ctx = HttpContext.Current;
-                       HttpRequest req = ctx != null ? ctx.Request : null;
-                       
-                       if (req != null)
-                               file = req.MapPath (fileVirtualPath, HttpRuntime.AppDomainAppVirtualPath, false);
-                       else
-                               throw new InvalidOperationException ("Request is missing - cannot map paths.");
-
-                       if (File.Exists (file)) {
-                               ResourceKey = Path.GetFileName (file);
-                               CreateWatcher (file);
+                       if (initialized)
+                               throw new InvalidOperationException ("XmlSiteMapProvider cannot be initialized twice.");
+
+                       initialized = true;
+                       if (attributes != null) {
+                               foreach (string key in attributes.AllKeys) {
+                                       switch (key) {
+                                               case "siteMapFile":
+                                                       fileVirtualPath = attributes ["siteMapFile"];
+                                                       break;
+
+                                               case "description":
+                                                       break;
+
+                                               default:
+                                                       throw new ConfigurationErrorsException ("The attribute '" + key + "' is unexpected in the configuration of the '" + name + "' provider.");
+                                       }
+                               }
                        }
+                       
+                       base.Initialize (name, attributes != null ? attributes : new NameValueCollection ());
                }
 
                void CreateWatcher (string file)
index 332cb0655e41535541e173f40f4c0e32425e1475..b96b69ef0e61c0c0f67faaea9438048f943805ed 100644 (file)
@@ -36,6 +36,7 @@ mainsoft/NunitWeb/NunitWeb/StandardUrl.cs
 mainsoft/NunitWeb/NunitWeb/WebTest.cs
 mainsoft/NunitWeb/NunitWeb/WebTestResourcesSetupAttribute.cs
 mainsoft/NunitWeb/NunitWeb/Tests/TagsNestedInClientTag.cs
+mainsoft/NunitWeb/NunitWeb/Tests/TestSiteMapProvider.cs
 System.Web/AppBrowsersTest.cs
 System.Web/HttpBrowserCapabilitiesTest.cs
 System.Web/HttpCacheVaryByContentEncodingsTest.cs
@@ -518,3 +519,4 @@ System.Web.UI.WebControls/XmlDataSourceCas.cs
 System.Web.Util/TransactionsCas.cs
 System.Web.Util/UrlUtilsTest.cs
 System.Web.Util/WorkItemCas.cs
+System.Web/XmlSiteMapProviderTest.cs
index 1c35caa3c06ae391b9baf53f98ad5508f9cb1ffb..fdf907afe7a4321089742195c258be6a78c225ef 100644 (file)
@@ -1,3 +1,9 @@
+2009-09-07  Marek Habersack  <mhabersack@novell.com>
+
+       * XmlSiteMapProviderTest.cs: added
+
+       * StaticSiteMapProviderTest.cs: added test for FindSiteMapNode
+
 2009-07-13  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * HttpResponseTest.cs: Store data from all calls to
index b7653d145feacfcf52ecc5c7fbb55d4019b8766a..19ed9a98bc0f9eef58fee879b6162031889cc6e9 100644 (file)
@@ -37,6 +37,8 @@ using System.Diagnostics;
 using MonoTests.SystemWeb.Framework;
 using System.Web.UI;
 
+using Tests;
+
 namespace MonoTests.System.Web {
        
        class StaticPoker : StaticSiteMapProvider
@@ -177,6 +179,32 @@ namespace MonoTests.System.Web {
                        Assert.IsTrue (b, "#1");
                }
 
+               [Test]
+               public void FindSiteMapNode_01 ()
+               {
+                       new WebTest (PageInvoker.CreateOnLoad (FindSiteMapNode_01_OnLoad)).Run ();
+               }
+
+               public static void FindSiteMapNode_01_OnLoad (Page p)
+               {
+                       var provider = new TestSiteMapProvider ();
+                       Assert.IsNotNull (provider.RootNode, "#A1");
+                       Assert.AreEqual ("default.aspx", provider.RootNode.Url, "#A1-1");
+
+                       SiteMapNode node = provider.FindSiteMapNode ("default.aspx");
+                       Assert.IsNull (node, "#A2");
+
+                       node = provider.FindSiteMapNode ("/NunitWeb/default.aspx");
+                       Assert.IsNotNull (node, "#A3");
+                       Assert.AreEqual ("default.aspx", node.Url, "#A3-1");
+                       Assert.AreEqual ("Test", node.Title, "#A3-2");
+
+                       node = provider.FindSiteMapNode ("~/default.aspx");
+                       Assert.IsNotNull (node, "#A4");
+                       Assert.AreEqual ("default.aspx", node.Url, "#A4-1");
+                       Assert.AreEqual ("Test", node.Title, "#A4-2");
+               }
+               
                [TestFixtureTearDown]
                public void TearDown ()
                {
diff --git a/mcs/class/System.Web/Test/System.Web/XmlSiteMapProviderTest.cs b/mcs/class/System.Web/Test/System.Web/XmlSiteMapProviderTest.cs
new file mode 100644 (file)
index 0000000..a69be8a
--- /dev/null
@@ -0,0 +1,503 @@
+//
+// System.Web.SiteMapProviderTest.cs - Unit tests for System.Web.SiteMapProvider
+//
+// Author:
+//     Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2009 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Configuration.Provider;
+using System.Diagnostics;
+using System.Reflection;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.Hosting;
+using NUnit.Framework;
+
+using MonoTests.stand_alone.WebHarness;
+using MonoTests.SystemWeb.Framework;
+
+using Tests;
+
+namespace MonoTests.System.Web
+{
+       [TestFixture]
+       public class XmlSiteMapProviderTest
+       {
+
+               [TestFixtureSetUp]
+               public void SetUp ()
+               {
+                       Type myType = GetType ();
+#if VISUAL_STUDIO
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_01.sitemap", "test_map_01.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_02.sitemap", "test_map_02.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_03.sitemap", "test_map_03.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_04.sitemap", "test_map_04.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_05.sitemap", "test_map_05.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_06.sitemap", "test_map_06.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_07.sitemap", "test_map_07.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_08.sitemap", "test_map_08.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.test_map_09.sitemap", "test_map_09.sitemap");
+                       WebTest.CopyResource (myType, "System.Web_test.mainsoft.NunitWeb.NunitWeb.Resources.sub_map_01.sitemap", "sub_map_01.sitemap");
+#else
+                       WebTest.CopyResource (myType, "test_map_01.sitemap", "test_map_01.sitemap");
+                       WebTest.CopyResource (myType, "test_map_02.sitemap", "test_map_02.sitemap");
+                       WebTest.CopyResource (myType, "test_map_03.sitemap", "test_map_03.sitemap");
+                       WebTest.CopyResource (myType, "test_map_04.sitemap", "test_map_04.sitemap");
+                       WebTest.CopyResource (myType, "test_map_05.sitemap", "test_map_05.sitemap");
+                       WebTest.CopyResource (myType, "test_map_06.sitemap", "test_map_06.sitemap");
+                       WebTest.CopyResource (myType, "test_map_07.sitemap", "test_map_07.sitemap");
+                       WebTest.CopyResource (myType, "test_map_08.sitemap", "test_map_08.sitemap");
+                       WebTest.CopyResource (myType, "test_map_09.sitemap", "test_map_09.sitemap");
+                       WebTest.CopyResource (myType, "sub_map_01.sitemap", "sub_map_01.sitemap");
+#endif
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void AddNode_Null_1 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var node = new SiteMapNode (provider, "/test.aspx");
+
+                       provider.DoAddNode (null, node);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void AddNode_Null_2 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var node = new SiteMapNode (provider, "/test.aspx");
+
+                       provider.DoAddNode (node, null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void AddNode_DifferentProviders_01 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var node = new SiteMapNode (new TestSiteMapProvider (), "/test.aspx");
+                       var parentNode = new SiteMapNode (provider, "/test2.aspx");
+
+                       // SiteMapNode  cannot be found in current provider, only nodes in the same provider can be added.
+                       provider.DoAddNode (node, parentNode);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void AddNode_DifferentProviders_02 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var node = new SiteMapNode (provider, "/test.aspx");
+                       var parentNode = new SiteMapNode (new TestSiteMapProvider (), "/test2.aspx");
+
+                       // SiteMapNode  cannot be found in current provider, only nodes in the same provider can be added.
+                       provider.DoAddNode (node, parentNode);
+               }
+
+               [Test]
+               [ExpectedException (typeof (HttpException))]
+               public void AddNode_01 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var node = new SiteMapNode (provider, "/test.aspx");
+                       var parentNode = new SiteMapNode (provider, "/test2.aspx");
+
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+                       provider.Initialize ("TestMap", nvc);
+
+                       // The application relative virtual path '~/test_map_01.sitemap' cannot be made absolute, because the path to the application is not known.
+                       provider.DoAddNode (node, parentNode);
+               }
+
+               [Test]
+               public void AddNode_02 ()
+               {
+                       new WebTest (PageInvoker.CreateOnLoad (AddNode_02_OnLoad)).Run ();
+               }
+
+               public static void AddNode_02_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       provider.CallTrace = null;
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+                       provider.Initialize ("TestMap", nvc);
+
+                       SiteMapNode rootNode = provider.RootNode;
+                       provider.CallTrace = null;
+
+                       var node = new SiteMapNode (provider, "test3.aspx", "~/test3.aspx");
+                       provider.DoAddNode (node, rootNode);
+
+                       Assert.IsNotNull (provider.CallTrace, "#A1");
+                       Assert.Greater (provider.CallTrace.Length, 1, "#A1-1");
+                       Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A1-2");
+               }
+
+               [Test]
+               public void Initialize_1 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+
+                       provider.Initialize ("TestMap", null);
+                       Assert.AreEqual ("TestMap", provider.Name, "#A1");
+               }
+
+               [Test]
+               public void Initialize_2 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+
+                       provider.Initialize ("TestMap", new NameValueCollection ());
+                       Assert.AreEqual ("TestMap", provider.Name, "#A1");
+               }
+
+               [Test]
+               public void Initialize_3 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "test.sitemap");
+                       provider.Initialize ("TestMap", nvc);
+                       Assert.AreEqual ("TestMap", provider.Name, "#A1");
+               }
+
+               [Test]
+               public void Initialize_4 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "test.sitemap");
+                       nvc.Add ("description", "Test XML provider");
+                       provider.Initialize ("TestMap", nvc);
+                       Assert.AreEqual ("TestMap", provider.Name, "#A1");
+                       Assert.AreEqual ("Test XML provider", provider.Description, "#A2");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
+               public void Initialize_5 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "test.sitemap");
+                       nvc.Add ("description", "Test XML provider");
+
+                       // The attribute 'acme' is unexpected in the configuration of the 'TestMap' provider.
+                       nvc.Add ("acme", "test provider");
+                       provider.Initialize ("TestMap", nvc);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void Initialize_6 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+
+                       provider.Initialize ("TestMap", null);
+
+                       // XmlSiteMapProvider cannot be initialized twice
+                       provider.Initialize ("TestMap2", null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void RootNode_1 ()
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+
+                       // Thrown from internal GetConfigDocument ():
+                       // The siteMapFile attribute must be specified on the XmlSiteMapProvider
+                       provider.Initialize ("TestMap", null);
+                       var rn = provider.RootNode;
+               }
+
+               [Test]
+               public void RootNode_2 ()
+               {
+                       new WebTest (PageInvoker.CreateOnLoad (RootNode_2_OnLoad)).Run ();
+               }
+
+               public static void RootNode_2_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       provider.CallTrace = null;
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
+                       provider.CallTrace = null;
+                       provider.Initialize ("TestMap", nvc);
+                       Assert.IsNotNull (provider.RootNode, "#A1");
+                       Assert.AreEqual (provider.RootNode.Provider, provider, "#A2");
+                       Assert.IsNotNull (provider.CallTrace, "#A3");
+                       Assert.Greater (provider.CallTrace.Length, 1, "#A3-1");
+                       Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A3-2");
+                       Assert.AreEqual (provider.CallTrace[1].Name, "get_RootNode", "#A3-3");
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void InvalidFileExtension ()
+               {
+                       // The file /NunitWeb/test_map_01.extension has an invalid extension, only .sitemap files are allowed in XmlSiteMapProvider.
+                       new WebTest (PageInvoker.CreateOnLoad (InvalidFileExtension_OnLoad)).Run ();
+               }
+
+               public static void InvalidFileExtension_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_01.extension");
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void MissingMapFile ()
+               {
+                       new WebTest (PageInvoker.CreateOnLoad (MissingMapFile_OnLoad)).Run ();
+               }
+
+               public static void MissingMapFile_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/missing_map_file.sitemap");
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+               }
+
+               [Test]
+               public void NodeWithSiteMapFile_01 ()
+               {
+                       var test = new WebTest (PageInvoker.CreateOnLoad (NodeWithSiteMapFile_01_OnLoad)).Run ();
+               }
+
+               public static void NodeWithSiteMapFile_01_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_02.sitemap");
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+
+                       string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Sub 1 [/NunitWeb/sub_map_01.sitemap][1]; Sub Sub 1 [/NunitWeb/sub_map_01.sitemap][2]";
+                       string treeString = provider.GetTreeString ();
+
+                       Assert.AreEqual (expectedTreeString, treeString, "#A1");
+               }
+
+               [Test]
+               public void NodeWithProvider_01 ()
+               {
+                       var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               NodeWithProvider_OnLoad ("~/test_map_07.sitemap", p);
+                       })).Run ();
+               }
+
+               [Test]
+               [ExpectedException (typeof (ProviderException))]
+               public void NodeWithProvider_02 ()
+               {
+                       new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               NodeWithProvider_OnLoad ("~/test_map_08.sitemap", p);
+                       })).Run ();
+               }
+
+               public static void NodeWithProvider_OnLoad (string filePath, Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", filePath);
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+
+                       string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Test [TestSiteMapProvider][1]";
+                       string treeString = provider.GetTreeString ();
+                       Assert.AreEqual (expectedTreeString, treeString, "#A1");
+
+                       SiteMapNode node = provider.FindSiteMapNode ("default.aspx");
+                       Assert.IsNotNull (node, "#B1");
+                       Assert.AreEqual ("Test", node.Title, "#B1-1");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
+               public void InvalidMapFile_01 ()
+               {
+                       // Top element must be siteMap.
+                       new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               InvalidMapFile_OnLoad ("~/test_map_03.sitemap", p);
+                       })).Run ();
+               }
+
+               [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
+               public void InvalidMapFile_02 ()
+               {
+                       // Only <siteMapNode> elements are allowed at this location.
+                       var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               InvalidMapFile_OnLoad ("~/test_map_04.sitemap", p);
+                       })).Run ();
+               }
+
+               [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
+               public void InvalidMapFile_03 ()
+               {
+                       // Only <siteMapNode> elements are allowed at this location.
+                       var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               InvalidMapFile_OnLoad ("~/test_map_05.sitemap", p);
+                       })).Run ();
+               }
+
+               [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
+               public void InvalidMapFile_04 ()
+               {
+                       // Only <siteMapNode> elements are allowed at this location.
+                       var test = new WebTest (PageInvoker.CreateOnLoad ((Page p) => {
+                               InvalidMapFile_OnLoad ("~/test_map_06.sitemap", p);
+                       })).Run ();
+               }
+
+               public static void InvalidMapFile_OnLoad (string filePath, Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", filePath);
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+               }
+
+               [Test]
+               public void MapFileWithNonStandardAttributes ()
+               {
+                       // Only <siteMapNode> elements are allowed at this location.
+                       new WebTest (PageInvoker.CreateOnLoad (MapFileWithNonStandardAttributes_OnLoad)).Run ();
+               }
+
+               public static void MapFileWithNonStandardAttributes_OnLoad (Page p)
+               {
+                       var provider = new XmlSiteMapProviderPoker ();
+                       var nvc = new NameValueCollection ();
+                       nvc.Add ("siteMapFile", "~/test_map_09.sitemap");
+
+                       provider.Initialize ("TestMap", nvc);
+                       var rn = provider.RootNode;
+
+                       //TODO: find out what happens to non-standard attributes
+                       //SiteMapNode node = rn.ChildNodes[0];
+                       //Assert.IsNotNull (node, "#A1");
+                       //Assert.AreEqual ("some, keyword, another, one", node["keywords"], "#A1-1");
+
+                       //node = rn.ChildNodes[1];
+                       //Assert.IsNotNull (node, "#B1");
+                       //Assert.AreEqual("value", node["someattribute"], "#B1-1");
+               }
+       }
+
+       class XmlSiteMapProviderPoker : XmlSiteMapProvider
+       {
+               public MethodBase[] CallTrace { get; set; }
+
+               public void DoAddNode (SiteMapNode node, SiteMapNode parentNode)
+               {
+                       AddNode (node, parentNode);
+               }
+
+               public override SiteMapNode BuildSiteMap ()
+               {
+                       StoreCallTrace ();
+                       return base.BuildSiteMap ();
+               }
+
+               public string GetTreeString ()
+               {
+                       var sb = new StringBuilder ();
+                       int untitled_counter = 0;
+                       BuildTreeString (RootNode, sb, 0, ref untitled_counter);
+                       return sb.ToString ();
+               }
+
+               void BuildTreeString (SiteMapNode top, StringBuilder sb, int level, ref int untitled_counter)
+               {
+                       string title = top.Title;
+
+                       if (String.IsNullOrEmpty (title))
+                               title = "UNTITLED_" + untitled_counter++;
+
+                       SiteMapProvider provider = top.Provider;
+                       if (provider != this) {
+                               if (provider == null)
+                                       title += " [NULL_PROVIDER]";
+                               else {
+                                       string name = provider.Name;
+                                       if (String.IsNullOrEmpty (name))
+                                               title += " [" + provider.GetType () + "]";
+                                       else
+                                               title += " [" + name + "]";
+                               }
+                       }
+
+                       if (sb.Length > 0)
+                               sb.Append ("; ");
+                       sb.Append (title + "[" + level + "]");
+                       SiteMapNodeCollection childNodes = top.ChildNodes;
+                       if (childNodes != null && childNodes.Count > 0) {
+                               foreach (SiteMapNode child in childNodes)
+                                       BuildTreeString (child, sb, level + 1, ref untitled_counter);
+                       }
+               }
+
+               void StoreCallTrace ()
+               {
+                       CallTrace = null;
+                       StackFrame[] frames = new StackTrace (1).GetFrames ();
+                       var frameMethods = new List<MethodBase> ();
+
+                       int i = 0;
+                       foreach (StackFrame sf in frames)
+                               frameMethods.Add (sf.GetMethod ());
+                       CallTrace = frameMethods.ToArray ();
+               }
+       }
+}
+#endif
\ No newline at end of file
index d38a06522a6943b8026cf31b84c2fc51083cd5a0..af162a929a0aed7cb1878373860e8eba6b4a2ead 100644 (file)
@@ -1,3 +1,7 @@
+2009-09-07  Marek Habersack  <mhabersack@novell.com>
+
+       * Tests/TestSiteMapProvider.cs: added
+
 2009-07-08  Marek Habersack  <mhabersack@novell.com>
 
        * WebTest.cs: added new public property - TestBaseDir, to be used
index bd7092871bb757d322b9d740b787b95bfef0e7b9..113eb039f456b5c76276b8446a1ae9b302d5286c 100644 (file)
@@ -1,22 +1,22 @@
-using System;\r
-\r
-namespace MainsoftWebApp\r
-{\r
-       public partial class Global : System.Web.HttpApplication\r
-       {\r
-#if NET_2_0\r
-               protected void Application_Error (object sender, EventArgs e)\r
-               {\r
-                       // Code that runs when an unhandled error occurs\r
-                       Exception objErr = Server.GetLastError ().GetBaseException ();\r
-                       MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);\r
-                       Server.ClearError ();\r
-               }\r
-\r
-               protected void Application_OnEndRequest (object sender, EventArgs e) {\r
-                       // Ensure the headers are sent\r
-                       MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();\r
-               }\r
-#endif\r
-       }\r
-}\r
+using System;
+
+namespace MainsoftWebApp
+{
+       public partial class Global : System.Web.HttpApplication
+       {
+#if NET_2_0
+               protected void Application_Error (object sender, EventArgs e)
+               {
+                       // Code that runs when an unhandled error occurs
+                       Exception objErr = Server.GetLastError ().GetBaseException ();
+                       MonoTests.SystemWeb.Framework.WebTest.RegisterException (objErr);
+                       Server.ClearError ();
+               }
+
+               protected void Application_OnEndRequest (object sender, EventArgs e) {
+                       // Ensure the headers are sent
+                       MonoTests.SystemWeb.Framework.WebTest.CurrentTest.SendHeaders ();
+               }
+#endif
+       }
+}
index 101b47cbe2ce93cd299913b939ed95ff1455c63c..89e09925bef461708282818a1b5fecfc52ffa829 100644 (file)
@@ -1 +1 @@
-<%@ WebHandler Class="MonoTests.SystemWeb.Framework.MyHandler" Language="C#" %>\r
+<%@ WebHandler Class="MonoTests.SystemWeb.Framework.MyHandler" Language="C#" %>
index 1efcf797b3d840853a39427afe28f79e48e6c9e9..33e6d2b157a27d959ac6c9f2561d58749002eff1 100644 (file)
@@ -1,29 +1,29 @@
-<%@    Master Language="C#" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >\r
-<head id="Head1" runat="server">\r
-       <title></title>\r
-</head>\r
-    <body>\r
-        <asp:contentplaceholder id="Header" runat="server">\r
-              Master header text\r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Main" runat="server">\r
-              Master main text \r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Dynamic" runat="server">\r
-              Master dynamic text\r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Footer" runat="server">\r
-                     My master page footer \r
-               </asp:contentplaceholder>\r
-               \r
-               Master page content text\r
-       \r
-    </body>\r
-</html>\r
+<%@    Master Language="C#" %>
+
+<!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" xml:lang="en" >
+<head id="Head1" runat="server">
+       <title></title>
+</head>
+    <body>
+        <asp:contentplaceholder id="Header" runat="server">
+              Master header text
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Main" runat="server">
+              Master main text 
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Dynamic" runat="server">
+              Master dynamic text
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Footer" runat="server">
+                     My master page footer 
+               </asp:contentplaceholder>
+               
+               Master page content text
+       
+    </body>
+</html>
index 5fa9116faa08b7b4abaa842026f35926dda27a63..fc066a128625a43213059e98b6f5f0e9735775cf 100644 (file)
@@ -1,30 +1,30 @@
-<%@ Master Language="C#" MasterPageFile="My.master"%>                                   \r
-<%@ MasterType VirtualPath="My.master" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >\r
-<head id="Head1" runat="server">\r
-       <title></title>\r
-</head>\r
-    <body>\r
-        <asp:contentplaceholder id="Header" runat="server">\r
-              Master header text\r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Main" runat="server">\r
-              Master main text \r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Dynamic" runat="server">\r
-              Master dynamic text\r
-        </asp:contentplaceholder>\r
-        \r
-        <asp:contentplaceholder id="Footer" runat="server">\r
-                     My master page footer \r
-               </asp:contentplaceholder>\r
-               \r
-               Master page content text\r
-       \r
-    </body>\r
-</html>\r
+<%@ Master Language="C#" MasterPageFile="My.master"%>                                   
+<%@ MasterType VirtualPath="My.master" %>
+
+<!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" xml:lang="en" >
+<head id="Head1" runat="server">
+       <title></title>
+</head>
+    <body>
+        <asp:contentplaceholder id="Header" runat="server">
+              Master header text
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Main" runat="server">
+              Master main text 
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Dynamic" runat="server">
+              Master dynamic text
+        </asp:contentplaceholder>
+        
+        <asp:contentplaceholder id="Footer" runat="server">
+                     My master page footer 
+               </asp:contentplaceholder>
+               
+               Master page content text
+       
+    </body>
+</html>
index c79560a09f621cbd5a5139eb7046ce3d4c3f5676..6a546826c3c85009d2929456bee7685b1f026c4a 100644 (file)
@@ -1,16 +1,16 @@
-<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-\r
-<html xmlns="http://www.w3.org/1999/xhtml" >\r
-<head id="Head1" runat="server">\r
-    <title>Untitled Page</title>\r
-</head>\r
-<body>\r
-    <form id="form1" runat="server">\r
-    <div>\r
-    \r
-    </div>\r
-    </form>\r
-</body>\r
-</html>\r
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<!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" >
+<head id="Head1" runat="server">
+    <title>Untitled Page</title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+    
+    </div>
+    </form>
+</body>
+</html>
index 93aa477c436c6b66f410446fc6a9468048b918d8..a8873618549e4609b267516040ee4101fa6bcc9a 100644 (file)
@@ -1,27 +1,27 @@
-#if TARGET_JVM\r
-#define BUG_78521_FIXED\r
-#endif\r
-\r
-using System;\r
-using System.Web.UI;\r
-using MonoTests.SystemWeb.Framework;\r
-\r
-public partial class MyPage : System.Web.UI.Page\r
-{\r
-       //FIXME: mono defines its own constructor here\r
-#if BUG_78521_FIXED\r
-       public MyPage ()\r
-#else\r
-       protected override void OnPreInit (EventArgs e)\r
-#endif\r
-       {\r
-               WebTest t = WebTest.CurrentTest;\r
-               if (t != null)\r
-                       t.Invoke (this);\r
-       }\r
-               \r
-       public override void VerifyRenderingInServerForm (Control c)\r
-       {\r
-\r
-       }\r
-}\r
+#if TARGET_JVM
+#define BUG_78521_FIXED
+#endif
+
+using System;
+using System.Web.UI;
+using MonoTests.SystemWeb.Framework;
+
+public partial class MyPage : System.Web.UI.Page
+{
+       //FIXME: mono defines its own constructor here
+#if BUG_78521_FIXED
+       public MyPage ()
+#else
+       protected override void OnPreInit (EventArgs e)
+#endif
+       {
+               WebTest t = WebTest.CurrentTest;
+               if (t != null)
+                       t.Invoke (this);
+       }
+               
+       public override void VerifyRenderingInServerForm (Control c)
+       {
+
+       }
+}
index 089496d0a2b9aa02af079ebb9909585fd5ac713e..d432b059349ba95552797547d7b4847c47a57ec3 100644 (file)
@@ -1,12 +1,12 @@
-<%@ Page Language="C#" MasterPageFile="MyDerived.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>\r
-\r
-<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">\r
-     Page main text\r
-</asp:content>\r
-\r
-<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">\r
-    <form id="form1" runat="server" >\r
-    </form>\r
-</asp:content>\r
+<%@ Page Language="C#" MasterPageFile="MyDerived.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>
+
+<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">
+     Page main text
+</asp:content>
+
+<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">
+    <form id="form1" runat="server" >
+    </form>
+</asp:content>
index 25b3d8e6990f81637b6ad1422401680c42d93107..6d6067e981927f0e640a24cf1ab900410e3bb547 100644 (file)
@@ -1,12 +1,12 @@
-<%@ Page Language="C#" MasterPageFile="My.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>\r
-\r
-<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>\r
-\r
-<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">\r
-     Page main text\r
-</asp:content>\r
-\r
-<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">\r
-    <form id="form1" runat="server" >\r
-    </form>\r
-</asp:content>\r
+<%@ Page Language="C#" MasterPageFile="My.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
+
+<asp:Content ID="BlankContent" ContentPlaceHolderID="Header" runat="server"/>
+
+<asp:content ID="LiteralContent" ContentPlaceHolderID="Main" runat="server">
+     Page main text
+</asp:content>
+
+<asp:content ID="FormContent" ContentPlaceHolderID="Dynamic" runat="server">
+    <form id="form1" runat="server" >
+    </form>
+</asp:content>
index 2e7c4df8ba53145616bdc22c9c59d9566d2060cd..1539676da6c3c920da91bbd4caf44308ad1cf1a3 100644 (file)
@@ -1,90 +1,94 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-  <configSections>\r
-               <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                               <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                               <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                                       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>\r
-                                       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                                       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                               </sectionGroup>\r
-                       </sectionGroup>\r
-               </sectionGroup>\r
-       </configSections>\r
-\r
-  <appSettings>\r
-    <add key="strvalue" value="str" />\r
-    <add key="intvalue" value="123" />\r
-  </appSettings>\r
-  <system.web>\r
-    <siteMap enabled="true"/>\r
-    <compilation debug="true" batch="false">\r
-       <assemblies>\r
-               <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-       </assemblies>\r
-    </compilation>\r
-\r
-\r
-\r
-    <httpHandlers>\r
-      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
-      <remove verb="*" path="*.asmx"/>\r
-      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>\r
-    </httpHandlers>\r
-    <pages enableSessionState="false">\r
-                       <controls>\r
-                               <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-                       </controls>\r
-    </pages>\r
-    <membership defaultProvider="FakeProvider">\r
-      <providers>\r
-        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
-             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
-             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
-             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
-             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
-             passwordStrengthRegularExpression="" />\r
-      </providers>\r
-    </membership>\r
-  </system.web>\r
-       <system.web.extensions>\r
-               <scripting>\r
-                       <webServices>\r
-                               <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->\r
-                               <!--\r
-      <jsonSerialization maxJsonLength="500">\r
-        <converters>\r
-          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>\r
-        </converters>\r
-      </jsonSerialization>\r
-      -->\r
-                               <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->\r
-                               <!--\r
-        <authenticationService enabled="true" requireSSL = "true|false"/>\r
-      -->\r
-                               <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved\r
-           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and\r
-           writeAccessProperties attributes. -->\r
-                               <!--\r
-      <profileService enabled="true"\r
-                      readAccessProperties="propertyname1,propertyname2"\r
-                      writeAccessProperties="propertyname1,propertyname2" />\r
-      -->\r
-                       </webServices>\r
-                       <!--\r
-      <scriptResourceHandler enableCompression="true" enableCaching="true" />\r
-      -->\r
-               </scripting>\r
-       </system.web.extensions>\r
-\r
-  <system.net>\r
-    <mailSettings>\r
-      <smtp from="heh@heh.com">\r
-        <network host="localhost" port="125"/>\r
-      </smtp>\r
-    </mailSettings>\r
-  </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <configSections>
+               <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                               <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                               <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                                       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
+                                       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                                       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                               </sectionGroup>
+                       </sectionGroup>
+               </sectionGroup>
+       </configSections>
+
+  <appSettings>
+    <add key="strvalue" value="str" />
+    <add key="intvalue" value="123" />
+  </appSettings>
+  <system.web>
+      <siteMap enabled="true">
+          <providers>
+              <add name="TestSiteMapProvider" type="Tests.TestSiteMapProvider" />
+          </providers>
+      </siteMap>
+    <compilation debug="true" batch="false">
+       <assemblies>
+               <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+       </assemblies>
+    </compilation>
+
+
+
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+      <remove verb="*" path="*.asmx"/>
+      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
+    </httpHandlers>
+    <pages enableSessionState="false">
+                       <controls>
+                               <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                       </controls>
+    </pages>
+    <membership defaultProvider="FakeProvider">
+      <providers>
+        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+       <system.web.extensions>
+               <scripting>
+                       <webServices>
+                               <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
+                               <!--
+      <jsonSerialization maxJsonLength="500">
+        <converters>
+          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
+        </converters>
+      </jsonSerialization>
+      -->
+                               <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
+                               <!--
+        <authenticationService enabled="true" requireSSL = "true|false"/>
+      -->
+                               <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
+           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
+           writeAccessProperties attributes. -->
+                               <!--
+      <profileService enabled="true"
+                      readAccessProperties="propertyname1,propertyname2"
+                      writeAccessProperties="propertyname1,propertyname2" />
+      -->
+                       </webServices>
+                       <!--
+      <scriptResourceHandler enableCompression="true" enableCaching="true" />
+      -->
+               </scripting>
+       </system.web.extensions>
+
+  <system.net>
+    <mailSettings>
+      <smtp from="heh@heh.com">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>
index c3f9815ddf684cc73da37c57b523eed5f64ccf7f..e7e835ae73f54f803c82e57ce938bc13c0baab76 100644 (file)
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-  <appSettings>\r
-    <add key="strvalue" value="str" />\r
-    <add key="intvalue" value="123" />\r
-  </appSettings>\r
-  <system.web>\r
-    <siteMap enabled="true"/>\r
-    <compilation debug="true" batch="false">\r
-    </compilation>\r
-\r
-\r
-\r
-    <httpHandlers>\r
-      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
-    </httpHandlers>\r
-    <pages enableSessionState="false" />\r
-    <membership defaultProvider="FakeProvider">\r
-      <providers>\r
-        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
-             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
-             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
-             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
-             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
-             passwordStrengthRegularExpression="" />\r
-      </providers>\r
-    </membership>\r
-  </system.web>\r
-  <system.net>\r
-    <mailSettings>\r
-      <smtp from="heh@heh.com">\r
-        <network host="localhost" port="125"/>\r
-      </smtp>\r
-    </mailSettings>\r
-  </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <appSettings>
+    <add key="strvalue" value="str" />
+    <add key="intvalue" value="123" />
+  </appSettings>
+  <system.web>
+    <siteMap enabled="true"/>
+    <compilation debug="true" batch="false">
+    </compilation>
+
+
+
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+    </httpHandlers>
+    <pages enableSessionState="false" />
+    <membership defaultProvider="FakeProvider">
+      <providers>
+        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+  <system.net>
+    <mailSettings>
+      <smtp from="heh@heh.com">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>
index dd614aca23606aef3f14c4d98d826f106a40db16..7b7d08db827f3bc7ddc737a04bb78d93724222d1 100755 (executable)
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-  <configSections>\r
-               <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                               <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                               <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">\r
-                                       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>\r
-                                       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                                       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>\r
-                               </sectionGroup>\r
-                       </sectionGroup>\r
-                       <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_2_0" />\r
-               </sectionGroup>\r
-       </configSections>\r
-  <appSettings>\r
-    <add key="strvalue" value="str" />\r
-    <add key="intvalue" value="123" />\r
-  </appSettings>\r
-  \r
-  <!-- DO NOT REMOVE: USED BY TESTS -->\r
-  <CustomTags>\r
-    <sections>\r
-      <add area="activityTemplateTitle">\r
-        <add name="a" />\r
-      </add>\r
-      <add area="Something">\r
-      </add>\r
-    </sections>\r
-  </CustomTags>\r
-  \r
-  <system.web>\r
-    <siteMap enabled="true"/>\r
-    <compilation debug="true" batch="false" numRecompilesBeforeAppRestart="100000">\r
-       <assemblies>\r
-               <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-       </assemblies>\r
-    </compilation>\r
-    <httpHandlers>\r
-      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
-      <remove verb="*" path="*.asmx"/>\r
-      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>\r
-    </httpHandlers>\r
-    <pages enableSessionState="false">\r
-                       <controls>\r
-                               <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>\r
-                       </controls>\r
-    </pages>\r
-    <membership defaultProvider="FakeProvider">\r
-      <providers>\r
-        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
-             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
-             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
-             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
-             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
-             passwordStrengthRegularExpression="" />\r
-      </providers>\r
-    </membership>\r
-  </system.web>\r
-       <system.web.extensions>\r
-               <scripting>\r
-                       <webServices>\r
-                               <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->\r
-                               <!--\r
-      <jsonSerialization maxJsonLength="500">\r
-        <converters>\r
-          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>\r
-        </converters>\r
-      </jsonSerialization>\r
-      -->\r
-                               <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->\r
-                               <!--\r
-        <authenticationService enabled="true" requireSSL = "true|false"/>\r
-      -->\r
-                               <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved\r
-           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and\r
-           writeAccessProperties attributes. -->\r
-                               <!--\r
-      <profileService enabled="true"\r
-                      readAccessProperties="propertyname1,propertyname2"\r
-                      writeAccessProperties="propertyname1,propertyname2" />\r
-      -->\r
-                       </webServices>\r
-                       <!--\r
-      <scriptResourceHandler enableCompression="true" enableCaching="true" />\r
-      -->\r
-               </scripting>\r
-       </system.web.extensions>\r
-  <system.net>\r
-    <mailSettings>\r
-      <smtp from="heh@heh.com">\r
-        <network host="localhost" port="125"/>\r
-      </smtp>\r
-    </mailSettings>\r
-  </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <configSections>
+               <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                               <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                               <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+                                       <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
+                                       <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                                       <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
+                               </sectionGroup>
+                       </sectionGroup>
+                       <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_2_0" />
+               </sectionGroup>
+       </configSections>
+  <appSettings>
+    <add key="strvalue" value="str" />
+    <add key="intvalue" value="123" />
+  </appSettings>
+  
+  <!-- DO NOT REMOVE: USED BY TESTS -->
+  <CustomTags>
+    <sections>
+      <add area="activityTemplateTitle">
+        <add name="a" />
+      </add>
+      <add area="Something">
+      </add>
+    </sections>
+  </CustomTags>
+  
+  <system.web>
+      <siteMap enabled="true">
+          <providers>
+              <add name="TestSiteMapProvider" type="Tests.TestSiteMapProvider" />
+          </providers>
+      </siteMap>
+    <compilation debug="true" batch="false" numRecompilesBeforeAppRestart="100000">
+       <assemblies>
+               <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+       </assemblies>
+    </compilation>
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+      <remove verb="*" path="*.asmx"/>
+      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
+    </httpHandlers>
+    <pages enableSessionState="false">
+                       <controls>
+                               <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
+                       </controls>
+    </pages>
+    <membership defaultProvider="FakeProvider">
+      <providers>
+        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+       <system.web.extensions>
+               <scripting>
+                       <webServices>
+                               <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
+                               <!--
+      <jsonSerialization maxJsonLength="500">
+        <converters>
+          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
+        </converters>
+      </jsonSerialization>
+      -->
+                               <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
+                               <!--
+        <authenticationService enabled="true" requireSSL = "true|false"/>
+      -->
+                               <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
+           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
+           writeAccessProperties attributes. -->
+                               <!--
+      <profileService enabled="true"
+                      readAccessProperties="propertyname1,propertyname2"
+                      writeAccessProperties="propertyname1,propertyname2" />
+      -->
+                       </webServices>
+                       <!--
+      <scriptResourceHandler enableCompression="true" enableCaching="true" />
+      -->
+               </scripting>
+       </system.web.extensions>
+  <system.net>
+    <mailSettings>
+      <smtp from="heh@heh.com">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>
index 585d4f39be8e7a8b41e0e80f36de524636f31b75..769204401f152aefe6316a4eaa3bf45cfdce1120 100755 (executable)
@@ -1,33 +1,33 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-  <appSettings>\r
-    <add key="strvalue" value="str" />\r
-    <add key="intvalue" value="123" />\r
-  </appSettings>\r
-  <system.web>\r
-    <siteMap enabled="true"/>\r
-    <compilation debug="true" batch="false">\r
-    </compilation>\r
-    <httpHandlers>\r
-      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />\r
-    </httpHandlers>\r
-    <pages enableSessionState="false" />\r
-    <membership defaultProvider="FakeProvider">\r
-      <providers>\r
-        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"\r
-             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"\r
-             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"\r
-             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"\r
-             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"\r
-             passwordStrengthRegularExpression="" />\r
-      </providers>\r
-    </membership>\r
-  </system.web>\r
-  <system.net>\r
-    <mailSettings>\r
-      <smtp from="heh@heh.com">\r
-        <network host="localhost" port="125"/>\r
-      </smtp>\r
-    </mailSettings>\r
-  </system.net>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <appSettings>
+    <add key="strvalue" value="str" />
+    <add key="intvalue" value="123" />
+  </appSettings>
+  <system.web>
+    <siteMap enabled="true"/>
+    <compilation debug="true" batch="false">
+    </compilation>
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
+    </httpHandlers>
+    <pages enableSessionState="false" />
+    <membership defaultProvider="FakeProvider">
+      <providers>
+        <add name="FakeProvider" type="MonoTests.SystemWeb.Framework.FakeMembershipProvider"
+             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+  <system.net>
+    <mailSettings>
+      <smtp from="heh@heh.com">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap
new file mode 100644 (file)
index 0000000..4f6d364
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode url="sub1.aspx" title="Sub 1"  description="">
+        <siteMapNode url="sub_sub1.aspx" title="Sub Sub 1"  description="" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap
new file mode 100644 (file)
index 0000000..9586f37
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode url="test2.aspx" title="Test 2"  description="Test Two" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap
new file mode 100644 (file)
index 0000000..8403438
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode siteMapFile="~/sub_map_01.sitemap" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap
new file mode 100644 (file)
index 0000000..b4b2937
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode url="test2.aspx" title="Test 2"  description="Test Two" />
+    </siteMapNode>
+
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap
new file mode 100644 (file)
index 0000000..1818325
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNodeBroken>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode url="test2.aspx" title="Test 2"  description="Test Two" />
+    </siteMapNodeBroken>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap
new file mode 100644 (file)
index 0000000..b2efc65
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode url="test2.aspx" title="Test 2"  description="Test Two" />
+    </siteMapNode>
+
+    <siteMapNode>
+        <siteMapNode url="test3.aspx" title="Test 3"  description="Test Three" />
+        <siteMapNode url="test4.aspx" title="Test 4"  description="Test Four" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap
new file mode 100644 (file)
index 0000000..0c92e0b
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap
new file mode 100644 (file)
index 0000000..01f07ea
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode provider="TestSiteMapProvider" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap
new file mode 100644 (file)
index 0000000..c2870ca
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" />
+        <siteMapNode provider="NonExistentSiteMapProvider" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap
new file mode 100644 (file)
index 0000000..33b8ac0
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
+    <siteMapNode>
+        <siteMapNode url="test1.aspx" title="Test 1"  description="Test One" 
+         keywords="some, keyword, another, one" />
+        <siteMapNode url="test2.aspx" title="Test 2"  description="Test Two" 
+         someattribute="value" />
+    </siteMapNode>
+</siteMap>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Tests/TestSiteMapProvider.cs b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Tests/TestSiteMapProvider.cs
new file mode 100644 (file)
index 0000000..aa6264c
--- /dev/null
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Specialized;
+using System.Web;
+
+namespace Tests {
+       public class TestSiteMapProvider : StaticSiteMapProvider {
+               object rootNodeLock = new object();
+               SiteMapNode rootNode = null;
+
+               public override SiteMapNode RootNode {
+                       get { return BuildSiteMap(); }
+               }
+
+               protected override SiteMapNode GetRootNodeCore() {
+                       return BuildSiteMap();
+               }
+
+               protected override void Clear() {
+                       lock (rootNodeLock) {
+                               rootNode = null;
+                               base.Clear();
+                       }
+               }
+               
+               public override SiteMapNode BuildSiteMap () {
+                       lock (rootNodeLock) {
+                               if(rootNode == null) {
+                                       rootNode = new SiteMapNode(this, "Test", "default.aspx", "Test");
+                                       AddNode(rootNode);
+                               }
+                               return rootNode;
+                       }
+               }
+       }
+}
\ No newline at end of file