From: Robert Jordan Date: Sun, 24 May 2009 12:46:29 +0000 (-0000) Subject: 2009-05-24 Robert Jordan X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=86da8ea29dae6194c89844557a9d16b5afbd4ae1;p=mono.git 2009-05-24 Robert Jordan * GenericTest.cs (TestTcpChannel): create a unique channel and unregister it upon termination. Fixes issues that were uncovered by the NUnit upgrade (see Atsushi's changelogs below). svn path=/trunk/mcs/; revision=134646 --- diff --git a/mcs/class/System.Runtime.Remoting/Test/ChangeLog b/mcs/class/System.Runtime.Remoting/Test/ChangeLog index 2f3514c2377..6bb5cc50ecf 100644 --- a/mcs/class/System.Runtime.Remoting/Test/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/Test/ChangeLog @@ -1,3 +1,9 @@ +2009-05-24 Robert Jordan + + * GenericTest.cs (TestTcpChannel): create a unique channel and + unregister it upon termination. Fixes issues that were uncovered + by the NUnit upgrade (see Atsushi's changelogs below). + 2009-01-07 Atsushi Enomoto * RemotingServicesTest.cs : mark failing test as NotWorking, and diff --git a/mcs/class/System.Runtime.Remoting/Test/GenericTest.cs b/mcs/class/System.Runtime.Remoting/Test/GenericTest.cs index 8488a8df146..6d8ed0e2b0a 100644 --- a/mcs/class/System.Runtime.Remoting/Test/GenericTest.cs +++ b/mcs/class/System.Runtime.Remoting/Test/GenericTest.cs @@ -8,6 +8,7 @@ #if NET_2_0 using System; +using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; @@ -155,30 +156,43 @@ namespace MonoTests.Remoting [Test] public void TestCrossAppDomainChannel () { - RunTests (GetRemObject > ()); + RunTests (RegisterAndConnect > ()); } [Test] - [Ignore ("disabled as it got not working by NUnit upgrade to 2.4.8 (applies to .NET too)")] public void TestTcpChannel () { - RunTests (GetRemObjectTcp > ()); + IDictionary props = new Hashtable (); + props ["name"] = Guid.NewGuid ().ToString("N"); + props ["port"] = 18191; + TcpChannel chan = new TcpChannel (props, null, null); + ChannelServices.RegisterChannel (chan); + + try { + Register > ("gentcptest.rem"); + RunTests (Connect > ("tcp://localhost:18191/gentcptest.rem")); + } finally { + ChannelServices.UnregisterChannel (chan); + } } - static T GetRemObject () where T: MarshalByRefObject + static T RegisterAndConnect () where T: MarshalByRefObject { - AppDomain d = BaseCallTest.CreateDomain ("Foo"); + AppDomain d = BaseCallTest.CreateDomain ("GenericTests"); return (T) d.CreateInstanceAndUnwrap ( typeof (T).Assembly.FullName, typeof (T).FullName); } - static T GetRemObjectTcp () where T: MarshalByRefObject + static void Register (string uri) where T: MarshalByRefObject { - new TcpChannel (18191); object obj = Activator.CreateInstance (typeof(T)); - RemotingServices.Marshal ((MarshalByRefObject)obj, "test.rem"); - return (T) RemotingServices.Connect (typeof (T), "tcp://localhost:18191/test.rem"); + RemotingServices.Marshal ((MarshalByRefObject)obj, uri); + } + + static T Connect (string uri) where T: MarshalByRefObject + { + return (T) RemotingServices.Connect (typeof (T), uri); } static void RunTests (ServerBase rem)