Author: gert
Date: 2007-09-22 20:19:03 -0400 (Sat, 22 Sep 2007)
New Revision: 86228

Added:
   trunk/gert/standalone/bug81331/
   trunk/gert/standalone/bug81331/default.build
   trunk/gert/standalone/bug81331/handler.cs
   trunk/gert/standalone/bug81331/test.cs
   trunk/gert/standalone/bug81331/web/
   trunk/gert/standalone/bug81331/web/Web.config
   trunk/gert/standalone/bug81331/web/doc/
   trunk/gert/standalone/bug81331/web/doc/Web.config
   trunk/gert/standalone/bug81331/web/doc/index.html
Modified:
   trunk/gert/standalone/known-issues
Log:
Added test for bug #81331.


Added: trunk/gert/standalone/bug81331/default.build
===================================================================
--- trunk/gert/standalone/bug81331/default.build        2007-09-22 23:59:22 UTC 
(rev 86227)
+++ trunk/gert/standalone/bug81331/default.build        2007-09-23 00:19:03 UTC 
(rev 86228)
@@ -0,0 +1,71 @@
+<project name="bug81331" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="web/bin/**" />
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <mkdir dir="web/bin" />
+               <csc target="library" define="${csc.defines}" 
output="web/bin/test.handlers.dll" warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="handler.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Web.dll" />
+                       </references>
+               </csc>
+               <csc target="exe" define="${csc.defines}" output="test.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Web.dll" />
+                       </references>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/standalone/bug81331/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81331/handler.cs
===================================================================
--- trunk/gert/standalone/bug81331/handler.cs   2007-09-22 23:59:22 UTC (rev 
86227)
+++ trunk/gert/standalone/bug81331/handler.cs   2007-09-23 00:19:03 UTC (rev 
86228)
@@ -0,0 +1,42 @@
+using System;
+using System.Web;
+using System.Web.UI;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace Test
+{
+       public class RootHandler : IHttpHandler
+       {
+               public void ProcessRequest (HttpContext context)
+               {
+                       HttpResponse Response = context.Response;
+                       Response.Write ("<html>");
+                       Response.Write ("<body>");
+                       Response.Write ("<h1> Hello from ROOT handler. </h1>");
+                       Response.Write ("</body>");
+                       Response.Write ("</html>");
+               }
+               public bool IsReusable
+               {
+                       get { return false; }
+               }
+       }
+       public class SubdirHandler : IHttpHandler
+       {
+               public void ProcessRequest (HttpContext context)
+               {
+                       HttpResponse Response = context.Response;
+                       Response.Write ("<html>");
+                       Response.Write ("<body>");
+                       Response.Write ("<h1> Hello from Subdir handler. 
</h1>");
+                       Response.Write ("</body>");
+                       Response.Write ("</html>");
+               }
+               public bool IsReusable
+               {
+                       get { return false; }
+               }
+       }
+}


Property changes on: trunk/gert/standalone/bug81331/handler.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81331/test.cs
===================================================================
--- trunk/gert/standalone/bug81331/test.cs      2007-09-22 23:59:22 UTC (rev 
86227)
+++ trunk/gert/standalone/bug81331/test.cs      2007-09-23 00:19:03 UTC (rev 
86228)
@@ -0,0 +1,158 @@
+using System;
+using System.IO;
+using System.Web;
+using System.Web.Hosting;
+
+class TinyHost : MarshalByRefObject
+{
+       static TinyHost CreateHost ()
+       {
+               string path = Path.Combine 
(AppDomain.CurrentDomain.BaseDirectory, "web");
+               string bin = Path.Combine (path, "bin");
+               string asm = Path.GetFileName (typeof 
(TinyHost).Assembly.Location);
+
+               Directory.CreateDirectory (bin);
+               File.Copy (asm, Path.Combine (bin, asm), true);
+
+               return (TinyHost) ApplicationHost.CreateApplicationHost (
+                       typeof (TinyHost), "/", path);
+       }
+
+       public void Execute (string page, TextWriter tw)
+       {
+               SimpleWorkerRequest req = new SimpleWorkerRequest (
+                       page, "", tw);
+               HttpRuntime.ProcessRequest (req);
+       }
+
+       static int Main ()
+       {
+               string result;
+
+               TinyHost h = CreateHost ();
+               StringWriter sw = new StringWriter ();
+
+               h.Execute ("root.ashx", sw);
+               result = sw.ToString ();
+               if (result.IndexOf ("Hello from ROOT handler") == -1) {
+                       Console.WriteLine (result);
+                       return 1;
+               }
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.Combine ("whatever", "root.ashx"), sw);
+               result = sw.ToString ();
+#if NET_2_0 || MONO
+               if (result.IndexOf ("Hello from ROOT handler") == -1) {
+                       Console.WriteLine (result);
+                       return 2;
+               }
+#else
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 2;
+               }
+               if (result.IndexOf (@"/whatever\root.ashx") == -1) {
+                       Console.WriteLine (result);
+                       return 2;
+               }
+#endif
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.DirectorySeparatorChar + Path.Combine ("doc", 
"index.html"), sw);
+               result = sw.ToString ();
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 3;
+               }
+#if NET_2_0 || MONO
+               if (result.IndexOf ("/doc/index.html") == -1) {
+#else
+               if (result.IndexOf (@"/\doc\index.html") == -1) {
+#endif
+                       Console.WriteLine (result);
+                       return 3;
+               }
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.Combine ("doc", "index.html"), sw);
+               result = sw.ToString ();
+#if NET_2_0 || MONO
+               if (result != "<html><head><title>index</title></head></html>") 
{
+                       Console.WriteLine (result);
+                       return 4;
+               }
+#else
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 4;
+               }
+               if (result.IndexOf (@"/doc\index.html") == -1) {
+                       Console.WriteLine (result);
+                       return 4;
+               }
+#endif
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.DirectorySeparatorChar + Path.Combine ("doc", 
"root.ashx"), sw);
+               result = sw.ToString ();
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 5;
+               }
+#if NET_2_0 || MONO
+               if (result.IndexOf ("/doc/root.ashx") == -1) {
+#else
+               if (result.IndexOf (@"/\doc\root.ashx") == -1) {
+#endif
+                       Console.WriteLine (result);
+                       return 5;
+               }
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.Combine ("doc", "root.ashx"), sw);
+               result = sw.ToString ();
+#if NET_2_0 || MONO
+               if (result.IndexOf ("Hello from ROOT handler") == -1) {
+                       Console.WriteLine (result);
+                       return 6;
+               }
+#else
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 6;
+               }
+               if (result.IndexOf (@"/doc\root.ashx") == -1) {
+                       Console.WriteLine (result);
+                       return 6;
+               }
+#endif
+
+               sw.GetStringBuilder ().Length = 0;
+               h = CreateHost ();
+               h.Execute (Path.Combine ("doc", "subdir.ashx"), sw);
+               result = sw.ToString ();
+#if NET_2_0
+               if (result.IndexOf ("Hello from Subdir handler") == -1) {
+                       Console.WriteLine (result);
+                       return 7;
+               }
+#else
+               if (result.IndexOf ("The resource cannot be found.") == -1) {
+                       Console.WriteLine (result);
+                       return 7;
+               }
+               if (result.IndexOf (@"/doc\subdir.ashx") == -1) {
+                       Console.WriteLine (result);
+                       return 7;
+               }
+#endif
+
+               return 0;
+       }
+}


