Beispiel #1
0
    public static int run(string[] args, Ice.Communicator communicator, TextWriter @out)
    {
        //
        // When running as a MIDlet the properties for the server may be
        // overridden by configuration. If it isn't then we assume
        // defaults.
        //
        if (communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
        {
            communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        }
        if (communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
        {
            communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
            communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
        }

        Ice.ObjectAdapter adapter  = communicator.createObjectAdapter("TestAdapter");
        Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");

        BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

        adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
        adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
        adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
        adapter.activate();

        adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
        adapter2.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #2
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Timer timer = new Timer();

        communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default -p 12010:udp");
        communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5");
        communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
        communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
        communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0");
        Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
        adapter1.add(new HoldI(timer, adapter1), communicator.stringToIdentity("hold"));

        communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p 12011:udp");
        communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5");
        communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
        communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
        communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1");
        Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
        adapter2.add(new HoldI(timer, adapter2), communicator.stringToIdentity("hold"));

        adapter1.activate();
        adapter2.activate();

        communicator.waitForShutdown();

        timer.shutdown();
        timer.waitForShutdown();

        return(0);
    }
Beispiel #3
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.Properties properties = communicator.getProperties();

        int port = 12010;

        try
        {
            port += args.Length == 1 ? Int32.Parse(args[0]) : 0;
        }
        catch (FormatException)
        {
        }
        properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port);
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter");
        adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
        adapter.activate();

        if (port == 12010)
        {
            properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
            Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter");
            adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
            adapter2.activate();
        }

        string endpoint;

        if (properties.getProperty("Ice.IPv6").Equals("1"))
        {
            if (IceInternal.AssemblyUtil.osx_)
            {
                endpoint = "udp -h \"ff15::1:1\" -p 12020 --interface \"::1\"";
            }
            else
            {
                endpoint = "udp -h \"ff15::1:1\" -p 12020";
            }
        }
        else
        {
            endpoint = "udp -h 239.255.1.1 -p 12020";
        }
        properties.setProperty("McastTestAdapter.Endpoints", endpoint);
        Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter");
        mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
        mcastAdapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #4
0
    public static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MetricsI(), communicator.stringToIdentity("metrics"));
        adapter.activate();

        communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
        Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
        controllerAdapter.add(new ControllerI(adapter), communicator.stringToIdentity("controller"));
        controllerAdapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #5
0
 private static int run(string[] args, Ice.Communicator communicator)
 {
     Ice.ObjectAdapter adapter  = communicator.createObjectAdapter("TestAdapter");
     Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
     Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
     Ice.Object        obj      = new ThrowerI();
     adapter.add(obj, communicator.stringToIdentity("thrower"));
     adapter2.add(obj, communicator.stringToIdentity("thrower"));
     adapter3.add(obj, communicator.stringToIdentity("thrower"));
     adapter.activate();
     adapter2.activate();
     adapter3.activate();
     communicator.waitForShutdown();
     return(0);
 }
Beispiel #6
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MetricsI(), communicator.stringToIdentity("metrics"));
        //adapter.activate(); // Don't activate OA to ensure collocation is used.

        communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
        Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
        controllerAdapter.add(new ControllerI(adapter), communicator.stringToIdentity("controller"));
        //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used.

        Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer);
        metrics.shutdown();
        return(0);
    }
Beispiel #7
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new decimalI(), Ice.Util.stringToIdentity("test"));
        adapter.add(new Test1I(), Ice.Util.stringToIdentity("test1"));
        adapter.add(new Test2I(), Ice.Util.stringToIdentity("test2"));
        adapter.activate();

        Console.Out.Write("testing operation name... ");
        Console.Out.Flush();
        @abstract.@decimalPrx p = @[email protected](
            adapter.createProxy(Ice.Util.stringToIdentity("test")));
        p.@default();
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing System as module name... ");
        Console.Out.Flush();
        @abstract.System.TestPrx t1 = @abstract.System.TestPrxHelper.uncheckedCast(
            adapter.createProxy(Ice.Util.stringToIdentity("test1")));
        t1.op();

        System.TestPrx t2 = System.TestPrxHelper.uncheckedCast(
            adapter.createProxy(Ice.Util.stringToIdentity("test2")));

        t2.op();
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing types... ");
        Console.Out.Flush();
        testtypes();
        Console.Out.WriteLine("ok");

        return(0);
    }
Beispiel #8
0
    private static int run(Ice.Communicator communicator)
    {
        var server = CallbackSenderPrxHelper.checkedCast(communicator.propertyToProxy("CallbackSender.Proxy"));

        if (server == null)
        {
            Console.Error.WriteLine("invalid proxy");
            return(1);
        }

        //
        // Create an object adapter with no name and no endpoints for receiving callbacks
        // over bidirectional connections.
        //
        var adapter = communicator.createObjectAdapter("");

        //
        // Register the callback receiver servant with the object adapter
        //
        var proxy = CallbackReceiverPrxHelper.uncheckedCast(adapter.addWithUUID(new CallbackReceiverI()));

        //
        // Associate the object adapter with the bidirectional connection.
        //
        server.ice_getConnection().setAdapter(adapter);

        //
        // Provide the proxy of the callback receiver object to the server and wait for
        // shutdown.
        //
        server.addClient(proxy);
        communicator.waitForShutdown();
        return(0);
    }
Beispiel #9
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.Properties properties = communicator.getProperties();

        int num = 0;

        try
        {
            num = Int32.Parse(args[0]);
        }
        catch (FormatException)
        {
        }

        properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num));
        properties.setProperty("ControlAdapter.AdapterId", "control" + num);
        properties.setProperty("ControlAdapter.ThreadPool.Size", "1");

        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter");
        adapter.add(new ControllerI(), Ice.Util.stringToIdentity("controller" + num));
        adapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #10
0
    private static int run(Ice.Communicator communicator)
    {
        var adapter = communicator.createObjectAdapter("DiscoverReply");
        var replyI  = new DiscoverReplyI();
        var reply   = DiscoverReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI));

        adapter.activate();

        var discover = DiscoverPrxHelper.uncheckedCast(
            communicator.propertyToProxy("Discover.Proxy").ice_datagram());

        discover.lookup(reply);
        var obj = replyI.waitReply(2000);

        if (obj == null)
        {
            Console.Error.WriteLine("no replies");
            return(1);
        }
        var hello = HelloPrxHelper.checkedCast(obj);

        if (hello == null)
        {
            Console.Error.WriteLine("invalid reply");
            return(1);
        }

        hello.sayHello();
        return(0);
    }
Beispiel #11
0
    private static int run(Ice.Communicator communicator)
    {
        var nested = NestedPrxHelper.checkedCast(communicator.propertyToProxy("Nested.Proxy"));

        if (nested == null)
        {
            Console.Error.WriteLine("invalid proxy");
            return(1);
        }

        //
        // Ensure the invocation times out if the nesting level is too
        // high and there are no more threads in the thread pool to
        // dispatch the call.
        //
        nested = (NestedPrx)nested.ice_invocationTimeout(5000);

        var adapter = communicator.createObjectAdapter("Nested.Client");
        var self    =
            NestedPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("nestedClient")));

        adapter.add(new NestedI(self), Ice.Util.stringToIdentity("nestedClient"));
        adapter.activate();

        Console.Out.WriteLine("Note: The maximum nesting level is sz * 2, with sz being");
        Console.Out.WriteLine("the maximum number of threads in the server thread pool. If");
        Console.Out.WriteLine("you specify a value higher than that, the application will");
        Console.Out.WriteLine("block or timeout.");
        Console.Out.WriteLine();

        string s = null;

        do
        {
            try
            {
                Console.Out.Write("enter nesting level or 'x' for exit: ");
                Console.Out.Flush();
                s = Console.In.ReadLine();
                if (s == null)
                {
                    break;
                }
                var level = int.Parse(s);
                if (level > 0)
                {
                    nested.nestedCall(level, self);
                }
            }
            catch (FormatException)
            {
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }while(!s.Equals("x"));

        return(0);
    }
Beispiel #12
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
        communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");

        Ice.ObjectAdapter adapter  = communicator.createObjectAdapter("TestAdapter");
        Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");

        adapter.add(new TestI(), communicator.stringToIdentity("test"));
        adapter.activate();
        adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController"));
        adapter2.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #13
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
        communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");

        Ice.ObjectAdapter adapter  = communicator.createObjectAdapter("TestAdapter");
        Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");

        adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
        //adapter.activate(); // Collocated test doesn't need to activate the OA
        adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
        //adapter2.activate(); // Collocated test doesn't need to activate the OA

        AllTests.allTests(communicator, true);
        return(0);
    }
Beispiel #14
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
        communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");

        Ice.ObjectAdapter adapter  = communicator.createObjectAdapter("TestAdapter");
        Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");

        adapter.add(new TestI(), communicator.stringToIdentity("test"));
        //adapter.activate(); // Don't activate OA to ensure collocation is used.
        adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController"));
        //adapter2.activate(); // Don't activate OA to ensure collocation is used.

        AllTests.allTests(communicator);
        return(0);
    }
Beispiel #15
0
    public void start(string name, Ice.Communicator communicator, string[] args)
    {
        _adapter = communicator.createObjectAdapter("Hello-" + name);

        string helloIdentity = communicator.getProperties().getProperty("Hello.Identity");

        _adapter.add(new HelloI(name), Ice.Util.stringToIdentity(helloIdentity));
        _adapter.activate();
    }
