internal TestIntf(ObjectAdapter adapter1, ObjectAdapter adapter2, ServerLocatorRegistry registry) { _adapter1 = adapter1; _adapter2 = adapter2; _registry = registry; _registry.AddObject(_adapter1.Add("hello", new Hello(), IObjectPrx.Factory)); _registry.AddObject(_adapter1.Add("bonjour#abc", new Hello(), IObjectPrx.Factory)); }
public override void Run(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); 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)); adapter.Activate(); ServerReady(); communicator.WaitForShutdown(); }
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 void MigrateHello(Current current, CancellationToken cancel) { var id = Identity.Parse("hello"); IObject?servant = _adapter1.Remove(id); if (servant != null) { _registry.AddObject(_adapter2.Add(id, servant, IObjectPrx.Factory), current, cancel); } else { servant = _adapter2.Remove(id); TestHelper.Assert(servant != null); _registry.AddObject(_adapter1.Add(id, servant, IObjectPrx.Factory), current, cancel); } }