Author: gert
Date: 2007-09-22 05:37:40 -0400 (Sat, 22 Sep 2007)
New Revision: 86199

Modified:
   trunk/gert/standalone/bug67892/default.build
   trunk/gert/standalone/bug67892/test.cs
Log:
Use xsp instead of hosting ASP.NET runtime.


Modified: trunk/gert/standalone/bug67892/default.build
===================================================================
--- trunk/gert/standalone/bug67892/default.build        2007-09-22 09:21:27 UTC 
(rev 86198)
+++ trunk/gert/standalone/bug67892/default.build        2007-09-22 09:37:40 UTC 
(rev 86199)
@@ -1,10 +1,16 @@
 <project name="bug67892" default="rebuild">
        <target name="mono-1.0">
                <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+               <property name="xsp.executable" value="xsp.exe" />
        </target>
 
-       <property name="frameworks" value="mono-1.0" />
+       <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="xsp.executable" value="xsp2.exe" />
+       </target>
 
+       <property name="frameworks" value="mono-1.0,mono-2.0" />
+
        <target name="clean">
                <delete>
                        <fileset>
@@ -50,9 +56,16 @@
                </csc>
        </target>
 
-       <target name="run" depends="compile">
+       <target name="run" depends="compile" if="${platform::is-unix()}">
+               <exec 
program="${framework::get-assembly-directory(framework::get-target-framework())}/${xsp.executable}"
 managed="true" spawn="true" pidproperty="server.pid">
+                       <arg value="--root" />
+                       <arg dir="web" />
+                       <arg value="--port" />
+                       <arg value="8081" />
+               </exec>
                <exec program="test.exe" managed="true" output="out" />
                <fail if="${file::exists('out')}" />
+               <kill pid="${server.pid}" />
        </target>
 
        <target name="rebuild" depends="clean, build" />

Modified: trunk/gert/standalone/bug67892/test.cs
===================================================================
--- trunk/gert/standalone/bug67892/test.cs      2007-09-22 09:21:27 UTC (rev 
86198)
+++ trunk/gert/standalone/bug67892/test.cs      2007-09-22 09:37:40 UTC (rev 
86199)
@@ -1,41 +1,25 @@
 using System;
 using System.IO;
-using System.Web;
-using System.Web.Hosting;
+using System.Net;
+using System.Text;
 
-class TinyHost : MarshalByRefObject
+class Program
 {
-       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 ();
+               HttpWebRequest request = (HttpWebRequest) WebRequest.Create 
("http://localhost:8081/albums/3.aspx";);
+               request.Method = "GET";
 
-               h.Execute ("albums" + Path.DirectorySeparatorChar + "3.aspx", 
sw);
-               string result = sw.ToString ();
-               if (result.IndexOf ("<title>albumListing</title>") == -1) {
-                       Console.WriteLine (result);
-                       return 1;
+               HttpWebResponse response = (HttpWebResponse) 
request.GetResponse ();
+               using (StreamReader sr = new StreamReader 
(response.GetResponseStream (), Encoding.UTF8, true)) {
+                       string result = sr.ReadToEnd ();
+                       if (result.IndexOf ("<title>albumListing</title>") == 
-1) {
+                               Console.WriteLine (result);
+                               return 1;
+                       }
                }
+               response.Close ();
+
                return 0;
        }
 }

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

Reply via email to