Author: gert
Date: 2007-10-15 04:17:49 -0400 (Mon, 15 Oct 2007)
New Revision: 87479

Added:
   trunk/gert/standalone/bug333686/
   trunk/gert/standalone/bug333686/DebugModule.cs
   trunk/gert/standalone/bug333686/Webv11.config
   trunk/gert/standalone/bug333686/Webv20.config
   trunk/gert/standalone/bug333686/default.build
   trunk/gert/standalone/bug333686/test.cs
   trunk/gert/standalone/bug333686/web/
   trunk/gert/standalone/bug333686/web/App_Code/
   trunk/gert/standalone/bug333686/web/App_Code/Modules/
   trunk/gert/standalone/bug333686/web/App_Code/Modules/TestModule.cs
   trunk/gert/standalone/bug333686/web/Default.aspx
Modified:
   trunk/gert/standalone/known-issues
Log:
Added test for bug #333686.


Added: trunk/gert/standalone/bug333686/DebugModule.cs
===================================================================
--- trunk/gert/standalone/bug333686/DebugModule.cs      2007-10-15 08:17:12 UTC 
(rev 87478)
+++ trunk/gert/standalone/bug333686/DebugModule.cs      2007-10-15 08:17:49 UTC 
(rev 87479)
@@ -0,0 +1,61 @@
+using System;
+using System.Web;
+
+namespace Mono.Web
+{
+       public class DebugModule : System.Web.IHttpModule
+       {
+               public void Init (HttpApplication application)
+               {
+                       application.BeginRequest += new EventHandler 
(Application_BeginRequest);
+                       application.EndRequest += new EventHandler 
(Application_EndRequest);
+               }
+
+               public void Dispose ()
+               {
+               }
+
+               void Application_BeginRequest(Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication)source;
+                       HttpContext context = application.Context;
+                       context.Response.Write("<h1>Begin DebugModule</h1>");
+               }
+
+               void Application_EndRequest (Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication) source;
+                       HttpContext context = application.Context;
+                       context.Response.Write ("<h1>End DebugModule</h1>");
+               }
+       }
+
+#if ONLY_1_1
+       public class TestModule : System.Web.IHttpModule
+       {
+               public void Init (HttpApplication application)
+               {
+                       application.BeginRequest += new EventHandler 
(Application_BeginRequest);
+                       application.EndRequest += new EventHandler 
(Application_EndRequest);
+               }
+
+               public void Dispose ()
+               {
+               }
+
+               void Application_BeginRequest (Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication) source;
+                       HttpContext context = application.Context;
+                       context.Response.Write ("<h1>Begin TestModule</h1>");
+               }
+
+               void Application_EndRequest (Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication) source;
+                       HttpContext context = application.Context;
+                       context.Response.Write ("<h1>End TestModule</h1>");
+               }
+       }
+#endif
+}


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

Added: trunk/gert/standalone/bug333686/Webv11.config
===================================================================
--- trunk/gert/standalone/bug333686/Webv11.config       2007-10-15 08:17:12 UTC 
(rev 87478)
+++ trunk/gert/standalone/bug333686/Webv11.config       2007-10-15 08:17:49 UTC 
(rev 87479)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<configuration>
+       <system.web>
+               <httpModules>
+                       <add name="TestModule" type="Mono.Web.TestModule, 
Mono.Web" />
+                       <add name="DebugModule" type="Mono.Web.DebugModule, 
Mono.Web" />
+               </httpModules>
+       </system.web>
+</configuration>


Property changes on: trunk/gert/standalone/bug333686/Webv11.config
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug333686/Webv20.config
===================================================================
--- trunk/gert/standalone/bug333686/Webv20.config       2007-10-15 08:17:12 UTC 
(rev 87478)
+++ trunk/gert/standalone/bug333686/Webv20.config       2007-10-15 08:17:49 UTC 
(rev 87479)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<configuration>
+       <system.web>
+               <httpModules>
+                       <add name="TestModule" type="Mono.Web.TestModule" />
+                       <add name="DebugModule" type="Mono.Web.DebugModule" />
+               </httpModules>
+       </system.web>
+</configuration>


