X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fremoting4.cs;h=cdb93be4d2f425c4125d94579336641ab270ccde;hb=27c75551acc59bf81c6928577dbd86e3809e28de;hp=7eb6a48fbe1a056886589cd88196022a0b374c59;hpb=7da3e9a1bfc4c3141b88f0de7f98fb1d3c41a2ba;p=mono.git diff --git a/mono/tests/remoting4.cs b/mono/tests/remoting4.cs old mode 100755 new mode 100644 index 7eb6a48fbe1..cdb93be4d2f --- a/mono/tests/remoting4.cs +++ b/mono/tests/remoting4.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Runtime.InteropServices; using System.Runtime.Remoting; @@ -6,25 +6,25 @@ using System.Runtime.Remoting.Messaging; using System.Runtime.Remoting.Proxies; using System.Runtime.Remoting.Channels; using System.Runtime.Serialization; - -namespace RemotingTest -{ - class MyProxy : RealProxy + +namespace RemotingTest +{ + class MyProxy : RealProxy { readonly MarshalByRefObject target; - public MyProxy (MarshalByRefObject target) : base (target.GetType()) + public MyProxy (MarshalByRefObject target) : base (target.GetType()) { this.target = target; } - public override IMessage Invoke (IMessage request) + public override IMessage Invoke (IMessage request) { IMethodCallMessage call = (IMethodCallMessage)request; Console.WriteLine ("Invoke " + call.MethodName); Console.Write ("ARGS("); - for (int i = 0; i < call.ArgCount; i++) + for (int i = 0; i < call.ArgCount; i++) { if (i != 0) Console.Write (", "); @@ -33,7 +33,7 @@ namespace RemotingTest } Console.WriteLine (")"); Console.Write ("INARGS("); - for (int i = 0; i < call.InArgCount; i++) + for (int i = 0; i < call.InArgCount; i++) { if (i != 0) Console.Write (", "); @@ -45,7 +45,7 @@ namespace RemotingTest IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call); Console.Write ("RESARGS("); - for (int i = 0; i < res.ArgCount; i++) + for (int i = 0; i < res.ArgCount; i++) { if (i != 0) Console.Write (", "); @@ -55,7 +55,7 @@ namespace RemotingTest Console.WriteLine (")"); Console.Write ("RESOUTARGS("); - for (int i = 0; i < res.OutArgCount; i++) + for (int i = 0; i < res.OutArgCount; i++) { if (i != 0) Console.Write (", "); @@ -68,57 +68,57 @@ namespace RemotingTest } } - class R2 + class R2 { string sTest; - public R2() + public R2() { sTest = "R2"; } - public void Print() + public void Print() { Console.WriteLine(sTest); } } [Serializable] - class R2_MBV + class R2_MBV { string sTest; - public R2_MBV() + public R2_MBV() { sTest = "R2"; } - public string Data - { - get + public string Data + { + get { return sTest; - } + } + } + } + + class R1 : MarshalByRefObject + { + public R2 TestMBV() { + return new R2(); } } - - class R1 : MarshalByRefObject + + class Class1 { - public R2 TestMBV() { - return new R2(); - } - } - - class Class1 - { - static int Main(string[] args) - { - Console.WriteLine("test " + AppDomain.CurrentDomain.FriendlyName); - AppDomain app2 = AppDomain.CreateDomain("2"); - + static int Main(string[] args) + { + Console.WriteLine("test " + AppDomain.CurrentDomain.FriendlyName); + AppDomain app2 = AppDomain.CreateDomain("2"); + if (!RemotingServices.IsTransparentProxy(app2)) return 1; - ObjectHandle o = AppDomain.CurrentDomain.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName); - R1 myobj = (R1) o.Unwrap(); + ObjectHandle o = AppDomain.CurrentDomain.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName); + R1 myobj = (R1) o.Unwrap(); // should not be a proxy in our domain.. if (RemotingServices.IsTransparentProxy(myobj)) @@ -127,15 +127,15 @@ namespace RemotingTest return 2; } - o = app2.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName); - - Console.WriteLine("type: " + o.GetType().ToString()); + o = app2.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName); + + Console.WriteLine("type: " + o.GetType().ToString()); - myobj = (R1) o.Unwrap(); + myobj = (R1) o.Unwrap(); if (!RemotingServices.IsTransparentProxy(myobj)) return 3; - - Console.WriteLine("unwrapped type: " + myobj.GetType().ToString()); + + Console.WriteLine("unwrapped type: " + myobj.GetType().ToString()); R2 r2 = null; bool bSerExc = false; @@ -152,9 +152,9 @@ namespace RemotingTest if (!bSerExc) return 4; - + Console.WriteLine("test-ok"); return 0; - } - } -} + } + } +}