Ejemplo n.º 1
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        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(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(adapter2), communicator.stringToIdentity("hold"));

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

        communicator.waitForShutdown();

        return 0;
    }
Ejemplo n.º 2
0
    public ServiceManagerI(Ice.Communicator communicator, string[] args)
    {
        _communicator = communicator;
        _logger = _communicator.getLogger();

        Ice.Properties props = _communicator.getProperties();

        if(props.getProperty("Ice.Admin.Enabled").Length == 0)
        {
            _adminEnabled = props.getProperty("Ice.Admin.Endpoints").Length > 0;
        }
        else
        {
            _adminEnabled = props.getPropertyAsInt("Ice.Admin.Enabled") > 0;
        }

        if(_adminEnabled)
        {
            string[] facetFilter = props.getPropertyAsList("Ice.Admin.Facets");
            if(facetFilter.Length > 0)
            {
                _adminFacetFilter = new HashSet<string>(facetFilter);
            }
            else
            {
                _adminFacetFilter = new HashSet<string>();
            }
        }

        _argv = args;
        _traceServiceObserver = _communicator.getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver");
    }
Ejemplo n.º 3
0
 public void start(string name, Ice.Communicator communicator,  string[] args)
 {
     Console.WriteLine("STARTING Service: {0}", name);
     string prop =  communicator.getProperties().getProperty("IDHT.Master");
     bool isMasterNode = (prop == null)? false: prop.Equals("1");
     if (isMasterNode)
     {
         Console.WriteLine("Is master node");
     }
     _node = new DHTNodeI(communicator.getProperties().getProperty(name+".AdapterId"), isMasterNode, communicator);
     _adapter = communicator.createObjectAdapter(name);
     _adapter.add(_node, Ice.Util.stringToIdentity(Constants.SERVICE_NAME));
     _adapter.activate();
 }
Ejemplo n.º 4
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;
    }
Ejemplo n.º 5
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        //
        // We don't want connection warnings because of the timeout test.
        //
        communicator.getProperties().setProperty("Ice.Warn.Connections", "0");

        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
        adapter.activate();

        communicator.waitForShutdown();
        return 0;
    }
Ejemplo n.º 6
0
    private static int run(string[] args, Ice.Communicator communicator,
        Ice.InitializationData initData)
    {
        //
        // 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).
        //
        Ice.Properties properties = communicator.getProperties();
        properties.setProperty("Ice.ThreadPool.Server.Size", "2");
        properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");

        Ice.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.
        //
        ServerLocatorRegistry registry = new ServerLocatorRegistry();
        Ice.Object @object = new ServerManagerI(registry, initData);
        adapter.add(@object, communicator.stringToIdentity("ServerManager"));
        registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager")));
        Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
                                                adapter.add(registry, communicator.stringToIdentity("registry")));

        ServerLocator locator = new ServerLocator(registry, registryPrx);
        adapter.add(locator, communicator.stringToIdentity("locator"));

        adapter.activate();
        communicator.waitForShutdown();

        return 0;
    }
Ejemplo n.º 7
0
 public ServiceManagerI(Ice.Communicator communicator, string[] args)
 {
     _communicator = communicator;
     _logger = _communicator.getLogger();
     _argv = args;
     _traceServiceObserver = _communicator.getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver");
 }
Ejemplo n.º 8
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 decimalI(), communicator.stringToIdentity("test"));
        adapter.add(new Test1I(), communicator.stringToIdentity("test1"));
        adapter.add(new Test2I(), communicator.stringToIdentity("test2"));
        adapter.activate();

        Console.Out.Write("testing operation name... ");
        Console.Out.Flush();
        @abstract.@decimalPrx p = @[email protected](
            adapter.createProxy(communicator.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(communicator.stringToIdentity("test1")));
        t1.op();

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

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

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

        return 0;
    }
Ejemplo n.º 9
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;
    }
Ejemplo n.º 10
0
    private static int run(String[] args, Ice.Communicator communicator)
    {
        communicator.getProperties().setProperty("TestAdapter.AdapterId", "test");
        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
        //adapter.activate(); // Don't activate OA to ensure collocation is used.

        if(prx.ice_getConnection() != null)
        {
            throw new System.Exception();
        }

        AllTests.allTests(communicator);

        return 0;
    }
Ejemplo n.º 11
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();
    }
Ejemplo n.º 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;
    }
Ejemplo n.º 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(), communicator.stringToIdentity("test"));
        //adapter.activate(); // Collocated test doesn't need to activate the OA
        adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController"));
        //adapter2.activate(); // Collocated test doesn't need to activate the OA

        AllTests.allTests(communicator, true);
        return 0;
    }
