コード例 #1
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints", $"{getTestEndpoint(0)} -t 10000");
         ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new RemoteCommunicatorFactoryI(), "factory");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
コード例 #2
0
ファイル: Server.cs プロジェクト: nail-lian/ice
    public override void Run(string[] args)
    {
        using Communicator communicator = Initialize(ref args);
        communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
        ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
        var           blob    = new BlobjectI();

        adapter.AddDefault(blob);
        adapter.Add("__echo", new Echo());
        adapter.Activate();
        communicator.WaitForShutdown();
    }
コード例 #3
0
            public override void Run(string[] args)
            {
                using Communicator communicator = Initialize(ref args);
                communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
                ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
                var           initial = new InitialI(adapter);

                adapter.Add("initial", initial);
                adapter.Activate();
                ServerReady();
                communicator.WaitForShutdown();
            }
コード例 #4
0
        public void ActivateObjectAdapter(string name, string adapterId, string replicaGroupId, Current current)
        {
            Communicator communicator = current.Adapter.Communicator;

            communicator.SetProperty($"{name}.AdapterId", adapterId);
            communicator.SetProperty($"{name}.ReplicaGroupId", replicaGroupId);
            communicator.SetProperty($"{name}.Endpoints", "default -h 127.0.0.1");
            ObjectAdapter oa = communicator.CreateObjectAdapter(name);

            _adapters[name] = oa;
            oa.Activate();
        }
コード例 #5
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
         ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
         adapter.Add("test", new MyClass());
         adapter.Activate();
         serverReady();
         communicator.WaitForShutdown();
     }
 }
コード例 #6
0
        public void ActivateObjectAdapter(string name, string adapterId, string replicaGroupId, Current current)
        {
            Communicator communicator = current.Adapter.Communicator;
            bool         ice1         = TestHelper.GetTestProtocol(communicator.GetProperties()) == Protocol.Ice1;

            communicator.SetProperty($"{name}.AdapterId", adapterId);
            communicator.SetProperty($"{name}.ReplicaGroupId", replicaGroupId);
            communicator.SetProperty($"{name}.Endpoints", ice1 ? "tcp -h 127.0.0.1" : "ice+tcp://127.0.0.1");
            ObjectAdapter oa = communicator.CreateObjectAdapter(name);

            _adapters[name] = oa;
            oa.Activate();
        }
コード例 #7
0
 public override void run(string[] args)
 {
     using (var communicator = initialize(ref args))
     {
         communicator.SetProperty("TestAdapter.Endpoints",
                                  getTestEndpoint(0) + ":" + getTestEndpoint(0, "udp"));
         ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
         adapter.Add(new TestI(), "test");
         adapter.Activate();
         serverReady();
         communicator.waitForShutdown();
     }
 }
コード例 #8
0
ファイル: Server.cs プロジェクト: tchernobog/ice
        public override void run(string[] args)
        {
            var properties = createTestProperties(ref args);

            properties["Ice.ServerIdleTime"] = "30";
            using var communicator           = initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add(new RemoteCommunicator(), "communicator");
            adapter.Activate();
            serverReady();
            communicator.WaitForShutdown();
        }
コード例 #9
0
    public override void Run(string[] args)
    {
        using Communicator communicator = Initialize(ref args);
        communicator.SetProperty("DeactivatedAdapter.Endpoints", GetTestEndpoint(1));
        communicator.CreateObjectAdapter("DeactivatedAdapter");

        communicator.SetProperty("CallbackAdapter.Endpoints", GetTestEndpoint(0));
        ObjectAdapter adapter   = communicator.CreateObjectAdapter("CallbackAdapter");
        var           callbackI = new Callback();

        adapter.Add("callback", callbackI);
        adapter.Activate();
        communicator.WaitForShutdown();
    }
コード例 #10
0
ファイル: Server.cs プロジェクト: yuwenyong/ice
        public override void Run(string[] args)
        {
            Dictionary <string, string> properties = CreateTestProperties(ref args);

            properties["Ice.ServerIdleTime"] = "30";
            using Communicator communicator  = Initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("test", new TestIntf());
            adapter.Activate();
            ServerReady();
            communicator.WaitForShutdown();
        }
コード例 #11
0
            public override void run(string[] args)
            {
                Properties properties = createTestProperties(ref args);

                properties.setProperty("Ice.ServerIdleTime", "30");
                using (var communicator = initialize(properties))
                {
                    communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    adapter.Add(new RemoteCommunicatorI(), "communicator");
                    adapter.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
コード例 #12
0
ファイル: Server.cs プロジェクト: tchernobog/ice
        public override void run(string[] args)
        {
            using var communicator = initialize(createTestProperties(ref args),
                                                typeIdNamespaces: new string[] { "Ice.scope.TypeId" });
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add(new I1(), "i1");
            adapter.Add(new I2(), "i2");
            adapter.Add(new I3(), "i3");
            adapter.Add(new I4(), "i4");
            adapter.Activate();
            serverReady();
            communicator.WaitForShutdown();
        }
コード例 #13
0
ファイル: ServerAMD.cs プロジェクト: yuweiApp/ice
        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);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("test", new MyDerivedClassAsync());
            adapter.Activate();
            ServerReady();
            communicator.WaitForShutdown();
        }
