public override void run(string[] args) { bool async = args.Any(v => v.Equals("--async")); using var communicator = initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); if (async) { adapter.AddDefault(new BlobjectAsyncI()); } else { adapter.AddDefault(new BlobjectI()); } adapter.Activate(); serverReady(); communicator.WaitForShutdown(); }
public override void Run(string[] args) { using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new Servant()); adapter.Activate(); ServerReady(); adapter.WaitForDeactivate(); }
public override void run(string[] args) { using var communicator = initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new BlobjectI()); adapter.Activate(); serverReady(); communicator.WaitForShutdown(); }
public override async Task RunAsync(string[] args) { await using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new Servant()); AllTests.allTests(this); }
public override async Task RunAsync(string[] args) { await using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new BlobjectI()); await adapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override void Run(string[] args) { using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); var blob = new BlobjectI(); adapter.AddDefault(blob); adapter.Add("__echo", new Echo()); adapter.Activate(); communicator.WaitForShutdown(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new Servant()); await AllTests.RunAsync(this); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new Servant()); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override void Run(string[] args) { using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); // 2 threads are necessary to dispatch the collocated transient() call with AMI communicator.SetProperty("TestAdapter.ThreadPool.Size", "2"); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.AddDefault(new Servant()); AllTests.allTests(this); adapter.WaitForDeactivate(); }
Run(TestHelper helper) { TextWriter output = helper.GetWriter(); Communicator?communicator = helper.Communicator(); TestHelper.Assert(communicator != null); ObjectAdapter oa = communicator.CreateObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.Activate(); output.Write("testing single category... "); output.Flush(); var servant = new MyObject(); oa.AddDefaultForCategory("foo", servant); try { oa.AddDefaultForCategory("foo", new MyObject()); TestHelper.Assert(false); // duplicate registration not allowed } catch (System.ArgumentException) { // Expected } IObject?r = oa.Find("foo"); TestHelper.Assert(r == null); r = oa.Find("foo/someId"); TestHelper.Assert(r == servant); r = oa.Find("bar/someId"); TestHelper.Assert(r == null); var identity = new Identity("", "foo"); string[] names = new string[] { "foo", "bar", "x", "y", "abcdefg" }; IMyObjectPrx?prx = null; for (int idx = 0; idx < 5; ++idx) { identity = new Identity(names[idx], identity.Category); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); prx.IcePing(); TestHelper.Assert(prx.GetName() == names[idx]); } identity = new Identity("ObjectNotExist", identity.Category); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); try { prx.IcePing(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } try { prx.GetName(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } identity = new Identity(identity.Name, "bar"); for (int idx = 0; idx < 5; idx++) { identity = new Identity(names[idx], identity.Category); prx = oa.CreateProxy(identity, Test.IMyObjectPrx.Factory); try { prx.IcePing(); TestHelper.Assert(false); } catch (Ice.ObjectNotExistException) { // Expected } try { prx.GetName(); TestHelper.Assert(false); } catch (Ice.ObjectNotExistException) { // Expected } } IObject?removed = oa.RemoveDefaultForCategory("foo"); TestHelper.Assert(removed == servant); removed = oa.RemoveDefaultForCategory("foo"); TestHelper.Assert(removed == null); identity = new Identity(identity.Name, "foo"); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); try { prx.IcePing(); } catch (ObjectNotExistException) { // Expected } output.WriteLine("ok"); output.Write("testing default servant... "); output.Flush(); var defaultServant = new MyObject(); oa.AddDefault(defaultServant); try { oa.AddDefault(servant); TestHelper.Assert(false); } catch (System.ArgumentException) { // Expected } oa.AddDefaultForCategory("", servant); // associated with empty category r = oa.Find("bar"); TestHelper.Assert(r == servant); r = oa.Find("x/y"); TestHelper.Assert(r == defaultServant); for (int idx = 0; idx < 5; ++idx) { identity = new Identity(names[idx], ""); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); prx.IcePing(); TestHelper.Assert(prx.GetName() == names[idx]); } removed = oa.RemoveDefault(); TestHelper.Assert(removed == defaultServant); removed = oa.RemoveDefault(); TestHelper.Assert(removed == null); output.WriteLine("ok"); }
public static async Task RunAsync(TestHelper helper) { TextWriter output = helper.Output; Communicator?communicator = helper.Communicator; TestHelper.Assert(communicator != null); ObjectAdapter oa = communicator.CreateObjectAdapterWithEndpoints("MyOA", helper.GetTestEndpoint(ephemeral: true)); await oa.ActivateAsync(); output.Write("testing single category... "); output.Flush(); var servant = new MyObject(); oa.AddDefaultForCategory("foo", servant); try { oa.AddDefaultForCategory("foo", new MyObject()); TestHelper.Assert(false); // duplicate registration not allowed } catch (ArgumentException) { // Expected } IObject?r = oa.Find("foo"); TestHelper.Assert(r == null); r = oa.Find("foo/someId"); TestHelper.Assert(r == servant); r = oa.Find("bar/someId"); TestHelper.Assert(r == null); var identity = new Identity("", "foo"); string[] names = new string[] { "foo", "bar", "x", "y", "abcdefg" }; IMyObjectPrx?prx = null; foreach (string name in names) { identity = new Identity(name, identity.Category); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); prx.IcePing(); TestHelper.Assert(prx.GetName() == name); } identity = new Identity("ObjectNotExist", identity.Category); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); try { prx.IcePing(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } try { prx.GetName(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } identity = new Identity(identity.Name, "bar"); foreach (string name in names) { identity = new Identity(name, identity.Category); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); try { prx.IcePing(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } try { prx.GetName(); TestHelper.Assert(false); } catch (ObjectNotExistException) { // Expected } } IObject?removed = oa.RemoveDefaultForCategory("foo"); TestHelper.Assert(removed == servant); removed = oa.RemoveDefaultForCategory("foo"); TestHelper.Assert(removed == null); identity = new Identity(identity.Name, "foo"); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); try { prx.IcePing(); } catch (ObjectNotExistException) { // Expected } output.WriteLine("ok"); output.Write("testing default servant... "); output.Flush(); var defaultServant = new MyObject(); oa.AddDefault(defaultServant); try { oa.AddDefault(servant); TestHelper.Assert(false); } catch (ArgumentException) { // Expected } oa.AddDefaultForCategory("", servant); // associated with empty category r = oa.Find("bar"); TestHelper.Assert(r == servant); r = oa.Find("x/y"); TestHelper.Assert(r == defaultServant); foreach (string name in names) { identity = new Identity(name, ""); prx = oa.CreateProxy(identity, IMyObjectPrx.Factory); prx.IcePing(); TestHelper.Assert(prx.GetName() == name); } removed = oa.RemoveDefault(); TestHelper.Assert(removed == defaultServant); removed = oa.RemoveDefault(); TestHelper.Assert(removed == null); output.WriteLine("ok"); }