Property changes on: trunk/gert/standalone/bug81331/test.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81331/web/Web.config
===================================================================
--- trunk/gert/standalone/bug81331/web/Web.config       2007-09-22 23:59:22 UTC 
(rev 86227)
+++ trunk/gert/standalone/bug81331/web/Web.config       2007-09-23 00:19:03 UTC 
(rev 86228)
@@ -0,0 +1,13 @@
+<?xml  version="1.0"   encoding="utf-8" ?>
+<configuration>
+       <appSettings/>
+       <system.web>
+               <compilation defaultLanguage="c#"       debug="true" />
+               <customErrors mode="Off"/>
+               <sessionState mode="InProc" cookieless="false" timeout="20" />
+               <globalization requestEncoding="utf-8" responseEncoding="utf-8" 
/>
+               <httpHandlers>
+                       <add verb="GET" path="root.ashx" 
type="Test.RootHandler, test.handlers" />
+               </httpHandlers>
+       </system.web>
+</configuration>


Property changes on: trunk/gert/standalone/bug81331/web/Web.config
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81331/web/doc/Web.config
===================================================================
--- trunk/gert/standalone/bug81331/web/doc/Web.config   2007-09-22 23:59:22 UTC 
(rev 86227)
+++ trunk/gert/standalone/bug81331/web/doc/Web.config   2007-09-23 00:19:03 UTC 
(rev 86228)
@@ -0,0 +1,8 @@
+<?xml  version="1.0"   encoding="utf-8" ?>
+<configuration>
+       <system.web>
+               <httpHandlers>
+                       <add verb="GET" path="subdir.ashx" 
type="Test.SubdirHandler, test.handlers" />
+               </httpHandlers>
+       </system.web>
+</configuration>


Property changes on: trunk/gert/standalone/bug81331/web/doc/Web.config
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81331/web/doc/index.html
===================================================================
--- trunk/gert/standalone/bug81331/web/doc/index.html   2007-09-22 23:59:22 UTC 
(rev 86227)
+++ trunk/gert/standalone/bug81331/web/doc/index.html   2007-09-23 00:19:03 UTC 
(rev 86228)
@@ -0,0 +1 @@
+<html><head><title>index</title></head></html>
\ No newline at end of file

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2007-09-22 23:59:22 UTC (rev 86227)
+++ trunk/gert/standalone/known-issues  2007-09-23 00:19:03 UTC (rev 86228)
@@ -19,6 +19,7 @@
 bug81034/**
 bug81127/**
 bug81204/**
+bug81331/**
 bug81341/**
 bug81413/**
 bug81446/**

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

Reply via email to