Author: gert
Date: 2008-01-12 03:21:23 -0500 (Sat, 12 Jan 2008)
New Revision: 92721

Added:
   trunk/gert/standalone/bug353491/
   trunk/gert/standalone/bug353491/Client.cs
   trunk/gert/standalone/bug353491/Server.cs
   trunk/gert/standalone/bug353491/Shared.cs
   trunk/gert/standalone/bug353491/default.build
Log:
Added test for bug #353491.


Added: trunk/gert/standalone/bug353491/Client.cs
===================================================================
--- trunk/gert/standalone/bug353491/Client.cs   2008-01-12 08:09:55 UTC (rev 
92720)
+++ trunk/gert/standalone/bug353491/Client.cs   2008-01-12 08:21:23 UTC (rev 
92721)
@@ -0,0 +1,27 @@
+using System;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using Trac79.Shared;
+
+namespace Trac79.Client
+{
+       internal class Program
+       {
+               static int Main ()
+               {
+                       TcpClientChannel channel = new TcpClientChannel ();
+#if NET_2_0
+                       ChannelServices.RegisterChannel (channel, false);
+#else
+                       ChannelServices.RegisterChannel (channel);
+#endif
+                       IRemoteObject target = (IRemoteObject) 
Activator.GetObject (
+                               typeof (IRemoteObject),
+                               "tcp://localhost:7777/remote-object"
+                       );
+                       if (target.DoIt () != 2)
+                               return 1;
+                       return 0;
+               }
+       }
+}


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

Added: trunk/gert/standalone/bug353491/Server.cs
===================================================================
--- trunk/gert/standalone/bug353491/Server.cs   2008-01-12 08:09:55 UTC (rev 
92720)
+++ trunk/gert/standalone/bug353491/Server.cs   2008-01-12 08:21:23 UTC (rev 
92721)
@@ -0,0 +1,44 @@
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using Trac79.Shared;
+
+namespace Trac79.Server
+{
+       public sealed class RemoteObject : MarshalByRefObject, IRemoteObject
+       {
+               public RemoteObject ()
+               {
+               }
+
+               public int DoIt ()
+               {
+                       return 1;
+               }
+
+               int IRemoteObject.DoIt ()
+               {
+                       return 2;
+               }
+       }
+
+       internal class Program
+       {
+               static void Main ()
+               {
+                       TcpServerChannel channel = new TcpServerChannel (7777);
+#if NET_2_0
+                       ChannelServices.RegisterChannel (channel, false);
+#else
+                       ChannelServices.RegisterChannel (channel);
+#endif
+                       RemotingConfiguration.RegisterWellKnownServiceType (
+                               typeof (RemoteObject),
+                               "remote-object",
+                               WellKnownObjectMode.Singleton
+                       );
+                       Console.ReadLine ();
+               }
+       }
+}


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

Added: trunk/gert/standalone/bug353491/Shared.cs
===================================================================
--- trunk/gert/standalone/bug353491/Shared.cs   2008-01-12 08:09:55 UTC (rev 
92720)
+++ trunk/gert/standalone/bug353491/Shared.cs   2008-01-12 08:21:23 UTC (rev 
92721)
@@ -0,0 +1,9 @@
+using System;
+
+namespace Trac79.Shared
+{
+       public interface IRemoteObject
+       {
+               int DoIt ();
+       }
+}


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

Added: trunk/gert/standalone/bug353491/default.build
===================================================================
--- trunk/gert/standalone/bug353491/default.build       2008-01-12 08:09:55 UTC 
(rev 92720)
+++ trunk/gert/standalone/bug353491/default.build       2008-01-12 08:21:23 UTC 
(rev 92721)
@@ -0,0 +1,52 @@
+<project name="bug353491" default="rebuild">
+       <include buildfile="../../build/common.build" />
+       
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="Client.exe" />
+                               <include name="out" />
+                               <include name="Server.exe" />
+                               <include name="Shared.dll" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="compile" depends="init">
+               <csc target="library" define="${csc.defines}" 
output="Shared.dll" warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="Shared.cs" />
+                       </sources>
+               </csc>
+               <csc target="exe" define="${csc.defines}" output="Client.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="../../build/common/Assert.cs" />
+                               <include name="Client.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Runtime.Remoting.dll" />
+                               <include name="Shared.dll" />
+                       </references>
+               </csc>
+               <csc target="exe" define="${csc.defines}" output="Server.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="../../build/common/Assert.cs" />
+                               <include name="Server.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Runtime.Remoting.dll" />
+                               <include name="Shared.dll" />
+                       </references>
+               </csc>
+       </target>
+
+       <target name="run-test" depends="compile">
+               <exec program="Server.exe" managed="true" spawn="true" 
pidproperty="server.pid" />
+               <sleep milliseconds="1000" />
+               <exec program="Client.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+               <kill pid="${server.pid}" />
+       </target>
+</project>


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

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

Reply via email to