Author: gert
Date: 2007-10-18 13:13:15 -0400 (Thu, 18 Oct 2007)
New Revision: 87771
Modified:
trunk/gert/standalone/bug81174/default.build
trunk/gert/standalone/bug81174/test.cs
Log:
Use XSP instead of hosting the ASP.NET runtime ourselves.
Modified: trunk/gert/standalone/bug81174/default.build
===================================================================
--- trunk/gert/standalone/bug81174/default.build 2007-10-18 17:12:22 UTC
(rev 87770)
+++ trunk/gert/standalone/bug81174/default.build 2007-10-18 17:13:15 UTC
(rev 87771)
@@ -1,20 +1,22 @@
<project name="bug81174" default="rebuild">
<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.package" value="xsp-2" />
</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="xsp.package" value="xsp-2" />
</target>
<property name="frameworks" value="mono-2.0,net-2.0" />
-
+
<target name="clean">
<delete>
<fileset>
+ <include name="web/bin/**" />
<include name="out" />
<include name="test.exe" />
- <include name="web/bin/**" />
</fileset>
</delete>
</target>
@@ -46,8 +48,17 @@
</target>
<target name="run" depends="compile">
+ <exec
program="${pkg-config::get-variable(xsp.package,'Executable')}" managed="true"
spawn="true" pidproperty="server.pid">
+ <arg value="--root" />
+ <arg dir="web" />
+ <arg value="--port" />
+ <arg value="8081" />
+ </exec>
+ <sleep milliseconds="1000" />
<exec program="test.exe" managed="true" output="out" />
<fail if="${file::exists('out')}" />
+ <kill pid="${server.pid}" />
+ <sleep milliseconds="1000" />
</target>
<target name="rebuild" depends="clean, build" />
Modified: trunk/gert/standalone/bug81174/test.cs
===================================================================
--- trunk/gert/standalone/bug81174/test.cs 2007-10-18 17:12:22 UTC (rev
87770)
+++ trunk/gert/standalone/bug81174/test.cs 2007-10-18 17:13:15 UTC (rev
87771)
@@ -1,68 +1,62 @@
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 ()
+ static int Main ()
{
- string path = Path.Combine
(AppDomain.CurrentDomain.BaseDirectory, "web");
- string bin = Path.Combine (path, "bin");
- string asm = Path.GetFileName (typeof
(TinyHost).Assembly.Location);
+ HttpWebRequest request = (HttpWebRequest) WebRequest.Create
("http://localhost:8081/Create.aspx");
+ request.Method = "GET";
- Directory.CreateDirectory (bin);
- File.Copy (asm, Path.Combine (bin, asm), true);
+ HttpWebResponse response = (HttpWebResponse)
request.GetResponse ();
+ using (StreamReader sr = new StreamReader
(response.GetResponseStream (), Encoding.UTF8, true)) {
+ string result = sr.ReadToEnd ();
+ if (result.IndexOf ("Een titel") == -1) {
+ Console.WriteLine (result);
+ return 1;
+ }
+ if (result.IndexOf ("Hoofding") == -1) {
+ Console.WriteLine (result);
+ return 2;
+ }
+ }
+ response.Close ();
- return (TinyHost) ApplicationHost.CreateApplicationHost (
- typeof (TinyHost), "/", path);
- }
+ request = (HttpWebRequest) WebRequest.Create
("http://localhost:8081/Default.aspx");
+ request.Method = "GET";
- 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 ("Create.aspx", sw);
- string result = sw.ToString ();
- if (result.IndexOf ("Een titel") == -1) {
- Console.WriteLine (result);
- return 1;
+ response = (HttpWebResponse) request.GetResponse ();
+ using (StreamReader sr = new StreamReader
(response.GetResponseStream (), Encoding.UTF8, true)) {
+ string result = sr.ReadToEnd ();
+ if (result.IndexOf ("Noot") == -1) {
+ Console.WriteLine (result);
+ return 3;
+ }
+ if (result.IndexOf ("Inhoudstafel") == -1) {
+ Console.WriteLine (result);
+ return 4;
+ }
}
- if (result.IndexOf ("Hoofding") == -1) {
- Console.WriteLine (result);
- return 2;
- }
+ response.Close ();
- sw.GetStringBuilder ().Length = 0;
- h.Execute ("Default.aspx", sw);
- result = sw.ToString ();
- if (result.IndexOf ("Noot") == -1) {
- Console.WriteLine (result);
- return 3;
- }
- if (result.IndexOf ("Inhoudstafel") == -1) {
- Console.WriteLine (result);
- return 4;
- }
+ request = (HttpWebRequest) WebRequest.Create
("http://localhost:8081/Sub/Default.aspx");
+ request.Method = "GET";
- sw.GetStringBuilder ().Length = 0;
- h.Execute ("Sub" + Path.DirectorySeparatorChar +
"Default.aspx", sw);
- result = sw.ToString ();
- if (result.IndexOf ("Noot") == -1) {
- Console.WriteLine (result);
- return 5;
+ response = (HttpWebResponse) request.GetResponse ();
+ using (StreamReader sr = new StreamReader
(response.GetResponseStream (), Encoding.UTF8, true)) {
+ string result = sr.ReadToEnd ();
+ if (result.IndexOf ("Noot") == -1) {
+ Console.WriteLine (result);
+ return 5;
+ }
+ if (result.IndexOf ("Inhoudsopgave") == -1) {
+ Console.WriteLine (result);
+ return 6;
+ }
}
- if (result.IndexOf ("Inhoudsopgave") == -1) {
- Console.WriteLine (result);
- return 6;
- }
+ response.Close ();
return 0;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches