Exemplo n.º 1
0
    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("test", new decimalI());
            adapter.Add("test1", new Test1I());
            adapter.Add("test2", new Test2I());
            adapter.Activate();

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

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

            ITestPrx t2 = adapter.CreateProxy("test2", ITestPrx.Factory);

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

            Console.Out.Write("testing types... ");
            Console.Out.Flush();
            testtypes();
            Console.Out.WriteLine("ok");
        }
    }
Exemplo n.º 2
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("c1/callback", new Callback());

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

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

            //
            // The test allows the prefixed userid.
            //
            adapter.Add("_userid/callback", new Callback());
            adapter.Activate();
            communicator.WaitForShutdown();
        }
    }
Exemplo n.º 3
0
 public InitialI(Ice.ObjectAdapter adapter)
 {
     _ia  = adapter.Add(new IAI());
     _ib1 = adapter.Add(new IB1I());
     _ib2 = adapter.Add(new IB2I());
     _ic  = adapter.Add(new ICI());
 }
Exemplo n.º 4
0
    public override void run(string[] args)
    {
        using (var communicator = initialize(ref args))
        {
            communicator.Properties.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.@decimalPrx p = @[email protected](adapter.CreateProxy("test"));
            p.@default();
            Console.Out.WriteLine("ok");

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

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

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

            Console.Out.Write("testing types... ");
            Console.Out.Flush();
            testtypes();
            Console.Out.WriteLine("ok");
        }
    }
Exemplo n.º 5
0
    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("Test", new TestIntf());
        adapter.Add("Test2", new TestIntf2());
        adapter.Activate();
        communicator.WaitForShutdown();
    }
Exemplo n.º 6
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();
    }
Exemplo n.º 7
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();
        }
    }
Exemplo n.º 8
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();
                }
            }
Exemplo n.º 9
0
            public override void run(string[] args)
            {
                Ice.Properties properties = createTestProperties(ref args);

                properties.setProperty("Ice.Warn.AMICallback", "0");
                //
                // Limit the send buffer size, this test relies on the socket
                // send() blocking after sending a given amount of data.
                //
                properties.setProperty("Ice.TCP.SndSize", "50000");
                //
                // We use a client thread pool with more than one thread to test
                // that task inlining works.
                //
                properties.setProperty("Ice.ThreadPool.Client.Size", "5");
                using (var communicator = initialize(properties))
                {
                    communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
                    communicator.getProperties().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(); // Collocated test doesn't need to activate the OA
                    adapter2.Add(new TestControllerI(adapter), "testController");
                    //adapter2.activate(); // Collocated test doesn't need to activate the OA

                    AllTests.allTests(this, true);
                }
            }
Exemplo n.º 10
0
    public override void run(string[] args)
    {
        try
        {
            var properties = createTestProperties(ref args);
            properties["Ice.Warn.AMICallback"] = "0";
            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(); // Don't activate OA to ensure collocation is used.
            adapter2.Add("testController", new TestController(adapter));
            //adapter2.activate(); // Don't activate OA to ensure collocation is used.

            AllTests.allTests(this);
        }
        finally
        {
            Dispatcher.terminate();
        }
    }
Exemplo n.º 11
0
 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 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");
         AllTests.allTests(this);
     }
 }
Exemplo n.º 12
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);
                }
            }
Exemplo n.º 13
0
    public override void run(string[] args)
    {
        try
        {
            Ice.InitializationData initData = new Ice.InitializationData();
            initData.properties = createTestProperties(ref args);
            initData.properties.setProperty("Ice.Warn.AMICallback", "0");
            initData.dispatcher = new Dispatcher().dispatch;

            using (var communicator = initialize(initData))
            {
                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.activate(); // Don't activate OA to ensure collocation is used.
                adapter2.Add(new TestControllerI(adapter), "testController");
                //adapter2.activate(); // Don't activate OA to ensure collocation is used.

                AllTests.allTests(this);
            }
        }
        finally
        {
            Dispatcher.terminate();
        }
    }
Exemplo n.º 14
0
Arquivo: Server.cs Projeto: 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();
        }
    }
Exemplo n.º 15
0
            internal TestI(Ice.ObjectAdapter adapter1,
                           Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry)
            {
                _adapter1 = adapter1;
                _adapter2 = adapter2;
                _registry = registry;

                _registry.addObject(_adapter1.Add(new HelloI(), "hello"));
            }
Exemplo n.º 16
0
Arquivo: Server.cs Projeto: 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();
     }
 }
Exemplo n.º 17
0
            public override void run(string[] args)
            {
                var initData = new InitializationData();

                initData.typeIdNamespaces = new string[] { "Ice.objects.TypeId" };
                initData.properties       = createTestProperties(ref args);
                initData.properties.setProperty("Ice.Warn.Dispatch", "0");
                using (var communicator = initialize(initData))
                {
                    communicator.Properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    adapter.Add(new InitialI(adapter), "initial");
                    adapter.Add(new F2I(), "F21");
                    var uoet = new UnexpectedObjectExceptionTestI();
                    adapter.Add((incoming, current) => uoet.Dispatch(incoming, current), "uoet");
                    Test.AllTests.allTests(this);
                }
            }
Exemplo n.º 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");
        adapter.Add("test", new TestIntf());
        adapter.Activate();

        communicator.WaitForShutdown();
    }
Exemplo n.º 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(blob, "");
        adapter.Add(new Echo(), "__echo");
        adapter.Activate();
        communicator.WaitForShutdown();
    }
Exemplo n.º 20
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);
    }
Exemplo n.º 21
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();
     }
 }
Exemplo n.º 22
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();
    }
Exemplo n.º 23
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();
     }
 }
Exemplo n.º 24
0
 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();
     }
 }
Exemplo n.º 25
0
 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();
     }
 }
Exemplo n.º 26
0
            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();
                }
            }
Exemplo n.º 27
0
Arquivo: Server.cs Projeto: 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();
     }
 }
Exemplo n.º 28
0
Arquivo: Server.cs Projeto: 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();
        }
    }
Exemplo n.º 29
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();
    }
Exemplo n.º 30
0
        public override async Task RunAsync(string[] args)
        {
            await using Ice.Communicator 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("factory", new ServerFactory(args[0] + "/../certs"));
            await adapter.ActivateAsync();

            await communicator.WaitForShutdownAsync();
        }