Ejemplo n.º 1
0
    public override void Run(string[] args)
    {
        Dictionary <string, string> properties = CreateTestProperties(ref args);

        properties["Ice.Admin.Endpoints"]    = "tcp";
        properties["Ice.Admin.InstanceName"] = "server";
        properties["Ice.Warn.Connections"]   = "0";
        properties["Ice.Warn.Dispatch"]      = "0";
        properties["Ice.MessageSizeMax"]     = "50000";
        properties["Ice.Default.Host"]       = "127.0.0.1";

        using Ice.Communicator communicator = Initialize(properties);
        communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
        communicator.SetProperty("TestAdapter.ThreadPool.SizeMax",
                                 communicator.GetProperty("Ice.ThreadPool.Server.SizeMax") ?? "");

        communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1));
        Ice.ObjectAdapter controllerAdapter = communicator.CreateObjectAdapter("ControllerAdapter");
        controllerAdapter.Add("controller", new Controller(() => {
            Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
            adapter.Add("metrics", new Metrics());
            return(adapter);
        }));
        controllerAdapter.Activate();

        communicator.WaitForShutdown();
    }
Ejemplo n.º 2
0
    public override void Run(string[] args)
    {
        using Ice.Communicator communicator = Initialize(ref args);
        communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        var blob = new BlobjectI();

        adapter.AddDefault(blob);
        adapter.Add("__echo", new Echo());
        adapter.Activate();
        communicator.WaitForShutdown();
    }
Ejemplo n.º 3
0
    public override void Run(string[] args)
    {
        Dictionary <string, string> properties = CreateTestProperties(ref args);

        properties["Ice.ServerIdleTime"] = "120";
        int port = 0;

        for (int i = 0; i < args.Length; i++)
        {
            if (args[i][0] == '-')
            {
                throw new ArgumentException("Server: unknown option `" + args[i] + "'");
            }

            if (port != 0)
            {
                throw new ArgumentException("Server: only one port can be specified");
            }

            try
            {
                port = int.Parse(args[i]);
            }
            catch (FormatException)
            {
                throw new ArgumentException("Server: invalid port");
            }
        }

        if (port <= 0)
        {
            throw new ArgumentException("Server: no port specified");
        }

        using Ice.Communicator communicator = Initialize(properties);
        communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(port));
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        adapter.Add("test", new TestIntf());
        adapter.Activate();
        communicator.WaitForShutdown();
    }