Author: gert
Date: 2007-10-31 06:09:19 -0500 (Wed, 31 Oct 2007)
New Revision: 88549
Added:
trunk/gert/standalone/bug324256/
trunk/gert/standalone/bug324256/default.build
trunk/gert/standalone/bug324256/test.cs
trunk/gert/standalone/bug324256/web/
trunk/gert/standalone/bug324256/web/Service.asmx
trunk/gert/standalone/bug324256/web/Service.asmx.cs
Log:
Added test for bug #324256.
Added: trunk/gert/standalone/bug324256/default.build
===================================================================
--- trunk/gert/standalone/bug324256/default.build 2007-10-31 11:08:29 UTC
(rev 88548)
+++ trunk/gert/standalone/bug324256/default.build 2007-10-31 11:09:19 UTC
(rev 88549)
@@ -0,0 +1,106 @@
+<project name="bug324256" default="rebuild">
+ <target name="mono-1.0">
+ <property name="csc.defines"
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+ <property name="wsdl.tool"
value="${framework::get-sdk-directory(framework::get-target-framework())}/wsdl.exe"
/>
+ <property name="xsp.package" value="xsp" />
+ </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="wsdl.tool"
value="${framework::get-assembly-directory(framework::get-target-framework())}/wsdl.exe"
/>
+ <property name="xsp.package" value="xsp-2" />
+ </target>
+
+ <target name="net-1.1">
+ <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+ <property name="wsdl.tool"
value="${framework::get-sdk-directory(framework::get-target-framework())}/wsdl.exe"
/>
+ <property name="xsp.package" value="xsp" />
+ </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="wsdl.tool"
value="${framework::get-sdk-directory(framework::get-target-framework())}/wsdl.exe"
/>
+ <property name="xsp.package" value="xsp-2" />
+ </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="Service.cs" />
+ <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">
+ <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" />
+
+ <mkdir dir="web/bin" />
+ <csc target="library" define="${csc.defines}"
output="web/bin/Mono.Web.dll" warnaserror="true" warninglevel="4">
+ <sources basedir="web">
+ <include name="**/*.cs" />
+ </sources>
+ <references>
+ <include name="System.Web.Services.dll" />
+ </references>
+ </csc>
+ <exec program="${wsdl.tool}">
+ <arg value="http://127.0.0.1:8081/Service.asmx?WSDL" />
+ <arg value="/nologo" />
+ </exec>
+ <csc target="exe" define="${csc.defines}" output="test.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="../../build/common/Assert.cs" />
+ <include name="test.cs" />
+ <include name="Service.cs" />
+ </sources>
+ <references>
+ <include name="System.Web.Services.dll" />
+ </references>
+ </csc>
+
+ <kill pid="${server.pid}" />
+ <sleep milliseconds="1000" />
+ </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" />
+</project>
Property changes on: trunk/gert/standalone/bug324256/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug324256/test.cs
===================================================================
--- trunk/gert/standalone/bug324256/test.cs 2007-10-31 11:08:29 UTC (rev
88548)
+++ trunk/gert/standalone/bug324256/test.cs 2007-10-31 11:09:19 UTC (rev
88549)
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.Net;
+
+class Program
+{
+ static int Main ()
+ {
+ Service svc = new Service ();
+ Assert.AreEqual (1, svc.GetSessionCounter (), "#A2");
+ Assert.AreEqual (1, svc.GetSessionCounter (), "#A1");
+ Assert.AreEqual (1, svc.GetSessionCounter (), "#A2");
+ Assert.AreEqual (1, svc.GetApplicationCounter (), "#A3");
+ Assert.AreEqual (2, svc.GetApplicationCounter (), "#A4");
+ Assert.IsTrue (svc.HasApplication (), "#A5");
+ Assert.IsFalse (svc.HasSession (), "#A6");
+
+ svc = new Service ();
+ svc.CookieContainer = new CookieContainer ();
+ Assert.AreEqual (1, svc.GetSessionCounter (), "#B1");
+ Assert.AreEqual (2, svc.GetSessionCounter (), "#B2");
+ Assert.AreEqual (3, svc.GetApplicationCounter (), "#B3");
+ Assert.AreEqual (4, svc.GetApplicationCounter (), "#B4");
+ Assert.IsTrue (svc.HasApplication (), "#B5");
+ Assert.IsFalse (svc.HasSession (), "#B6");
+
+ return 0;
+ }
+}
Property changes on: trunk/gert/standalone/bug324256/test.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug324256/web/Service.asmx
===================================================================
--- trunk/gert/standalone/bug324256/web/Service.asmx 2007-10-31 11:08:29 UTC
(rev 88548)
+++ trunk/gert/standalone/bug324256/web/Service.asmx 2007-10-31 11:09:19 UTC
(rev 88549)
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="Service.asmx.cs" Class="Service" %>
Added: trunk/gert/standalone/bug324256/web/Service.asmx.cs
===================================================================
--- trunk/gert/standalone/bug324256/web/Service.asmx.cs 2007-10-31 11:08:29 UTC
(rev 88548)
+++ trunk/gert/standalone/bug324256/web/Service.asmx.cs 2007-10-31 11:09:19 UTC
(rev 88549)
@@ -0,0 +1,51 @@
+using System;
+using System.Web;
+using System.Web.Services;
+using System.Web.Services.Protocols;
+
+[WebService (Namespace = "http://tempuri.org/")]
+#if NET_2_0
+[WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)]
+#endif
+public class Service : WebService
+{
+ [WebMethod (EnableSession=true)]
+ public int GetSessionCounter ()
+ {
+ object val = Session ["Counter"];
+ if (val == null) {
+ Session ["Counter"] = 1;
+ return 1;
+ } else {
+ int counter = ((int) val) + 1;
+ Session ["Counter"] = counter;
+ return counter;
+ }
+ }
+
+ [WebMethod]
+ public int GetApplicationCounter ()
+ {
+ object val = Application ["Counter"];
+ if (val == null) {
+ Application ["Counter"] = 1;
+ return 1;
+ } else {
+ int counter = ((int) val) + 1;
+ Application ["Counter"] = counter;
+ return counter;
+ }
+ }
+
+ [WebMethod]
+ public bool HasApplication ()
+ {
+ return Application != null;
+ }
+
+ [WebMethod]
+ public bool HasSession ()
+ {
+ return Session != null;
+ }
+}
Property changes on: trunk/gert/standalone/bug324256/web/Service.asmx.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches