示例#1
0
    public static int run(string[] args, Ice.Communicator communicator, TextWriter @out)
    {
        //
        // When running as a MIDlet the properties for the server may be
        // overridden by configuration. If it isn't then we assume
        // defaults.
        //
        if (communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
        {
            communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        }
        if (communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
        {
            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");

        BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

        adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
        adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
        adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
        adapter.activate();

        adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
        adapter2.activate();

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

        //
        // This test kills connections, so we don't want warnings.
        //
        properties.setProperty("Ice.Warn.Connections", "0");

        properties.setProperty("Ice.MessageSizeMax", "50000");

        // This test relies on filling the TCP send/recv buffer, so
        // we rely on a fixed value for these buffers.
        properties.setProperty("Ice.TCP.RcvSize", "50000");

        //
        // Setup the test transport plug-in.
        //
        properties.setProperty("Ice.Default.Protocol",
                               "test-" + properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"));

        using (var communicator = initialize(properties))
        {
            PluginI plugin = new PluginI(communicator);
            plugin.initialize();
            communicator.getPluginManager().addPlugin("Test", plugin);

            //
            // When running as a MIDlet the properties for the server may be
            // overridden by configuration. If it isn't then we assume
            // defaults.
            //
            if (communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
            {
                communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            }

            if (communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
            {
                communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp"));
                communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
            }

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

            BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

            adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
            adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
            adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
            adapter.activate();

            adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
            adapter2.activate();

            communicator.waitForShutdown();
        }
    }
示例#3
0
文件: Server.cs 项目: saxonelf/ice
    public override int run(string[] args)
    {
        PluginI plugin = new PluginI(communicator());

        plugin.initialize();
        communicator().getPluginManager().addPlugin("Test", plugin);

        //
        // When running as a MIDlet the properties for the server may be
        // overridden by configuration. If it isn't then we assume
        // defaults.
        //
        if (communicator().getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
        {
            communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
        }
        if (communicator().getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
        {
            communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp"));
            communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
        }

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

        BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

        adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
        adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
        adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
        adapter.activate();

        adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
        adapter2.activate();

        communicator().waitForShutdown();
        return(0);
    }
示例#4
0
 internal RouterI(BackgroundControllerI controller)
 {
     _controller = controller;
 }
示例#5
0
 internal LocatorI(BackgroundControllerI controller)
 {
     _controller = controller;
 }
示例#6
0
文件: Server.cs 项目: joshmoore/ice
    public static int run(string[] args, Ice.Communicator communicator, TextWriter @out)
    {
        //
        // When running as a MIDlet the properties for the server may be
        // overridden by configuration. If it isn't then we assume
        // defaults.
        //
        if(communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
        {
            communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        }
        if(communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
        {
            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");

        BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

        adapter.add(new BackgroundI(backgroundController), communicator.stringToIdentity("background"));
        adapter.add(new LocatorI(backgroundController), communicator.stringToIdentity("locator"));
        adapter.add(new RouterI(backgroundController), communicator.stringToIdentity("router"));
        adapter.activate();

        adapter2.add(backgroundController, communicator.stringToIdentity("backgroundController"));
        adapter2.activate();

        communicator.waitForShutdown();
        return 0;
    }
示例#7
0
文件: Server.cs 项目: joshmoore/ice
 internal RouterI(BackgroundControllerI controller)
 {
     _controller = controller;
 }
示例#8
0
文件: Server.cs 项目: joshmoore/ice
 internal LocatorI(BackgroundControllerI controller)
 {
     _controller = controller;
 }
示例#9
0
    public override void run(string[] args)
    {
        var properties = createTestProperties(ref args);

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

        properties["Ice.MessageSizeMax"] = "50000";

        // This test relies on filling the TCP send/recv buffer, so
        // we rely on a fixed value for these buffers.
        properties["Ice.TCP.RcvSize"] = "50000";

        //
        // Setup the test transport plug-in.
        //
        string?protocol;

        if (!properties.TryGetValue("Ice.Default.Protocol", out protocol))
        {
            protocol = "tcp";
        }
        properties["Ice.Default.Protocol"] = $"test-{protocol}";

        using (var communicator = initialize(properties))
        {
            PluginI plugin = new PluginI(communicator);
            plugin.initialize();
            communicator.AddPlugin("Test", plugin);

            //
            // When running as a MIDlet the properties for the server may be
            // overridden by configuration. If it isn't then we assume
            // defaults.
            //
            if (communicator.GetProperty("TestAdapter.Endpoints") == null)
            {
                communicator.SetProperty("TestAdapter.Endpoints", getTestEndpoint(0));
            }

            if (communicator.GetProperty("ControllerAdapter.Endpoints") == null)
            {
                communicator.SetProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp"));
                communicator.SetProperty("ControllerAdapter.ThreadPool.Size", "1");
            }

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

            BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);

            BackgroundI backgroundI = new BackgroundI(backgroundController);

            adapter.Add(backgroundI, "background");

            LocatorI locatorI = new LocatorI(backgroundController);
            adapter.Add(locatorI, "locator");

            RouterI routerI = new RouterI(backgroundController);
            adapter.Add(routerI, "router");
            adapter.Activate();

            adapter2.Add(backgroundController, "backgroundController");
            adapter2.Activate();

            communicator.waitForShutdown();
        }
    }