Beispiel #16
0
 private static int run(string[] args, Ice.Communicator communicator)
 {
     communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
     Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
     Ice.Object        obj     = new InitialI(adapter);
     adapter.add(obj, communicator.stringToIdentity("initial"));
     AllTests.allTests(communicator);
     return(0);
 }
Beispiel #17
0
 private static int run(string[] args, Ice.Communicator communicator)
 {
     communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
     Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
     Ice.Object        @object = new Test.ChecksumI();
     adapter.add(@object, communicator.stringToIdentity("test"));
     adapter.activate();
     communicator.waitForShutdown();
     return(0);
 }
Beispiel #18
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new PriorityI(), communicator.stringToIdentity("test"));
        adapter.activate();

        communicator.waitForShutdown();
        return 0;
    }
Beispiel #19
0
    public static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new RetryI(), communicator.stringToIdentity("retry"));
        adapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #20
0
 activateObjectAdapter(string name, string adapterId, string replicaGroupId, Ice.Current current)
 {
     Ice.Communicator communicator = current.Adapter.Communicator;
     communicator.SetProperty($"{name}.AdapterId", adapterId);
     communicator.SetProperty($"{name}.ReplicaGroupId", replicaGroupId);
     communicator.SetProperty($"{name}.Endpoints", "default");
     Ice.ObjectAdapter oa = communicator.createObjectAdapter(name);
     _adapters[name] = oa;
     oa.Activate();
 }
Beispiel #21
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial"));
        adapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #22
0
    public override void startServer(Ice.Current current)
    {
        foreach (Ice.Communicator c in _communicators)
        {
            c.waitForShutdown();
            c.destroy();
        }
        _communicators.Clear();

        //
        // Simulate a server: create a new communicator and object
        // adapter. The object adapter is started on a system allocated
        // port. The configuration used here contains the Ice.Locator
        // configuration variable. The new object adapter will register
        // its endpoints with the locator and create references containing
        // the adapter id instead of the endpoints.
        //
        Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData);
        _communicators.Add(serverCommunicator);

        //
        // Use fixed port to ensure that OA re-activation doesn't re-use previous port from
        // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
        //
        serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++);
        serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++);

        Ice.ObjectAdapter adapter  = serverCommunicator.createObjectAdapter("TestAdapter");
        Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");

        Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010");
        adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
        adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));

        Ice.Object @object = new TestI(adapter, adapter2, _registry);
        _registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test")));
        _registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test2")));
        adapter.add(@object, Ice.Util.stringToIdentity("test3"));

        adapter.activate();
        adapter2.activate();
    }
Beispiel #23
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Identity      id      = communicator.stringToIdentity("factory");
        adapter.add(new ServerFactoryI(), id);
        adapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #24
0
    private static int run(String[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MyClassI(), communicator.stringToIdentity("test"));
        //adapter.activate(); // Don't activate OA to ensure collocation is used.

        AllTests.allTests(communicator, true);

        return(0);
    }
Beispiel #25
0
 activateObjectAdapter(string name, string adapterId, string replicaGroupId, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.Properties   properties   = communicator.getProperties();
     properties.setProperty(name + ".AdapterId", adapterId);
     properties.setProperty(name + ".ReplicaGroupId", replicaGroupId);
     properties.setProperty(name + ".Endpoints", "default");
     Ice.ObjectAdapter oa = communicator.createObjectAdapter(name);
     _adapters[name] = oa;
     oa.activate();
 }
Beispiel #26
0
    private static int run(String[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
        adapter.activate();

        AllTests.allTests(communicator);

        return(0);
    }
Beispiel #27
0
 private static int run(string[] args, Ice.Communicator communicator)
 {
     Ice.Properties properties = communicator.getProperties();
     properties.setProperty("Ice.Warn.Dispatch", "0");
     properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
     Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
     Ice.Object        obj     = new TestI();
     adapter.add(obj, communicator.stringToIdentity("Test"));
     adapter.activate();
     communicator.waitForShutdown();
     return(0);
 }
Beispiel #28
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Initial           initial = new InitialI(adapter);

        adapter.add(initial, communicator.stringToIdentity("initial"));
        AllTests.allTests(communicator, true);
        // We must call shutdown even in the collocated case for cyclic dependency cleanup
        initial.shutdown();
        return(0);
    }
Beispiel #29
0
    public static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        BlobjectI         blob    = new BlobjectI();

        adapter.addDefaultServant(blob, "");
        adapter.add(new EchoI(blob), communicator.stringToIdentity("__echo"));
        adapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #30
0
    public static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        communicator.getProperties().setProperty("TestAdapter.ACM.Timeout", "0");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Identity      id      = communicator.stringToIdentity("communicator");
        adapter.add(new RemoteCommunicatorI(), id);
        adapter.activate();

        communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0");

        communicator.waitForShutdown();
        return(0);
    }