Ejemplo n.º 1
0
        public override void setUp(Ice.Current context__)
        {
            Automation.AddAutomationEventHandler(
                WindowPattern.WindowOpenedEvent,
                AutomationElement.RootElement, TreeScope.Subtree,
                OnWindowOpened);

            process = application.connect(arguments);
        }
Ejemplo n.º 2
0
    public override void run(string[] args)
    {
        Properties properties = createTestProperties(ref args);

        properties.setProperty("Ice.Default.Host", "127.0.0.1");
        using (var communicator = initialize(properties))
        {
            AllTests.allTests(this);
            //
            // Shutdown the IceBox server.
            //
            ProcessPrx.Parse("DemoIceBox/admin -f Process:default -p 9996", communicator).shutdown();
        }
    }
Ejemplo n.º 3
0
Archivo: Client.cs Proyecto: motuii/ice
    public override void run(string[] args)
    {
        Ice.Properties properties = createTestProperties(ref args);
        //
        // We must disable connection warnings, because we attempt to
        // ping the router before session establishment, as well as
        // after session destruction. Both will cause a
        // ConnectionLostException.
        //
        properties.setProperty("Ice.Warn.Connections", "0");
        using (var communicator = initialize(properties))
        {
            IObjectPrx routerBase;
            {
                Console.Out.Write("testing stringToProxy for router... ");
                Console.Out.Flush();
                routerBase = IObjectPrx.Parse($"Glacier2/router:{getTestEndpoint(50)}", communicator);
                Console.Out.WriteLine("ok");
            }

            Glacier2.RouterPrx router;
            {
                Console.Out.Write("testing checked cast for router... ");
                Console.Out.Flush();
                router = Glacier2.RouterPrx.CheckedCast(routerBase);
                test(router != null);
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("testing router finder... ");
                Console.Out.Flush();
                RouterFinderPrx finder = RouterFinderPrx.Parse($"Ice/RouterFinder:{getTestEndpoint(50)}", communicator);
                test(finder.getRouter().Identity.Equals(router.Identity));
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("installing router with communicator... ");
                Console.Out.Flush();
                communicator.setDefaultRouter(router);
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("getting the session timeout... ");
                Console.Out.Flush();
                long timeout = router.getSessionTimeout();
                test(timeout == 30);
                Console.Out.WriteLine("ok");
            }

            IObjectPrx @base;
            {
                Console.Out.Write("testing stringToProxy for server object... ");
                Console.Out.Flush();
                @base = IObjectPrx.Parse($"c1/callback:{getTestEndpoint(0)}", communicator);
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("trying to ping server before session creation... ");
                Console.Out.Flush();
                try
                {
                    @base.IcePing();
                    test(false);
                }
                catch (Ice.ConnectionLostException)
                {
                    Console.Out.WriteLine("ok");
                }
                catch (Ice.SocketException)
                {
                    test(false);
                }
            }

            {
                Console.Out.Write("trying to create session with wrong password... ");
                Console.Out.Flush();
                try
                {
                    router.createSession("userid", "xxx");
                    test(false);
                }
                catch (Glacier2.PermissionDeniedException)
                {
                    Console.Out.WriteLine("ok");
                }
                catch (Glacier2.CannotCreateSessionException)
                {
                    test(false);
                }
            }

            {
                Console.Out.Write("trying to destroy non-existing session... ");
                Console.Out.Flush();
                try
                {
                    router.destroySession();
                    test(false);
                }
                catch (Glacier2.SessionNotExistException)
                {
                    Console.Out.WriteLine("ok");
                }
            }

            {
                Console.Out.Write("creating session with correct password... ");
                Console.Out.Flush();
                try
                {
                    router.createSession("userid", "abc123");
                }
                catch (Glacier2.PermissionDeniedException)
                {
                    test(false);
                }
                catch (Glacier2.CannotCreateSessionException)
                {
                    test(false);
                }
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("trying to create a second session... ");
                Console.Out.Flush();
                try
                {
                    router.createSession("userid", "abc123");
                    test(false);
                }
                catch (Glacier2.PermissionDeniedException)
                {
                    test(false);
                }
                catch (Glacier2.CannotCreateSessionException)
                {
                    Console.Out.WriteLine("ok");
                }
            }

            {
                Console.Out.Write("pinging server after session creation... ");
                Console.Out.Flush();
                @base.IcePing();
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("pinging object with client endpoint... ");
                IObjectPrx baseC = IObjectPrx.Parse($"collocated:{getTestEndpoint(50)}", communicator);
                try
                {
                    baseC.IcePing();
                }
                catch (Ice.ObjectNotExistException)
                {
                }
                Console.Out.WriteLine("ok");
            }

            CallbackPrx twoway;

            {
                Console.Out.Write("testing checked cast for server object... ");
                Console.Out.Flush();
                twoway = CallbackPrx.CheckedCast(@base);
                test(twoway != null);
                Console.Out.WriteLine("ok");
            }

            Ice.ObjectAdapter adapter;

            {
                Console.Out.Write("creating and activating callback receiver adapter... ");
                Console.Out.Flush();
                communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0");
                adapter = communicator.createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
                adapter.Activate();
                Console.Out.WriteLine("ok");
            }

            string category;

            {
                Console.Out.Write("getting category from router... ");
                Console.Out.Flush();
                category = router.getCategoryForClient();
                Console.Out.WriteLine("ok");
            }

            CallbackReceiverI   callbackReceiverImpl;
            CallbackReceiver    callbackReceiver;
            CallbackReceiverPrx twowayR;
            CallbackReceiverPrx fakeTwowayR;

            {
                Console.Out.Write("creating and adding callback receiver object... ");
                Console.Out.Flush();
                callbackReceiverImpl = new CallbackReceiverI();
                callbackReceiver     = callbackReceiverImpl;
                Ice.Identity callbackReceiverIdent = new Ice.Identity();
                callbackReceiverIdent.name     = "callbackReceiver";
                callbackReceiverIdent.category = category;
                twowayR = adapter.Add(callbackReceiver, callbackReceiverIdent);
                Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity();
                fakeCallbackReceiverIdent.name     = "callbackReceiver";
                fakeCallbackReceiverIdent.category = "dummy";
                fakeTwowayR = adapter.Add(callbackReceiver, fakeCallbackReceiverIdent);
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("testing oneway callback... ");
                Console.Out.Flush();
                CallbackPrx                 oneway  = twoway.Clone(oneway: true);
                CallbackReceiverPrx         onewayR = twowayR.Clone(oneway: true);
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "o";
                oneway.initiateCallback(onewayR, context);
                callbackReceiverImpl.callbackOK();
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("testing twoway callback... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                twoway.initiateCallback(twowayR, context);
                callbackReceiverImpl.callbackOK();
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("ditto, but with user exception... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                try
                {
                    twoway.initiateCallbackEx(twowayR, context);
                    test(false);
                }
                catch (CallbackException ex)
                {
                    test(ex.someValue == 3.14);
                    test(ex.someString.Equals("3.14"));
                }
                callbackReceiverImpl.callbackOK();
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("trying twoway callback with fake category... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                try
                {
                    twoway.initiateCallback(fakeTwowayR, context);
                    test(false);
                }
                catch (Ice.ObjectNotExistException)
                {
                    Console.Out.WriteLine("ok");
                }
            }

            {
                Console.Out.Write("testing whether other allowed category is accepted... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                CallbackPrx otherCategoryTwoway =
                    CallbackPrx.UncheckedCast(twoway.Clone(Ice.Util.stringToIdentity("c2/callback")));
                otherCategoryTwoway.initiateCallback(twowayR, context);
                callbackReceiverImpl.callbackOK();
                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("testing whether disallowed category gets rejected... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                try
                {
                    CallbackPrx otherCategoryTwoway =
                        CallbackPrx.UncheckedCast(twoway.Clone(Ice.Util.stringToIdentity("c3/callback")));
                    otherCategoryTwoway.initiateCallback(twowayR, context);
                    test(false);
                }
                catch (Ice.ObjectNotExistException)
                {
                    Console.Out.WriteLine("ok");
                }
            }

            {
                Console.Out.Write("testing whether user-id as category is accepted... ");
                Console.Out.Flush();
                Dictionary <string, string> context = new Dictionary <string, string>();
                context["_fwd"] = "t";
                CallbackPrx otherCategoryTwoway =
                    CallbackPrx.UncheckedCast(twoway.Clone(Ice.Util.stringToIdentity("_userid/callback")));
                otherCategoryTwoway.initiateCallback(twowayR, context);
                callbackReceiverImpl.callbackOK();
                Console.Out.WriteLine("ok");
            }

            if (args.Length >= 1 && args[0].Equals("--shutdown"))
            {
                Console.Out.Write("testing server shutdown... ");
                Console.Out.Flush();
                twoway.shutdown();
                // No ping, otherwise the router prints a warning message if it's
                // started with --Ice.Warn.Connections.
                Console.Out.WriteLine("ok");

                /*
                 * try
                 * {
                 * base.IcePing();
                 * test(false);
                 * }
                 * // If we use the glacier router, the exact exception reason gets
                 * // lost.
                 * catch(Ice.UnknownLocalException ex)
                 * {
                 * Console.Out.WriteLine("ok");
                 * }
                 */
            }

            {
                Console.Out.Write("destroying session... ");
                Console.Out.Flush();
                try
                {
                    router.destroySession();
                }
                catch (Ice.LocalException)
                {
                    test(false);
                }

                Console.Out.WriteLine("ok");
            }

            {
                Console.Out.Write("trying to ping server after session destruction... ");
                Console.Out.Flush();
                try
                {
                    @base.IcePing();
                    test(false);
                }
                catch (Ice.ConnectionLostException)
                {
                    Console.Out.WriteLine("ok");
                }
                catch (Ice.SocketException)
                {
                    test(false);
                }
            }

            if (args.Length >= 1 && args[0].Equals("--shutdown"))
            {
                {
                    Console.Out.Write("uninstalling router with communicator... ");
                    Console.Out.Flush();
                    communicator.setDefaultRouter(null);
                    Console.Out.WriteLine("ok");
                }

                IObjectPrx processBase;
                {
                    Console.Out.Write("testing stringToProxy for admin object... ");
                    processBase = IObjectPrx.Parse($"Glacier2/admin -f Process:{getTestEndpoint(51)}", communicator);
                    Console.Out.WriteLine("ok");
                }

                /*
                 * {
                 * Console.Out.Write("uninstalling router with process object... ");
                 * processBase.ice_router(null);
                 * Console.Out.WriteLine("ok");
                 * }
                 */

                ProcessPrx process;
                {
                    Console.Out.Write("testing checked cast for process object... ");
                    process = ProcessPrx.CheckedCast(processBase);
                    process.IcePing();
                    Console.Out.WriteLine("ok");
                }

                Console.Out.Write("testing Glacier2 shutdown... ");
                process.shutdown();
                try
                {
                    process.IcePing();
                    test(false);
                }
                catch (LocalException)
                {
                    Console.Out.WriteLine("ok");
                }
            }
        }
    }
Ejemplo n.º 4
0
            public static void allTests(global::Test.TestHelper helper)
            {
                Communicator communicator = helper.communicator();
                var          output       = helper.getWriter();

                output.Write("testing communicator operations... ");
                output.Flush();
                {
                    //
                    // Test: Exercise AddAdminFacet, FindAdminFacet, RemoveAdminFacet with a typical configuration.
                    //
                    InitializationData init = new InitializationData();
                    init.properties = Util.createProperties();
                    init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    init.properties.setProperty("Ice.Admin.InstanceName", "Test");
                    Communicator com = Util.initialize(init);
                    testFacets(com, true, false);
                    com.destroy();
                }
                {
                    //
                    // Test: Verify that the operations work correctly in the presence of facet filters.
                    //
                    Ice.InitializationData init = new Ice.InitializationData();
                    init.properties = Ice.Util.createProperties();
                    init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    init.properties.setProperty("Ice.Admin.InstanceName", "Test");
                    init.properties.setProperty("Ice.Admin.Facets", "Properties");
                    Ice.Communicator com = Ice.Util.initialize(init);
                    testFacets(com, false, true);
                    com.destroy();
                }
                {
                    //
                    // Test: Verify that the operations work correctly with the Admin object disabled.
                    //
                    Ice.Communicator com = Ice.Util.initialize();
                    testFacets(com, false, false);
                    com.destroy();
                }
                {
                    //
                    // Test: Verify that the operations work correctly with Ice.Admin.Enabled=1
                    //
                    Ice.InitializationData init = new Ice.InitializationData();
                    init.properties = Ice.Util.createProperties();
                    init.properties.setProperty("Ice.Admin.Enabled", "1");
                    Ice.Communicator com = Ice.Util.initialize(init);
                    test(com.getAdmin() == null);
                    Ice.Identity id = Identity.Parse("test-admin");
                    try
                    {
                        com.CreateAdmin(null, id);
                        test(false);
                    }
                    catch (Ice.InitializationException)
                    {
                    }

                    ObjectAdapter adapter = com.createObjectAdapter("");
                    test(com.CreateAdmin(adapter, id) != null);
                    test(com.getAdmin() != null);

                    testFacets(com, true, false);
                    com.destroy();
                }
                {
                    //
                    // Test: Verify that the operations work correctly when creation of the Admin object is delayed.
                    //
                    Ice.InitializationData init = new Ice.InitializationData();
                    init.properties = Ice.Util.createProperties();
                    init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    init.properties.setProperty("Ice.Admin.InstanceName", "Test");
                    init.properties.setProperty("Ice.Admin.DelayCreation", "1");
                    Ice.Communicator com = Ice.Util.initialize(init);
                    testFacets(com, true, false);
                    com.getAdmin();
                    testFacets(com, true, false);
                    com.destroy();
                }
                output.WriteLine("ok");

                var factory = RemoteCommunicatorFactoryPrx.Parse($"factory:{helper.getTestEndpoint(0)} -t 10000",
                                                                 communicator);

                output.Write("testing process facet... ");
                output.Flush();
                {
                    //
                    // Test: Verify that Process::shutdown() operation shuts down the communicator.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    var        com  = factory.createCommunicator(props);
                    IObjectPrx obj  = com.getAdmin();
                    ProcessPrx proc = ProcessPrx.UncheckedCast(obj.Clone(facet: "Process"));
                    proc.shutdown();
                    com.waitForShutdown();
                    com.destroy();
                }
                output.WriteLine("ok");

                output.Write("testing properties facet... ");
                output.Flush();
                {
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Prop1", "1");
                    props.Add("Prop2", "2");
                    props.Add("Prop3", "3");
                    var                com = factory.createCommunicator(props);
                    IObjectPrx         obj = com.getAdmin();
                    PropertiesAdminPrx pa  = PropertiesAdminPrx.UncheckedCast(obj.Clone(facet: "Properties"));

                    //
                    // Test: PropertiesAdmin::getProperty()
                    //
                    test(pa.getProperty("Prop2").Equals("2"));
                    test(pa.getProperty("Bogus").Equals(""));

                    //
                    // Test: PropertiesAdmin::getProperties()
                    //
                    Dictionary <string, string> pd = pa.getPropertiesForPrefix("");
                    test(pd.Count == 5);
                    test(pd["Ice.Admin.Endpoints"].Equals("tcp -h 127.0.0.1"));
                    test(pd["Ice.Admin.InstanceName"].Equals("Test"));
                    test(pd["Prop1"].Equals("1"));
                    test(pd["Prop2"].Equals("2"));
                    test(pd["Prop3"].Equals("3"));

                    Dictionary <string, string> changes;

                    //
                    // Test: PropertiesAdmin::setProperties()
                    //
                    Dictionary <string, string> setProps = new Dictionary <string, string>();
                    setProps.Add("Prop1", "10"); // Changed
                    setProps.Add("Prop2", "20"); // Changed
                    setProps.Add("Prop3", "");   // Removed
                    setProps.Add("Prop4", "4");  // Added
                    setProps.Add("Prop5", "5");  // Added
                    pa.setProperties(setProps);
                    test(pa.getProperty("Prop1").Equals("10"));
                    test(pa.getProperty("Prop2").Equals("20"));
                    test(pa.getProperty("Prop3").Equals(""));
                    test(pa.getProperty("Prop4").Equals("4"));
                    test(pa.getProperty("Prop5").Equals("5"));
                    changes = com.getChanges();
                    test(changes.Count == 5);
                    test(changes["Prop1"].Equals("10"));
                    test(changes["Prop2"].Equals("20"));
                    test(changes["Prop3"].Equals(""));
                    test(changes["Prop4"].Equals("4"));
                    test(changes["Prop5"].Equals("5"));
                    pa.setProperties(setProps);
                    changes = com.getChanges();
                    test(changes.Count == 0);

                    com.destroy();
                }
                output.WriteLine("ok");

                output.Write("testing logger facet... ");
                output.Flush();
                {
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("NullLogger", "1");
                    var com = factory.createCommunicator(props);

                    com.trace("testCat", "trace");
                    com.warning("warning");
                    com.error("error");
                    com.print("print");

                    IObjectPrx     obj    = com.getAdmin();
                    LoggerAdminPrx logger = LoggerAdminPrx.UncheckedCast(obj.Clone(facet: "Logger"));
                    test(logger != null);

                    string prefix = null;

                    //
                    // Get all
                    //
                    LogMessage[] logMessages = logger.getLog(null, null, -1, out prefix);

                    test(logMessages.Length == 4);
                    test(prefix.Equals("NullLogger"));
                    test(logMessages[0].traceCategory.Equals("testCat") && logMessages[0].message.Equals("trace"));
                    test(logMessages[1].message.Equals("warning"));
                    test(logMessages[2].message.Equals("error"));
                    test(logMessages[3].message.Equals("print"));

                    //
                    // Get only errors and warnings
                    //
                    com.error("error2");
                    com.print("print2");
                    com.trace("testCat", "trace2");
                    com.warning("warning2");

                    LogMessageType[] messageTypes = { LogMessageType.ErrorMessage, LogMessageType.WarningMessage };

                    logMessages = logger.getLog(messageTypes, null, -1, out prefix);

                    test(logMessages.Length == 4);
                    test(prefix.Equals("NullLogger"));

                    foreach (var msg in logMessages)
                    {
                        test(msg.type == LogMessageType.ErrorMessage || msg.type == LogMessageType.WarningMessage);
                    }

                    //
                    // Get only errors and traces with Cat = "testCat"
                    //
                    com.trace("testCat2", "A");
                    com.trace("testCat", "trace3");
                    com.trace("testCat2", "B");

                    messageTypes = new LogMessageType[] { LogMessageType.ErrorMessage, LogMessageType.TraceMessage };
                    string[] categories = { "testCat" };
                    logMessages = logger.getLog(messageTypes, categories, -1, out prefix);
                    test(logMessages.Length == 5);
                    test(prefix.Equals("NullLogger"));

                    foreach (var msg in logMessages)
                    {
                        test(msg.type == LogMessageType.ErrorMessage ||
                             (msg.type == LogMessageType.TraceMessage && msg.traceCategory.Equals("testCat")));
                    }

                    //
                    // Same, but limited to last 2 messages(trace3 + error3)
                    //
                    com.error("error3");

                    logMessages = logger.getLog(messageTypes, categories, 2, out prefix);
                    test(logMessages.Length == 2);
                    test(prefix.Equals("NullLogger"));

                    test(logMessages[0].message.Equals("trace3"));
                    test(logMessages[1].message.Equals("error3"));

                    //
                    // Now, test RemoteLogger
                    //
                    ObjectAdapter adapter =
                        communicator.createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost");

                    RemoteLoggerI remoteLogger = new RemoteLoggerI();

                    RemoteLoggerPrx myProxy = adapter.Add(remoteLogger);

                    adapter.Activate();

                    //
                    // No filtering
                    //
                    logMessages = logger.getLog(null, null, -1, out prefix);

                    logger.attachRemoteLogger(myProxy, null, null, -1);
                    remoteLogger.wait(1);

                    foreach (var m in logMessages)
                    {
                        remoteLogger.checkNextInit(prefix, m.type, m.message, m.traceCategory);
                    }

                    com.trace("testCat", "rtrace");
                    com.warning("rwarning");
                    com.error("rerror");
                    com.print("rprint");

                    remoteLogger.wait(4);

                    remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat");
                    remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", "");
                    remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", "");
                    remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", "");

                    test(logger.detachRemoteLogger(myProxy));
                    test(!logger.detachRemoteLogger(myProxy));

                    //
                    // Use Error + Trace with "traceCat" filter with 4 limit
                    //
                    logMessages = logger.getLog(messageTypes, categories, 4, out prefix);
                    test(logMessages.Length == 4);

                    logger.attachRemoteLogger(myProxy, messageTypes, categories, 4);
                    remoteLogger.wait(1);

                    foreach (var m in logMessages)
                    {
                        remoteLogger.checkNextInit(prefix, m.type, m.message, m.traceCategory);
                    }

                    com.warning("rwarning2");
                    com.trace("testCat", "rtrace2");
                    com.warning("rwarning3");
                    com.error("rerror2");
                    com.print("rprint2");

                    remoteLogger.wait(2);

                    remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat");
                    remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", "");

                    //
                    // Attempt reconnection with slightly different proxy
                    //
                    try
                    {
                        logger.attachRemoteLogger(myProxy.Clone(oneway: true), messageTypes, categories, 4);
                        test(false);
                    }
                    catch (Ice.RemoteLoggerAlreadyAttachedException)
                    {
                        // expected
                    }

                    com.destroy();
                }
                output.WriteLine("ok");

                output.Write("testing custom facet... ");
                output.Flush();
                {
                    //
                    // Test: Verify that the custom facet is present.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    var        com = factory.createCommunicator(props);
                    IObjectPrx obj = com.getAdmin();
                    var        tf  = TestFacetPrx.UncheckedCast(obj.Clone(facet: "TestFacet"));
                    tf.op();
                    com.destroy();
                }
                output.WriteLine("ok");

                output.Write("testing facet filtering... ");
                output.Flush();
                {
                    //
                    // Test: Set Ice.Admin.Facets to expose only the Properties facet,
                    // meaning no other facet is available.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Ice.Admin.Facets", "Properties");
                    var        com = factory.createCommunicator(props);
                    IObjectPrx obj = com.getAdmin();
                    try
                    {
                        ProcessPrx.CheckedCast(obj.Clone(facet: "Process"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }

                    try
                    {
                        TestFacetPrx.CheckedCast(obj.Clone(facet: "TestFacet"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }
                    com.destroy();
                }
                {
                    //
                    // Test: Set Ice.Admin.Facets to expose only the Process facet,
                    // meaning no other facet is available.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Ice.Admin.Facets", "Process");
                    var        com = factory.createCommunicator(props);
                    IObjectPrx obj = com.getAdmin();
                    try
                    {
                        PropertiesAdminPrx.CheckedCast(obj.Clone(facet: "Properties"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }

                    try
                    {
                        TestFacetPrx.CheckedCast(obj.Clone(facet: "TestFacet"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }
                    com.destroy();
                }
                {
                    //
                    // Test: Set Ice.Admin.Facets to expose only the TestFacet facet,
                    // meaning no other facet is available.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Ice.Admin.Facets", "TestFacet");
                    var        com = factory.createCommunicator(props);
                    IObjectPrx obj = com.getAdmin();
                    try
                    {
                        PropertiesAdminPrx.CheckedCast(obj.Clone(facet: "Properties"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }

                    try
                    {
                        ProcessPrx.CheckedCast(obj.Clone(facet: "Process"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }
                    com.destroy();
                }
                {
                    //
                    // Test: Set Ice.Admin.Facets to expose two facets. Use whitespace to separate the
                    // facet names.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Ice.Admin.Facets", "Properties TestFacet");
                    var                com = factory.createCommunicator(props);
                    IObjectPrx         obj = com.getAdmin();
                    PropertiesAdminPrx pa  = PropertiesAdminPrx.UncheckedCast(obj.Clone(facet: "Properties"));
                    test(pa.getProperty("Ice.Admin.InstanceName").Equals("Test"));
                    var tf = TestFacetPrx.CheckedCast(obj.Clone(facet: "TestFacet"));
                    tf !.op();
                    try
                    {
                        ProcessPrx.CheckedCast(obj.Clone(facet: "Process"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }
                    com.destroy();
                }
                {
                    //
                    // Test: Set Ice.Admin.Facets to expose two facets. Use a comma to separate the
                    // facet names.
                    //
                    Dictionary <string, string> props = new Dictionary <string, string>();
                    props.Add("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
                    props.Add("Ice.Admin.InstanceName", "Test");
                    props.Add("Ice.Admin.Facets", "TestFacet, Process");
                    var        com = factory.createCommunicator(props);
                    IObjectPrx obj = com.getAdmin();
                    try
                    {
                        PropertiesAdminPrx.CheckedCast(obj.Clone(facet: "Properties"));
                        test(false);
                    }
                    catch (FacetNotExistException)
                    {
                    }
                    var tf = Test.TestFacetPrx.CheckedCast(obj.Clone(facet: "TestFacet"));
                    tf.op();
                    ProcessPrx proc = Ice.ProcessPrx.CheckedCast(obj.Clone(facet: "Process"));
                    proc.shutdown();
                    com.waitForShutdown();
                    com.destroy();
                }
                output.WriteLine("ok");

                factory.shutdown();
            }