當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Ice.proxyIdentityCompare方法代碼示例

本文整理匯總了TypeScript中ice.Ice.proxyIdentityCompare方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Ice.proxyIdentityCompare方法的具體用法?TypeScript Ice.proxyIdentityCompare怎麽用?TypeScript Ice.proxyIdentityCompare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ice.Ice的用法示例。


在下文中一共展示了Ice.proxyIdentityCompare方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: allTests

    async allTests()
    {
        const communicator = this.communicator();
        const out = this.getWriter();
        let base = communicator.stringToProxy("ServerManager:" + this.getTestEndpoint());
        const manager = Test.ServerManagerPrx.uncheckedCast(base);
        test(manager !== null);

        const locator = Test.TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator());
        test(locator !== null);

        const registry = Test.TestLocatorRegistryPrx.uncheckedCast(await locator.getRegistry());
        test(registry !== null);

        out.write("testing stringToProxy... ");
        base = communicator.stringToProxy("test @ TestAdapter");
        const base2 = communicator.stringToProxy("test @ TestAdapter");
        const base3 = communicator.stringToProxy("test");
        const base4 = communicator.stringToProxy("ServerManager");
        const base5 = communicator.stringToProxy("test2");
        const base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
        out.writeLine("ok");

        out.write("testing ice_locator and ice_getLocator... ");
        test(Ice.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) === 0);
        const anotherLocator = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("anotherLocator"));
        base = base.ice_locator(anotherLocator);
        test(Ice.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) === 0);
        communicator.setDefaultLocator(null);
        base = communicator.stringToProxy("test @ TestAdapter");
        test(base.ice_getLocator() === null);
        base = base.ice_locator(anotherLocator);
        test(Ice.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) === 0);
        communicator.setDefaultLocator(locator);
        base = communicator.stringToProxy("test @ TestAdapter");
        test(Ice.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) === 0);

        //
        // We also test ice_router/ice_getRouter (perhaps we should add a
        // test/Ice/router test?)
        //
        test(base.ice_getRouter() === null);
        const anotherRouter = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("anotherRouter"));
        base = base.ice_router(anotherRouter);
        test(Ice.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) === 0);
        const router = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("dummyrouter"));
        communicator.setDefaultRouter(router);
        base = communicator.stringToProxy("test @ TestAdapter");
        test(Ice.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) === 0);
        communicator.setDefaultRouter(null);
        base = communicator.stringToProxy("test @ TestAdapter");
        test(base.ice_getRouter() === null);
        out.writeLine("ok");

        out.write("starting server... ");
        await manager.startServer();
        out.writeLine("ok");

        out.write("testing checked cast... ");
        let obj = await Test.TestIntfPrx.checkedCast(base);
        test(obj !== null);

        const obj2 = await Test.TestIntfPrx.checkedCast(base2);
        test(obj2 !== null);

        const obj3 = await Test.TestIntfPrx.checkedCast(base3);
        test(obj3 !== null);

        const obj4 = await Test.ServerManagerPrx.checkedCast(base4);
        test(obj4 !== null);

        const obj5 = await Test.TestIntfPrx.checkedCast(base5);
        test(obj5 !== null);

        const obj6 = await Test.TestIntfPrx.checkedCast(base6);
        test(obj6 !== null);
        out.writeLine("ok");

        out.write("testing id@AdapterId indirect proxy... ");
        await obj.shutdown();
        await manager.startServer();
        await obj2.ice_ping();
        out.writeLine("ok");

        out.write("testing id@ReplicaGroupId indirect proxy... ");
        await obj.shutdown();
        await manager.startServer();
        await obj6.ice_ping();
        out.writeLine("ok");

        out.write("testing identity indirect proxy... ");
        await obj.shutdown();
        await manager.startServer();
        await obj3.ice_ping();
        await obj2.ice_ping();
        await obj.shutdown();
        await manager.startServer();
        await obj2.ice_ping();
        await obj3.ice_ping();
        await obj.shutdown();
//.........這裏部分代碼省略.........
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:101,代碼來源:Client.ts


注:本文中的ice.Ice.proxyIdentityCompare方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。