示例#1
0
    public override void run(string[] args)
    {
        using (var communicator = initialize(ref args))
        {
            communicator.SetProperty("CallbackAdapter.Endpoints", getTestEndpoint(0));
            Ice.ObjectAdapter adapter = communicator.createObjectAdapter("CallbackAdapter");

            //
            // The test allows "c1" as category.
            //
            adapter.Add(new CallbackI(), "c1/callback");

            //
            // The test allows "c2" as category.
            //
            adapter.Add(new CallbackI(), "c2/callback");

            //
            // The test rejects "c3" as category.
            //
            adapter.Add(new CallbackI(), "c3/callback");

            //
            // The test allows the prefixed userid.
            //
            adapter.Add(new CallbackI(), "_userid/callback");
            adapter.Activate();
            communicator.waitForShutdown();
        }
    }
示例#2
0
    public override void run(string[] args)
    {
        var properties = createTestProperties(ref args);

        properties["Ice.ServerIdleTime"] = "30";
        //
        // Limit the recv buffer size, this test relies on the socket
        // send() blocking after sending a given amount of data.
        //
        properties["Ice.TCP.RcvSize"] = "50000";
        try
        {
            var dispatcher = new Dispatcher();

            using var communicator = initialize(properties, dispatcher.dispatch);
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            communicator.SetProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
            communicator.SetProperty("ControllerAdapter.ThreadPool.Size", "1");

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

            adapter.Add("test", new TestIntf());
            adapter.Activate();
            adapter2.Add("testController", new TestController(adapter));
            adapter2.Activate();

            communicator.WaitForShutdown();
        }
        finally
        {
            Dispatcher.terminate();
        }
    }
示例#3
0
文件: Server.cs 项目: motuii/ice
    public override void run(string[] args)
    {
        Ice.Properties properties = createTestProperties(ref args);
        properties.setProperty("Ice.Admin.Endpoints", "tcp");
        properties.setProperty("Ice.Admin.InstanceName", "server");
        properties.setProperty("Ice.Warn.Connections", "0");
        properties.setProperty("Ice.Warn.Dispatch", "0");
        properties.setProperty("Ice.MessageSizeMax", "50000");
        properties.setProperty("Ice.Default.Host", "127.0.0.1");

        using (var communicator = initialize(properties))
        {
            communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
            adapter.Add(new MetricsI(), "metrics");
            adapter.Activate();

            communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
            Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
            controllerAdapter.Add(new ControllerI(adapter), "controller");
            controllerAdapter.Activate();

            communicator.waitForShutdown();
        }
    }
示例#4
0
            public override void run(string[] args)
            {
                using (var communicator = initialize(ref args))
                {
                    //
                    // Create OA and servants
                    //
                    communicator.Properties.setProperty("MyOA.AdapterId", "myOA");

                    Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");

                    var interceptor = new InterceptorI <MyObject, MyObjectTraits>(new MyObjectI());

                    var prx = MyObjectPrx.UncheckedCast(oa.Add((incoming, current) => interceptor.Dispatch(incoming, current)));

                    var output = getWriter();

                    output.WriteLine("Collocation optimization on");
                    runTest(prx, interceptor);
                    output.WriteLine("Now with AMD");
                    interceptor.clear();
                    runAmdTest(prx, interceptor);

                    oa.Activate(); // Only necessary for non-collocation optimized tests

                    output.WriteLine("Collocation optimization off");
                    interceptor.clear();
                    prx = prx.Clone(collocationOptimized: false);
                    runTest(prx, interceptor);

                    output.WriteLine("Now with AMD");
                    interceptor.clear();
                    runAmdTest(prx, interceptor);
                }
            }
示例#5
0
文件: Server.cs 项目: yuwenyong/ice
    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();
    }
示例#6
0
文件: Client.cs 项目: bailudata/ice
    public override void run(string[] args)
    {
        using (var communicator = initialize(ref args))
        {
            communicator.SetProperty("TestAdapter.Endpoints", "default");
            Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
            adapter.Add(new decimalI(), "test");
            adapter.Add(new Test1I(), "test1");
            adapter.Add(new Test2I(), "test2");
            adapter.Activate();

            Console.Out.Write("testing operation name... ");
            Console.Out.Flush();
            @abstract.IdecimalPrx p = @abstract.IdecimalPrx.UncheckedCast(adapter.CreateProxy("test"));
            p.@default();
            Console.Out.WriteLine("ok");

            Console.Out.Write("testing System as module name... ");
            Console.Out.Flush();
            @abstract.System.ITestPrx t1 = @abstract.System.ITestPrx.UncheckedCast(adapter.CreateProxy("test1"));
            t1.op();

            System.ITestPrx t2 = System.ITestPrx.UncheckedCast(adapter.CreateProxy("test2"));

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

            Console.Out.Write("testing types... ");
            Console.Out.Flush();
            testtypes();
            Console.Out.WriteLine("ok");
        }
    }