Ejemplo n.º 14
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 ThrowerI();
     adapter.add(obj, communicator.stringToIdentity("thrower"));
     AllTests.allTests(communicator);
     return 0;
 }
Ejemplo n.º 15
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, Ice.Util.stringToIdentity("test"));
     adapter.activate();
     communicator.waitForShutdown();
     return 0;
 }
Ejemplo n.º 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");
        adapter.add(new MyClassI(), communicator.stringToIdentity("test"));
        adapter.activate();

        communicator.waitForShutdown();
        return 0;
    }
Ejemplo n.º 17
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;
    }
Ejemplo n.º 18
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;
 }
Ejemplo n.º 19
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;
    }
Ejemplo n.º 20
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");
        Ice.Identity id = Ice.Util.stringToIdentity("communicator");
        adapter.add(new RemoteCommunicatorI(), id);
        adapter.activate();

        communicator.waitForShutdown();
        return 0;
    }
Ejemplo n.º 21
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;
 }
Ejemplo n.º 22
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;
    }
Ejemplo n.º 23
0
 private static int run(string[] args, Ice.Communicator communicator)
 {
     Ice.Properties properties = communicator.getProperties();
     // We don't need to disable warnings because we have a dummy logger.
     //properties.setProperty("Ice.Warn.Dispatch", "0");
     properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
     Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
     Ice.Object @object = new ThrowerI();
     adapter.add(@object, communicator.stringToIdentity("thrower"));
     adapter.activate();
     communicator.waitForShutdown();
     return 0;
 }
Ejemplo n.º 24
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;
    }
Ejemplo n.º 25
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.Properties properties = communicator.getProperties();

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

        if(port == 12010)
        {
            properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
            Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter");
            adapter2.add(new TestIntfI(), communicator.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(), communicator.stringToIdentity("test"));
        mcastAdapter.activate();

        communicator.waitForShutdown();
        return 0;
    }
Ejemplo n.º 26
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new MetricsI(), Ice.Util.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), Ice.Util.stringToIdentity("controller"));
        //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used.

        Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer);
        metrics.shutdown();
        return 0;
    }
Ejemplo n.º 27
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        communicator.addValueFactory(MyValueFactory, "::Test::I");
        communicator.addValueFactory(MyValueFactory, "::Test::J");
        communicator.addValueFactory(MyValueFactory, "::Test::H");

        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object @object = new InitialI(adapter);
        adapter.add(@object, communicator.stringToIdentity("initial"));
        @object = new UnexpectedObjectExceptionTestI();
        adapter.add(@object, communicator.stringToIdentity("uoet"));
        adapter.activate();
        communicator.waitForShutdown();
        return 0;
    }
Ejemplo n.º 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");
        Ice.Object d = new DI();
        adapter.add(d, communicator.stringToIdentity("d"));
        adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
        Ice.Object f = new FI();
        adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
        Ice.Object h = new HI(communicator);
        adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");

        AllTests.allTests(communicator);

        return 0;
    }
Ejemplo n.º 29
0
        internal Instance(Ice.Communicator communicator)
        {
            _logger = communicator.getLogger();
            _facade = IceInternal.Util.getProtocolPluginFacade(communicator);
            _securityTraceLevel = communicator.getProperties().getPropertyAsIntWithDefault("IceSSL.Trace.Security", 0);
            _securityTraceCategory = "Security";
            _initialized = false;
            _trustManager = new TrustManager(communicator);

            //
            // Register the endpoint factory. We have to do this now, rather than
            // in initialize, because the communicator may need to interpret
            // proxies before the plug-in is fully initialized.
            //
            _facade.addEndpointFactory(new EndpointFactoryI(this));
        }
Ejemplo n.º 30
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        int port = 0;
        for(int i = 0; i < args.Length; i++)
        {
            if(args[i][0] == '-')
            {
                System.Console.Error.WriteLine("Server: unknown option `" + args[i] + "'");
                usage();
                return 1;
            }

            if(port != 0)
            {
                System.Console.Error.WriteLine("Server: only one port can be specified");
                usage();
                return 1;
            }

            try
            {
                port = System.Int32.Parse(args[i]);
            }
            catch(System.FormatException)
            {
                System.Console.Error.WriteLine("Server: invalid port");
                usage();
                return 1;
            }
        }

        if(port <= 0)
        {
            System.Console.Error.WriteLine("Server: no port specified");
            usage();
            return 1;
        }

        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object obj = new TestI();
        adapter.add(obj, communicator.stringToIdentity("test"));
        adapter.activate();
        communicator.waitForShutdown();
        return 0;
    }