public override async Task RunAsync(string[] args) { await using Communicator communicator = Initialize(ref args); await communicator.ActivateAsync(); int num = 0; try { num = int.Parse(args[0]); } catch (FormatException) { } communicator.SetProperty("ControlAdapter.Endpoints", GetTestEndpoint(num)); communicator.SetProperty("ControlAdapter.AdapterId", $"control{num}"); ObjectAdapter adapter = communicator.CreateObjectAdapter("ControlAdapter"); adapter.Add($"controller{num}", new Controller()); adapter.Add($"faceted-controller{num}#abc", new Controller()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("ServerManagerAdapter.Endpoints", GetTestEndpoint(0)); // Register the server manager. The server manager creates a new 'server'(a server isn't a different // process, it's just a new communicator and object adapter). ObjectAdapter adapter = Communicator.CreateObjectAdapter("ServerManagerAdapter"); // We also register a sample server locator which implements the locator interface, this locator is used by // the clients and the 'servers' created with the server manager interface. var registry = new ServerLocatorRegistry(); var obj = new ServerManager(registry, this); adapter.Add("ServerManager", obj); registry.AddObject(adapter.CreateProxy("ServerManager", IObjectPrx.Factory)); ILocatorRegistryPrx registryPrx = adapter.Add("registry", registry, ILocatorRegistryPrx.Factory); adapter.Add("locator", new ServerLocator(registry, registryPrx)); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override async Task RunAsync(string[] args) { Dictionary <string, string> properties = CreateTestProperties(ref args); properties["Ice.Default.Protocol"] = "ice1"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("CallbackAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("CallbackAdapter"); // The test allows "c1" as category. adapter.Add("c1/callback", new Callback()); // The test allows "c2" as category. adapter.Add("c2/callback", new Callback()); // The test rejects "c3" as category. adapter.Add("c3/callback", new Callback()); // // The test allows the prefixed userid. // adapter.Add("_userid/callback", new Callback()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { Dictionary <string, string> properties = CreateTestProperties(ref args); properties["Ice.Warn.Dispatch"] = "0"; properties["Ice.Warn.Connections"] = "0"; properties["Ice.MessageSizeMax"] = "10K"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); communicator.SetProperty("TestAdapter2.Endpoints", GetTestEndpoint(1)); communicator.SetProperty("TestAdapter2.MessageSizeMax", "0"); communicator.SetProperty("TestAdapter3.Endpoints", GetTestEndpoint(2)); communicator.SetProperty("TestAdapter3.MessageSizeMax", "1K"); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); ObjectAdapter adapter2 = communicator.CreateObjectAdapter("TestAdapter2"); ObjectAdapter adapter3 = communicator.CreateObjectAdapter("TestAdapter3"); var obj = new ThrowerAsync(); adapter.Add("thrower", obj); adapter2.Add("thrower", obj); adapter3.Add("thrower", obj); await adapter.ActivateAsync(); await adapter2.ActivateAsync(); await adapter3.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { // // Register the server manager. The server manager creates a new // 'server'(a server isn't a different process, it's just a new // communicator and object adapter). // Dictionary <string, string> properties = CreateTestProperties(ref args); await using Communicator communicator = Initialize(properties); communicator.SetProperty("ServerManagerAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("ServerManagerAdapter"); // // We also register a sample server locator which implements the // locator interface, this locator is used by the clients and the // 'servers' created with the server manager interface. // var registry = new ServerLocatorRegistry(); var obj = new ServerManager(registry, this); adapter.Add("ServerManager", obj); registry.AddObject(adapter.CreateProxy("ServerManager", IObjectPrx.Factory)); ILocatorRegistryPrx registryPrx = adapter.Add("registry", registry, ILocatorRegistryPrx.Factory); adapter.Add("locator", new ServerLocator(registry, registryPrx)); await adapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public async ValueTask <IRemoteObjectAdapterPrx> CreateObjectAdapterAsync( string name, string transport, Current current, CancellationToken cancel) { int retry = 5; while (true) { try { string endpoints = TestHelper.GetTestEndpoint(current.Communicator.GetProperties(), _nextPort++, transport); if (transport == "udp") { // udp endpoints are always non-secure. Set name.AcceptNonSecure = Always current.Communicator.SetProperty($"{name}.AcceptNonSecure", "Always"); } ObjectAdapter adapter = current.Communicator.CreateObjectAdapterWithEndpoints(name, endpoints); await adapter.ActivateAsync(cancel); return(current.Adapter.AddWithUUID(new RemoteObjectAdapter(adapter), IRemoteObjectAdapterPrx.Factory)); } catch (TransportException) { if (--retry == 0) { throw; } } } }
public override async Task RunAsync(string[] args) { System.Collections.Generic.Dictionary <string, string> properties = CreateTestProperties(ref args); // This test kills connections, so we don't want warnings. properties["Ice.Warn.Connections"] = "0"; // Limit the recv buffer size, this test relies on the socket send() blocking after sending a given amount // of data. properties["Ice.TCP.RcvSize"] = "50K"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); communicator.SetProperty("TestAdapter2.Endpoints", GetTestEndpoint(1)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("test", new TestIntf()); adapter.Add("test2", new TestIntf2()); await adapter.ActivateAsync(); ObjectAdapter adapter2 = communicator.CreateObjectAdapter("TestAdapter2", serializeDispatch: true); adapter2.Add("serialized", new TestIntf()); await adapter2.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); Communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1)); var schedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter", taskScheduler: schedulerPair.ExclusiveScheduler); adapter.Add("timeout", new Timeout()); adapter.DispatchInterceptors = ImmutableList.Create <DispatchInterceptor>( (request, current, next, cancel) => { if (current.Operation == "checkDeadline") { if (request.BinaryContext.TryGetValue(10, out ReadOnlyMemory <byte> value)) { current.Context["deadline"] = value.Read(istr => istr.ReadVarLong()).ToString(); } } return(next(request, current, cancel)); }); await adapter.ActivateAsync(); ObjectAdapter controllerAdapter = Communicator.CreateObjectAdapter("ControllerAdapter"); controllerAdapter.Add("controller", new Controller(schedulerPair.ExclusiveScheduler)); await controllerAdapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public void Start(string name, Communicator communicator, string[] args) { ObjectAdapter adapter = communicator.CreateObjectAdapter(name + "OA"); adapter.Add("test", new TestIntf(args)); adapter.ActivateAsync().GetAwaiter().GetResult(); // TODO: temporary }
public override async Task RunAsync(string[] args) { Dictionary <string, string>?properties = CreateTestProperties(ref args); // TODO: we currently force ice1 for this test because Ice.Default.Protocol is the only way to select // the protocol used by object adapters. Once this is fixed, we should run this test with both ice1 and // ice2, and use only ice1 for the udp object adapter. properties["Ice.Default.Protocol"] = "ice1"; await using Communicator communicator = Initialize(properties); int num = 0; try { num = int.Parse(args[0]); } catch (FormatException) { } communicator.SetProperty("ControlAdapter.Endpoints", GetTestEndpoint(num)); communicator.SetProperty("ControlAdapter.AdapterId", $"control{num}"); ObjectAdapter adapter = communicator.CreateObjectAdapter("ControlAdapter"); adapter.Add($"controller{num}", new Controller()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapterForwarder.Endpoints", GetTestEndpoint(0)); if (Protocol == Protocol.Ice1) { communicator.SetProperty("TestAdapterSame.Endpoints", $"{Transport} -h localhost"); communicator.SetProperty("TestAdapterOther.Endpoints", $"ice+{Transport}://localhost:0"); } else { communicator.SetProperty("TestAdapterSame.Endpoints", $"ice+{Transport}://localhost:0"); communicator.SetProperty("TestAdapterOther.Endpoints", $"{Transport} -h localhost"); } ObjectAdapter adapterForwarder = communicator.CreateObjectAdapter("TestAdapterForwarder"); ObjectAdapter adapterSame = communicator.CreateObjectAdapter("TestAdapterSame"); ObjectAdapter adapterOther = communicator.CreateObjectAdapter("TestAdapterOther"); ITestIntfPrx samePrx = adapterSame.Add("TestSame", new TestI(), ITestIntfPrx.Factory); ITestIntfPrx otherPrx = adapterOther.Add("TestOther", new TestI(), ITestIntfPrx.Factory); adapterForwarder.Add("ForwardSame", new Forwarder(samePrx)); adapterForwarder.Add("ForwardOther", new Forwarder(otherPrx)); await adapterForwarder.ActivateAsync(); await adapterSame.ActivateAsync(); await adapterOther.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { int num = 0; try { num = int.Parse(args[0]); } catch (FormatException) { } await Communicator.ActivateAsync(); Communicator.SetProperty("ControlAdapter.Endpoints", GetTestEndpoint(num)); Communicator.SetProperty("ControlAdapter.AdapterId", $"control{num}"); ObjectAdapter adapter = Communicator.CreateObjectAdapter("ControlAdapter"); adapter.Add($"controller{num}", new Controller()); adapter.Add($"faceted-controller{num}#abc", new Controller()); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("metrics", new Metrics()); await adapter.ActivateAsync(); var schedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default); var adapter2 = Communicator.CreateObjectAdapterWithEndpoints("TestAdapterExclusiveTS", GetTestEndpoint(2), taskScheduler: schedulerPair.ExclusiveScheduler); adapter2.Add("metrics", new Metrics()); await adapter2.ActivateAsync(); Communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1)); ObjectAdapter controllerAdapter = Communicator.CreateObjectAdapter("ControllerAdapter"); controllerAdapter.Add("controller", new Controller(schedulerPair.ExclusiveScheduler)); await controllerAdapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override async Task RunAsync(string[] args) { Dictionary <string, string> properties = CreateTestProperties(ref args); bool ice1 = GetTestProtocol(properties) == Protocol.Ice1; properties["Ice.Admin.Endpoints"] = ice1 ? "tcp -h 127.0.0.1" : "ice+tcp://127.0.0.1:0"; properties["Ice.Admin.InstanceName"] = "server"; properties["Ice.Warn.Connections"] = "0"; properties["Ice.Warn.Dispatch"] = "0"; properties["Ice.IncomingFrameSizeMax"] = "50M"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("metrics", new MetricsAsync()); await adapter.ActivateAsync(); var schedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default); ObjectAdapter adapter2 = communicator.CreateObjectAdapterWithEndpoints("TestAdapterExclusiveTS", GetTestEndpoint(2), taskScheduler: schedulerPair.ExclusiveScheduler); adapter2.Add("metrics", new MetricsAsync()); await adapter2.ActivateAsync(); communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1)); ObjectAdapter controllerAdapter = communicator.CreateObjectAdapter("ControllerAdapter"); controllerAdapter.Add("controller", new Controller(schedulerPair.ExclusiveScheduler)); await controllerAdapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public async Task ActivateAsync(CancellationToken cancel) { ObjectAdapter adapter = _communicator.CreateObjectAdapter("Hello"); adapter.Add("hello", new Hello()); await adapter.ActivateAsync(cancel); }
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.Add("test", new TestIntf()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public async ValueTask TransientAsync(Current current, CancellationToken cancel) { bool ice1 = TestHelper.GetTestProtocol(current.Communicator.GetProperties()) == Protocol.Ice1; var transport = TestHelper.GetTestTransport(current.Communicator.GetProperties()); var endpoint = ice1 ? $"{transport} -h \"::0\"" : $"ice+{transport}://[::0]:0"; await using ObjectAdapter adapter = current.Communicator.CreateObjectAdapterWithEndpoints("TransientTestAdapter", endpoint); await adapter.ActivateAsync(cancel); }
public async ValueTask <IRemoteObjectAdapterPrx> CreateObjectAdapterWithEndpointsAsync( string name, string endpoints, Current current, CancellationToken cancel) { ObjectAdapter adapter = current.Communicator.CreateObjectAdapterWithEndpoints(name, endpoints); await adapter.ActivateAsync(cancel); return(current.Adapter.AddWithUUID(new RemoteObjectAdapter(adapter), IRemoteObjectAdapterPrx.Factory)); }
public override async Task RunAsync(string[] args) { await using Communicator communicator = Initialize(ref args); communicator.SetProperty("TestAdapter.Endpoints", $"{GetTestEndpoint(0)} -t 10000"); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("factory", new RemoteCommunicatorFactoryI()); await adapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.Add(Communicator.GetProperty("Identity") ?? "test", new TestIntf()); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
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"); var blob = new BlobjectI(); adapter.AddDefault(blob); adapter.Add("__echo", new Echo()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
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"); var initial = new InitialI(adapter); adapter.Add("initial", initial); await adapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { Dictionary <string, string>?properties = CreateTestProperties(ref args); properties["Ice.Warn.Dispatch"] = "0"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("Test", new TestIntfAsync()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
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.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("test", new MyClass()); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override async Task RunAsync(string[] args) { var properties = new Dictionary <string, string>(); properties.ParseArgs(ref args, "TestAdapter"); await using Communicator communicator = Initialize(ref args, properties); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add(communicator.GetProperty("Identity") ?? "test", new TestIntf()); await adapter.ActivateAsync(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("test-1", new Interceptor(new TestIntf(), compressed: true)); adapter.Add("test-2", new Interceptor(new TestIntf(), compressed: false)); await adapter.ActivateAsync(); ServerReady(); await Communicator.ShutdownComplete; }
public override async Task RunAsync(string[] args) { Dictionary <string, string> properties = CreateTestProperties(ref args); properties["Ice.ServerIdleTime"] = "30"; await using Communicator communicator = Initialize(properties); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("communicator", new RemoteCommunicator()); await adapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { await Communicator.ActivateAsync(); Communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); ObjectAdapter adapter = Communicator.CreateObjectAdapter("TestAdapter"); adapter.Add("communicator", new RemoteCommunicator()); await adapter.ActivateAsync(); ServerReady(); Communicator.SetProperty("Ice.PrintAdapterReady", "0"); await Communicator.WaitForShutdownAsync(); }
public override async Task RunAsync(string[] args) { Dictionary <string, string>?properties = CreateTestProperties(ref args); // This test kills connections, so we don't want warnings. properties["Ice.Warn.Connections"] = "0"; // The client sends large messages to cause the transport buffers to fill up. properties["Ice.IncomingFrameMaxSize"] = "20M"; // Limit the recv buffer size, this test relies on the socket send() blocking after sending a given // amount of data. properties["Ice.TCP.RcvSize"] = "50K"; await using Communicator communicator = Initialize(properties); await communicator.ActivateAsync(); communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0)); communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1)); var schedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default); ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter", taskScheduler: schedulerPair.ExclusiveScheduler); adapter.Add("timeout", new Timeout()); adapter.DispatchInterceptors = ImmutableList.Create <DispatchInterceptor>( (request, current, next, cancel) => { if (current.Operation == "checkDeadline") { if (request.BinaryContext.TryGetValue(10, out ReadOnlyMemory <byte> value)) { current.Context["deadline"] = value.Read(istr => istr.ReadVarLong()).ToString(); } } return(next(request, current, cancel)); }); await adapter.ActivateAsync(); ObjectAdapter controllerAdapter = communicator.CreateObjectAdapter("ControllerAdapter"); controllerAdapter.Add("controller", new Controller(schedulerPair.ExclusiveScheduler)); await controllerAdapter.ActivateAsync(); ServerReady(); await communicator.WaitForShutdownAsync(); }