示例#7
0
            public override void run(string[] args)
            {
                using (var communicator = initialize(ref args))
                {
                    Timer timer = new Timer();

                    communicator.SetProperty("TestAdapter1.Endpoints", getTestEndpoint(0));
                    communicator.SetProperty("TestAdapter1.ThreadPool.Size", "5");
                    communicator.SetProperty("TestAdapter1.ThreadPool.SizeMax", "5");
                    communicator.SetProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
                    communicator.SetProperty("TestAdapter1.ThreadPool.Serialize", "0");
                    Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
                    adapter1.Add(new HoldI(timer, adapter1), "hold");

                    communicator.SetProperty("TestAdapter2.Endpoints", getTestEndpoint(1));
                    communicator.SetProperty("TestAdapter2.ThreadPool.Size", "5");
                    communicator.SetProperty("TestAdapter2.ThreadPool.SizeMax", "5");
                    communicator.SetProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
                    communicator.SetProperty("TestAdapter2.ThreadPool.Serialize", "1");
                    Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
                    adapter2.Add(new HoldI(timer, adapter2), "hold");

                    adapter1.Activate();
                    adapter2.Activate();
                    serverReady();
                    communicator.waitForShutdown();

                    timer.shutdown();
                    timer.waitForShutdown();
                }
            }
示例#8
0
文件: TestI.cs 项目: xingx001/ice
            public void transient(Ice.Current current)
            {
                Ice.Communicator communicator = current.Adapter.Communicator;

                Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
                adapter.Activate();
                adapter.Destroy();
            }
示例#9
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();
 }
示例#10
0
    public override void run(string[] args)
    {
        using var communicator = initialize(ref args);
        communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        adapter.Add("test", new TestIntf());
        adapter.Activate();

        communicator.WaitForShutdown();
    }
示例#11
0
文件: TestI.cs 项目: xingx001/ice
 activateObjectAdapter(string name, string adapterId, string replicaGroupId, Ice.Current current)
 {
     Ice.Communicator communicator = current.Adapter.Communicator;
     Ice.Properties   properties   = communicator.Properties;
     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();
 }
示例#12
0
    public override void run(string[] args)
    {
        using var communicator = initialize(ref args);
        communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        BlobjectI         blob    = new BlobjectI();

        adapter.AddDefaultServant(blob, "");
        adapter.Add(new Echo(), "__echo");
        adapter.Activate();
        communicator.WaitForShutdown();
    }
示例#13
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new MyClassI(), "test");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
示例#14
0
文件: Server.cs 项目: tchernobog/ice
    public override void run(string[] args)
    {
        var properties = createTestProperties(ref args);

        properties["Ice.Warn.Dispatch"] = "0";
        using var communicator          = initialize(properties);
        communicator.SetProperty("TestAdapter.Endpoints", $"{getTestEndpoint(0)} -t 2000");
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        adapter.Add(new TestIntf(), "Test");
        adapter.Activate();
        communicator.WaitForShutdown();
    }
示例#15
0
    public ServerPrx createServer(Dictionary <string, string> props, Ice.Current current)
    {
        props["IceSSL.DefaultDir"] = _defaultDir;
        Ice.Communicator  communicator = new Ice.Communicator(props);
        Ice.ObjectAdapter adapter      = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl");
        ServerI           server       = new ServerI(communicator);
        var prx = adapter.Add(server);

        _servers[prx.Identity] = server;
        adapter.Activate();
        return(prx);
    }
示例#16
0
文件: Server.cs 项目: sgrzegorz/ice
    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();
    }
示例#17
0
文件: Server.cs 项目: xingx001/ice
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.Properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         var initial = new InitialI(adapter);
         adapter.Add(initial, "initial");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
示例#18
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter  adapter = communicator.createObjectAdapter("TestAdapter");
         Ice.ServantLocator locator = new ServantLocatorI();
         adapter.AddServantLocator(locator, "");
         adapter.Activate();
         serverReady();
         adapter.WaitForDeactivate();
     }
 }
示例#19
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         BlobjectI         blob    = new BlobjectI();
         adapter.AddDefaultServant((incoming, current) => blob.Dispatch(incoming, current), "");
         adapter.Add(new EchoI(blob), "__echo");
         adapter.Activate();
         communicator.waitForShutdown();
     }
 }
示例#20
0
文件: ServerAMD.cs 项目: xingx001/ice
 public override void run(string[] args)
 {
     Ice.Properties properties = createTestProperties(ref args);
     properties.setProperty("Ice.Warn.Dispatch", "0");
     using (var communicator = initialize(properties))
     {
         properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new TestI(), "Test");
         adapter.Activate();
         communicator.waitForShutdown();
     }
 }
