当前位置: 首页>>代码示例>>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;未经允许,请勿转载。