Author: kostat
Date: 2006-12-19 11:16:20 -0500 (Tue, 19 Dec 2006)
New Revision: 69750

Modified:
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
Log:
avoid using multiple appdomains in NunitWeb; have only the default and target 
AppDomains

Modified: trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs       
2006-12-19 16:14:48 UTC (rev 69749)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs       
2006-12-19 16:16:20 UTC (rev 69750)
@@ -188,8 +188,9 @@
                /// <summary>
                /// Unload the web appdomain and delete the temporary 
application root
                /// directory.
+               /// Is never called.
                /// </summary>
-               public static void Unload ()
+               static void RealUnload ()
                {
 #if !TARGET_JVM
                        if (host != null) {
@@ -211,6 +212,8 @@
 #endif
                }
 
+               public static void Unload () {}
+
                /// <summary>
                /// Default constructor. Initializes <see cref="Invoker"/> with 
a new
                /// <see cref="BaseInvoker"/> and <see cref="Request"/> with an 
empty
@@ -280,15 +283,39 @@
                {
 #if !TARGET_JVM
                        EnsureWorkingDirectories ();
-                       CheckDomainIsDown ();
                        EnsureDirectoryExists (Path.Combine (baseDir,
                                Path.GetDirectoryName (targetUrl)));
                        using (Stream source = 
type.Assembly.GetManifestResourceStream (resourceName)) {
                                if (source == null)
                                        throw new ArgumentException ("resource 
not found: " + resourceName, "resourceName");
+                               byte[] array = new byte[source.Length];
+                               source.Read (array, 0, array.Length);
+
+                               if (File.Exists(Path.Combine (baseDir, 
targetUrl))) {
+                                       using (FileStream existing = 
File.OpenRead(Path.Combine (baseDir, targetUrl))) {
+                                               bool equal = false;
+                                               if (array.Length == 
existing.Length) {
+                                                       byte[] existingArray = 
new byte[array.Length];
+                                                       existing.Read 
(existingArray, 0, existingArray.Length);
+                                                       
+                                                       equal = true;
+                                                       for (int i = 0; i < 
array.Length; i ++) {
+                                                               if (array[i] != 
existingArray[i]) {
+                                                                       equal = 
false;
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                               
+                                               if (equal)
+                                                       return;
+                                               
+                                       }
+                                       
+                                       CheckDomainIsDown ();
+                               }
+
                                using (FileStream target = new FileStream 
(Path.Combine (baseDir, targetUrl), FileMode.Create)) {
-                                       byte[] array = new byte[source.Length];
-                                       source.Read (array, 0, array.Length);
                                        target.Write (array, 0, array.Length);
                                }
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to