示例#21
0
文件: Server.cs 项目: motuii/ice
 public override void run(string[] args)
 {
     Ice.Properties properties = createTestProperties(ref args);
     properties.setProperty("Ice.ServerIdleTime", "30");
     using (var communicator = initialize(properties))
     {
         communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new TestI(), "test");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
示例#22
0
文件: Server.cs 项目: yzun/ice
    public override void run(string[] args)
    {
        using (var communicator = initialize(ref args))
        {
            communicator.SetProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1));
            communicator.CreateObjectAdapter("DeactivatedAdapter");

            communicator.SetProperty("CallbackAdapter.Endpoints", getTestEndpoint(0));
            Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("CallbackAdapter");
            var callbackI             = new Callback();
            adapter.Add("callback", callbackI);
            adapter.Activate();
            communicator.WaitForShutdown();
        }
    }
示例#23
0
    public override void run(string[] args)
    {
        using var communicator = initialize(ref args);
        if (args.Length < 1)
        {
            throw new ArgumentException("Usage: server testdir");
        }

        communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0, "tcp"));
        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        adapter.Add(new ServerFactory(args[0] + "/../certs"), "factory");
        adapter.Activate();

        communicator.WaitForShutdown();
    }
示例#24
0
                public override void run(string[] args)
                {
                    var properties = createTestProperties(ref args);

                    //
                    // We don't want connection warnings because of the timeout test.
                    //
                    properties["Ice.Warn.Connections"] = "0";
                    using var communicator             = initialize(properties, typeIdNamespaces: new string[] { "Ice.operations.AMD.TypeId" });
                    communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    adapter.Add(new MyDerivedClassI(), "test");
                    adapter.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
示例#25
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.getProperties().parseCommandLineOptions("TestAdapter", args);
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new TestI(), communicator.getProperties().getPropertyWithDefault("Identity", "test"));
         try
         {
             adapter.Activate();
         }
         catch (Ice.ObjectAdapterDeactivatedException)
         {
         }
         communicator.waitForShutdown();
     }
 }
示例#26
0
文件: Server.cs 项目: motuii/ice
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         var d = new DI();
         adapter.Add(d, "d");
         adapter.Add(d, "d", "facetABCD");
         var f = new FI();
         adapter.Add(f, "d", "facetEF");
         var h = new HI(communicator);
         adapter.Add(h, "d", "facetGH");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
示例#27
0
    public override void run(string[] args)
    {
        var 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 (var communicator = initialize(properties))
        {
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(port));
            Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
            adapter.Add(new TestI(), "test");
            adapter.Activate();
            communicator.waitForShutdown();
        }
    }
示例#28
0
    public ServerPrx createServer(Dictionary <string, string> props, Ice.Current current)
    {
        Ice.InitializationData initData = new Ice.InitializationData();
        initData.properties = Ice.Util.createProperties();
        foreach (string key in props.Keys)
        {
            initData.properties.setProperty(key, props[key]);
        }
        initData.properties.setProperty("IceSSL.DefaultDir", _defaultDir);
        string[]          args         = new string[0];
        Ice.Communicator  communicator = Ice.Util.initialize(ref args, initData);
        Ice.ObjectAdapter adapter      = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl");
        ServerI           server       = new ServerI(communicator);
        var prx = adapter.Add(server);

        _servers[prx.Identity] = server;
        adapter.Activate();
        return(prx);
    }
示例#29
0
文件: Server.cs 项目: xingx001/ice
            public override void run(string[] args)
            {
                Ice.Properties properties = createTestProperties(ref args);

                //
                // Disable collocation optimization to test async/await dispatch.
                //
                properties.setProperty("Ice.Default.CollocationOptimized", "0");

                //
                // This test kills connections, so we don't want warnings.
                //
                properties.setProperty("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.setProperty("Ice.TCP.RcvSize", "50000");

                using (var communicator = initialize(properties))
                {
                    communicator.Properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    communicator.Properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
                    communicator.Properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");

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

                    adapter.Add(new TestI(), "test");
                    adapter.Add(new TestII(), "test2");
                    adapter.Activate();
                    adapter2.Add(new TestControllerI(adapter), "testController");
                    adapter2.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
示例#30
0
    public override void run(string[] args)
    {
        using var communicator = initialize(ref args);
        int num = 0;

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

        communicator.SetProperty("ControlAdapter.Endpoints", getTestEndpoint(num));
        communicator.SetProperty("ControlAdapter.AdapterId", $"control{num}");
        communicator.SetProperty("ControlAdapter.ThreadPool.Size", "1");

        Ice.ObjectAdapter adapter = communicator.CreateObjectAdapter("ControlAdapter");
        adapter.Add($"controller{num}", new Controller());
        adapter.Activate();

        communicator.WaitForShutdown();
    }