コード例 #14
0
ファイル: Server.cs プロジェクト: jk990803/ice
        public override void Run(string[] args)
        {
            Dictionary <string, string> properties = CreateTestProperties(ref args);

            properties["Ice.Default.Protocol"] = "ice1";
            using Communicator communicator    = Initialize(properties);
            communicator.SetProperty("DeactivatedAdapter.Endpoints", GetTestEndpoint(1));
            communicator.CreateObjectAdapter("DeactivatedAdapter");

            communicator.SetProperty("CallbackAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter   = communicator.CreateObjectAdapter("CallbackAdapter");
            var           callbackI = new Callback();

            adapter.Add("callback", callbackI);
            adapter.Activate();
            communicator.WaitForShutdown();
        }
コード例 #15
0
        public override void Run(string[] args)
        {
            Dictionary <string, string> properties = CreateTestProperties(ref args);

            properties["Ice.Warn.Connections"] = "0";
            properties["Ice.ACM.Timeout"]      = "1s";
            using Communicator communicator    = Initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            communicator.SetProperty("TestAdapter.ACM.Timeout", "0s");
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("communicator", new RemoteCommunicator());
            adapter.Activate();
            ServerReady();
            communicator.SetProperty("Ice.PrintAdapterReady", "0");
            communicator.WaitForShutdown();
        }
コード例 #16
0
ファイル: ServerAMD.cs プロジェクト: yzun/ice
        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));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("test", new MyDerivedClass());
            adapter.Activate();
            serverReady();
            communicator.WaitForShutdown();
        }
コード例 #17
0
ファイル: Server.cs プロジェクト: yuwenyong/ice
        public override void Run(string[] args)
        {
            var properties = CreateTestProperties(ref args);

            properties["Ice.Warn.Dispatch"] = "0";
            using var communicator          = Initialize(properties, typeIdNamespaces: new string[] { "Ice.objects.TypeId" });
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("initial", new Initial(adapter));
            adapter.Add("F21", new F2());
            var uoet = new UnexpectedObjectExceptionTest();

            adapter.Add("uoet", uoet);
            adapter.Activate();
            ServerReady();
            communicator.WaitForShutdown();
        }
コード例 #18
0
            public override void run(string[] args)
            {
                var properties = createTestProperties(ref args);

                properties["Ice.Warn.Dispatch"] = "0";
                using var communicator          = initialize(properties, typeIdNamespaces: new string[] { "Ice.objects.TypeId" });
                communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                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");
                adapter.Activate();
                serverReady();
                communicator.waitForShutdown();
            }
コード例 #19
0
            public override void run(string[] args)
            {
                var initData = new InitializationData();

                initData.typeIdNamespaces = new string[] { "Ice.scope.TypeId" };
                initData.properties       = createTestProperties(ref args);
                using (var communicator = initialize(initData))
                {
                    communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    adapter.Add(new I1(), "i1");
                    adapter.Add(new I2(), "i2");
                    adapter.Add(new I3(), "i3");
                    adapter.Add(new I4(), "i4");
                    adapter.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
コード例 #20
0
        public override async Task RunAsync(string[] args)
        {
            Dictionary <string, string>?properties = CreateTestProperties(ref args);

            // This test kills connections, so we don't want warnings.
            properties["Ice.Warn.Connections"] = "0";

            // The client sends large messages to cause the transport buffers to fill up.
            properties["Ice.IncomingFrameSizeMax"] = "20M";

            // Limit the recv buffer size, this test relies on the socket send() blocking after sending a given
            // amount of data.
            properties["Ice.TCP.RcvSize"] = "50K";

            await using Communicator communicator = Initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            communicator.SetProperty("ControllerAdapter.Endpoints", GetTestEndpoint(1));

            var           schedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default);
            ObjectAdapter adapter       = communicator.CreateObjectAdapter("TestAdapter",
                                                                           taskScheduler: schedulerPair.ExclusiveScheduler);

            adapter.Add("timeout", new Timeout());
            adapter.Activate((request, current, next, cancel) =>
            {
                if (current.Operation == "checkDeadline")
                {
                    if (request.BinaryContext.TryGetValue(10, out ReadOnlyMemory <byte> value))
                    {
                        current.Context["deadline"] = value.Read(istr => istr.ReadVarLong()).ToString();
                    }
                }
                return(next(request, current, cancel));
            });

            ObjectAdapter controllerAdapter = communicator.CreateObjectAdapter("ControllerAdapter");

            controllerAdapter.Add("controller", new Controller(schedulerPair.ExclusiveScheduler));
            controllerAdapter.Activate();

            ServerReady();
            await communicator.WaitForShutdownAsync();
        }
コード例 #21
0
        public override void run(string[] args)
        {
            using var communicator = initialize(ref args);
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
            var           d       = new D();

            adapter.Add(d, "d");
            adapter.Add(d, "d", "facetABCD");
            var f = new F();

            adapter.Add(f, "d", "facetEF");
            var h = new H(communicator);

            adapter.Add(h, "d", "facetGH");
            adapter.Activate();
            serverReady();
            communicator.WaitForShutdown();
        }
コード例 #22
0
        public override void Run(string[] args)
        {
            using Communicator communicator = Initialize(ref args);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");
            var           d       = new D();

            adapter.Add("d", d);
            adapter.Add("d", "facetABCD", d);
            var f = new F();

            adapter.Add("d", "facetEF", f);
            var h = new H(communicator);

            adapter.Add("d", "facetGH", h);
            adapter.Activate();
            ServerReady();
            communicator.WaitForShutdown();
        }
コード例 #23
0
ファイル: Server.cs プロジェクト: tchernobog/ice
    public override void run(string[] args)
    {
        var properties = new Dictionary <string, string>();

        properties.ParseArgs(ref args, "TestAdapter");

        using var communicator = initialize(ref args, properties);
        ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

        adapter.Add(new TestIntf(), communicator.GetProperty("Identity") ?? "test");
        try
        {
            adapter.Activate();
        }
        catch (ObjectAdapterDeactivatedException)
        {
        }
        communicator.WaitForShutdown();
    }
コード例 #24
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 Communicator communicator = Initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(port));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("test", new TestIntf());
            adapter.Activate();
            communicator.WaitForShutdown();
        }