Property changes on: trunk/gert/standalone/bug333686/Webv20.config
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug333686/default.build
===================================================================
--- trunk/gert/standalone/bug333686/default.build       2007-10-15 08:17:12 UTC 
(rev 87478)
+++ trunk/gert/standalone/bug333686/default.build       2007-10-15 08:17:49 UTC 
(rev 87479)
@@ -0,0 +1,77 @@
+<project name="bug333686" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+               <property name="web.config" value="Webv11.config" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+               <property name="web.config" value="Webv20.config" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+               <property name="web.config" value="Webv11.config" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+               <property name="web.config" value="Webv20.config" />
+       </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="web/Web.config" />
+                               <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/Mono.Web.dll" warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="DebugModule.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">
+               <copy file="${web.config}" tofile="web/Web.config" />
+               <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/bug333686/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug333686/test.cs
===================================================================
--- trunk/gert/standalone/bug333686/test.cs     2007-10-15 08:17:12 UTC (rev 
87478)
+++ trunk/gert/standalone/bug333686/test.cs     2007-10-15 08:17:49 UTC (rev 
87479)
@@ -0,0 +1,67 @@
+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 ()
+       {
+               TinyHost h = CreateHost ();
+               StringWriter sw = new StringWriter ();
+               h.Execute ("Default.aspx", sw);
+               string result = sw.ToString ();
+
+               int index1 = result.IndexOf ("<h1>Begin TestModule</h1>");
+               if (index1 == -1) {
+                       Console.WriteLine (result);
+                       return 1;
+               }
+
+               int index2 = result.IndexOf ("<h1>Begin DebugModule</h1>");
+               if (index2 == -1 || index2 <= index1) {
+                       Console.WriteLine (result);
+                       return 2;
+               }
+
+               int index3 = result.IndexOf ("<p>Hello!</p>");
+               if (index3 == -1 || index3 <= index2) {
+                       Console.WriteLine (result);
+                       return 3;
+               }
+
+               int index4 = result.IndexOf ("<h1>End TestModule</h1>");
+               if (index4 == -1 || index4 <= index3) {
+                       Console.WriteLine (result);
+                       return 4;
+               }
+
+               int index5 = result.IndexOf ("<h1>End DebugModule</h1>");
+               if (index5 == -1 || index5 <= index4) {
+                       Console.WriteLine (result);
+                       return 5;
+               }
+
+               return 0;
+       }
+}


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

Added: trunk/gert/standalone/bug333686/web/App_Code/Modules/TestModule.cs
===================================================================
--- trunk/gert/standalone/bug333686/web/App_Code/Modules/TestModule.cs  
2007-10-15 08:17:12 UTC (rev 87478)
+++ trunk/gert/standalone/bug333686/web/App_Code/Modules/TestModule.cs  
2007-10-15 08:17:49 UTC (rev 87479)
@@ -0,0 +1,32 @@
+using System;
+using System.Web;
+
+namespace Mono.Web
+{
+       public class TestModule : System.Web.IHttpModule
+       {
+               public void Init (HttpApplication application)
+               {
+                       application.BeginRequest += new EventHandler 
(Application_BeginRequest);
+                       application.EndRequest += new EventHandler 
(Application_EndRequest);
+               }
+
+               public void Dispose ()
+               {
+               }
+
+               void Application_BeginRequest(Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication)source;
+                       HttpContext context = application.Context;
+                       context.Response.Write("<h1>Begin TestModule</h1>");
+               }
+
+               void Application_EndRequest (Object source, EventArgs e)
+               {
+                       HttpApplication application = (HttpApplication) source;
+                       HttpContext context = application.Context;
+                       context.Response.Write ("<h1>End TestModule</h1>");
+               }
+       }
+}


Property changes on: 
trunk/gert/standalone/bug333686/web/App_Code/Modules/TestModule.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug333686/web/Default.aspx
===================================================================
--- trunk/gert/standalone/bug333686/web/Default.aspx    2007-10-15 08:17:12 UTC 
(rev 87478)
+++ trunk/gert/standalone/bug333686/web/Default.aspx    2007-10-15 08:17:49 UTC 
(rev 87479)
@@ -0,0 +1,8 @@
+<%@ Page Language="C#"%>
+<html>
+       <body>
+               <form runat="server">
+                       <p>Hello!</p>
+               </form>
+       </body>
+</html>
\ No newline at end of file


Property changes on: trunk/gert/standalone/bug333686/web/Default.aspx
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2007-10-15 08:17:12 UTC (rev 87478)
+++ trunk/gert/standalone/known-issues  2007-10-15 08:17:49 UTC (rev 87479)
@@ -91,3 +91,4 @@
 bug332206/**
 bug332409/**
 bug333342/**
+bug333686/**

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

Reply via email to