2008-09-17 Jeffrey Stedfast <fejj@novell.com>
authorJeffrey Stedfast <fejj@novell.com>
Wed, 17 Sep 2008 22:00:37 +0000 (22:00 -0000)
committerJeffrey Stedfast <fejj@novell.com>
Wed, 17 Sep 2008 22:00:37 +0000 (22:00 -0000)
* TcpChannelTest.cs: Changed the namespace to MonoTests.Remoting
like the other Remoting tests and added a client<->server
communication test. Throw in a ftp:// url for the url-parsing test
to make sure the parser returns null on that.

svn path=/trunk/mcs/; revision=113358

mcs/class/System.Runtime.Remoting/Test/System.Runtime.Remoting.Channels.Tcp/ChangeLog
mcs/class/System.Runtime.Remoting/Test/System.Runtime.Remoting.Channels.Tcp/TcpChannelTest.cs

index 1da7e08853148354449be78331e9e1169ff27dee..9309d79873de6edc944a7bf457131730d4a7a646 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-17  Jeffrey Stedfast  <fejj@novell.com>
+
+       * TcpChannelTest.cs: Changed the namespace to MonoTests.Remoting
+       like the other Remoting tests and added a client<->server
+       communication test. Throw in a ftp:// url for the url-parsing test
+       to make sure the parser returns null on that.
+
 2008-09-11  Jeffrey Stedfast  <fejj@novell.com>
 
        * TcpChannelTest.cs: Added TcpChannel.Parse() tests.
index 5e17946757b8e6948ce36f4c8b3d615b8ded0a4b..48ef148d00f4f6ccc7af4c7dd051fde5c25e7d26 100644 (file)
@@ -35,7 +35,7 @@ using System.Runtime.Remoting.Channels.Tcp;
 
 using NUnit.Framework;
 
-namespace MonoTests.System.Runtime.Remoting.Channels.Tcp
+namespace MonoTests.Remoting
 {
        [TestFixture]
        public class TcpChannelTest
@@ -69,7 +69,7 @@ namespace MonoTests.System.Runtime.Remoting.Channels.Tcp
                        Assert.AreEqual ("tcp://" + IPAddress.Loopback.ToString () + ":1236", ds.ChannelUris [0], "#A6");
 
                        ChannelServices.UnregisterChannel (chn);
-
+                       
                        chn = new TcpChannel ((IDictionary) null, null, null);
 
                        ChannelServices.RegisterChannel (chn);
@@ -100,6 +100,7 @@ namespace MonoTests.System.Runtime.Remoting.Channels.Tcp
                        new ParseURLTestCase ("tcp:", "tcp:", null),
                        new ParseURLTestCase ("tcp://", "tcp://", null),
                        new ParseURLTestCase ("tcp:localhost", null, null),
+                       new ParseURLTestCase ("ftp://localhost", null, null),
                        new ParseURLTestCase ("tcp://localhost", "tcp://localhost", null),
                        new ParseURLTestCase ("tCp://localhost", "tCp://localhost", null),
                        new ParseURLTestCase ("tcp://localhost:/", "tcp://localhost:", "/"),
@@ -133,5 +134,45 @@ namespace MonoTests.System.Runtime.Remoting.Channels.Tcp
                        {
                        }
                }
+               
+               TcpServerChannel GetServerChannel (string name, int port)
+               {
+                       TcpServerChannel serverChannel = new TcpServerChannel (name + "Server", port);
+                       ChannelServices.RegisterChannel (serverChannel);
+                       
+                       RemotingConfiguration.RegisterWellKnownServiceType (
+                               typeof (RemoteObject), "RemoteObject.rem", 
+                               WellKnownObjectMode.Singleton);
+                       
+                       return serverChannel;
+               }
+               
+               TcpClientChannel GetClientChannel (string name, string uri)
+               {
+                       TcpClientChannel clientChannel = new TcpClientChannel (name + "Client", null);
+                       ChannelServices.RegisterChannel (clientChannel);
+                       
+                       WellKnownClientTypeEntry remoteType = new WellKnownClientTypeEntry (
+                               typeof (RemoteObject), uri + "/RemoteObject.rem");
+                       RemotingConfiguration.RegisterWellKnownClientType (remoteType);
+                       
+                       return clientChannel;
+               }
+               
+               [Test]
+               [Category ("NotWorking")]  // seems to hang - "too many open files" ???
+               public void TestTcpRemoting ()
+               {
+                       TcpServerChannel serverChannel = GetServerChannel ("TcpRemotingTest", 9090);
+                       string uri = serverChannel.GetChannelUri ();
+                       
+                       Assert.IsNotNull (uri, "Server channel URI is null");
+                       
+                       TcpClientChannel clientChannel = GetClientChannel ("TcpRemotingTest", uri);
+                       
+                       RemoteObject remoteObject = new RemoteObject (); 
+                       
+                       Assert.IsTrue (remoteObject.ReturnOne () == 1, "Invoking RemoteObject.ReturnOne() failed");
+               }
        }
 }