コード例 #25
0
        public override void run(string[] args)
        {
            bool async = args.Any(v => v.Equals("--async"));

            using var communicator = initialize(ref args);
            communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            if (async)
            {
                adapter.AddDefault(new BlobjectAsyncI());
            }
            else
            {
                adapter.AddDefault(new BlobjectI());
            }
            adapter.Activate();
            serverReady();
            communicator.WaitForShutdown();
        }
コード例 #26
0
            public override void run(string[] args)
            {
                var initData = new InitializationData();

                initData.typeIdNamespaces = new string[] { "Ice.operations.TypeId" };
                initData.properties       = createTestProperties(ref args);
                //
                // We don't want connection warnings because of the timeout test.
                //
                initData.properties.setProperty("Ice.Warn.Connections", "0");
                using (var communicator = initialize(initData))
                {
                    communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    adapter.Add(new MyDerivedClassI(), "test");
                    adapter.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
コード例 #27
0
ファイル: Server.cs プロジェクト: jk990803/ice
        public override void Run(string[] args)
        {
            var properties = new Dictionary <string, string>();

            properties.ParseArgs(ref args, "TestAdapter");
            properties.Add("Ice.Default.Encoding", "1.1");
            properties.Add("Ice.Default.Protocol", "ice1");

            using var communicator = Initialize(ref args, properties);
            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add(communicator.GetProperty("Identity") ?? "test", new TestIntf());
            try
            {
                adapter.Activate();
            }
            catch (ObjectAdapterDeactivatedException)
            {
            }
            communicator.WaitForShutdown();
        }
コード例 #28
0
ファイル: Server.cs プロジェクト: xingx001/ice
            public override void run(string[] args)
            {
                bool async = args.Any(v => v.Equals("--async"));

                using (var communicator = initialize(ref args))
                {
                    communicator.Properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
                    ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
                    if (async)
                    {
                        adapter.AddServantLocator(new ServantLocatorAsyncI(), "");
                    }
                    else
                    {
                        adapter.AddServantLocator(new ServantLocatorI(), "");
                    }
                    adapter.Activate();
                    serverReady();
                    communicator.waitForShutdown();
                }
            }
コード例 #29
0
        public override void Run(string[] args)
        {
            System.Collections.Generic.Dictionary <string, string> properties = CreateTestProperties(ref args);

            //
            // Disable collocation optimization to test async/await dispatch.
            //
            properties["Ice.Default.CollocationOptimized"] = "0";

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

            using Communicator communicator = Initialize(properties);
            communicator.SetProperty("TestAdapter.Endpoints", GetTestEndpoint(0));
            communicator.SetProperty("TestAdapter2.Endpoints", GetTestEndpoint(1));

            ObjectAdapter adapter = communicator.CreateObjectAdapter("TestAdapter");

            adapter.Add("test", new TestIntf());
            adapter.Add("test2", new TestIntf2());
            adapter.Activate();

            ObjectAdapter adapter2 = communicator.CreateObjectAdapter("TestAdapter2", serializeDispatch: true);

            adapter2.Add("serialized", new TestIntf());
            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}");

        ObjectAdapter adapter = communicator.CreateObjectAdapter("ControlAdapter");

        adapter.Add($"controller{num}", new Controller());
        adapter.Activate();

        communicator.WaitForShutdown();
    }