当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Ice.stringToIdentity方法代码示例

本文整理汇总了TypeScript中ice.Ice.stringToIdentity方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Ice.stringToIdentity方法的具体用法?TypeScript Ice.stringToIdentity怎么用?TypeScript Ice.stringToIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ice.Ice的用法示例。


在下文中一共展示了Ice.stringToIdentity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: run

    async run(args:string[])
    {
        let communicator:Ice.Communicator;
        let echo;
        try
        {
            const [properties] = this.createTestProperties(args);
            properties.setProperty("Ice.Warn.Dispatch", "0");
            properties.setProperty("Ice.Warn.Connections", "0");
            [communicator] = this.initialize(properties);
            echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint()));
            const adapter = await communicator.createObjectAdapter("");
            adapter.add(new InitialI(communicator), Ice.stringToIdentity("initial"));
            adapter.add(new UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet"));
            await echo.setConnection();
            echo.ice_getCachedConnection().setAdapter(adapter);
            this.serverReady();
            await communicator.waitForShutdown();
        }
        finally
        {
            if(echo)
            {
                await echo.shutdown();
            }

            if(communicator)
            {
                await communicator.destroy();
            }
        }
    }
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:32,代码来源:Server.ts

示例2: run

    async run(args:string[])
    {
        let communicator:Ice.Communicator;
        let echo:Test.EchoPrx;
        try
        {
            const [properties] = this.createTestProperties(args);
            properties.setProperty("Ice.BatchAutoFlushSize", "100");
            [communicator] = this.initialize(properties);
            echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint()));
            const adapter = await communicator.createObjectAdapter("");
            adapter.add(new AMDMyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test"));
            await echo.setConnection();
            echo.ice_getCachedConnection().setAdapter(adapter);
            this.serverReady();
            await communicator.waitForShutdown();
        }
        finally
        {
            if(echo)
            {
                await echo.shutdown();
            }

            if(communicator)
            {
                await communicator.destroy();
            }
        }
    }
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:30,代码来源:ServerAMD.ts

示例3: opMyClass

 opMyClass(p1:Test.MyClassPrx, current:Ice.Current):[Test.MyClassPrx, Test.MyClassPrx, Test.MyClassPrx]
 {
     const p2 = p1;
     const p3 = Test.MyClassPrx.uncheckedCast(
         current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")));
     const r = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id));
     return [r.ice_endpoints(this._endpoints), p2, p3.ice_endpoints(this._endpoints)];
 }
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:8,代码来源:AMDMyDerivedClassI.ts

示例4: allTests

    async allTests()
    {
        class EmptyI extends Test.Empty
        {
        }

        class ServantLocatorI
        {
            locate(curr:Ice.Current, cookie:Object):Ice.Object
            {
                return null;
            }

            finished(curr:Ice.Current, servant:Ice.Object, cookie:Object):void
            {
            }

            deactivate(category:string):void
            {
            }
        }

        const out = this.getWriter();
        const communicator = this.communicator();
        out.write("testing object adapter registration exceptions... ");
        try
        {
            await communicator.createObjectAdapter("TestAdapter0");
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Ice.InitializationException, ex); // Expected
        }

        try
        {
            await communicator.createObjectAdapterWithEndpoints("TestAdapter0", "default");
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Ice.FeatureNotSupportedException, ex); // Expected
        }
        out.writeLine("ok");

        out.write("testing servant registration exceptions... ");
        {
            const adapter = await communicator.createObjectAdapter("");
            adapter.add(new EmptyI(), Ice.stringToIdentity("x"));
            try
            {
                adapter.add(new EmptyI(), Ice.stringToIdentity("x"));
                test(false);
            }
            catch(ex)
            {
                test(ex instanceof Ice.AlreadyRegisteredException, ex);
            }

            try
            {
                adapter.add(new EmptyI(), Ice.stringToIdentity(""));
                test(false);
            }
            catch(ex)
            {
                test(ex instanceof Ice.IllegalIdentityException, ex);
                test(ex.id.name === "");
            }

            try
            {
                adapter.add(null, Ice.stringToIdentity("x"));
                test(false);
            }
            catch(ex)
            {
                test(ex instanceof Ice.IllegalServantException, ex);
            }

            adapter.remove(Ice.stringToIdentity("x"));
            try
            {
                adapter.remove(Ice.stringToIdentity("x"));
                test(false);
            }
            catch(ex)
            {
                test(ex instanceof Ice.NotRegisteredException, ex);
            }
            await adapter.deactivate();
        }
        out.writeLine("ok");

        out.write("testing servant locator registration exceptions... ");
        {
            const adapter = await communicator.createObjectAdapter("");
            adapter.addServantLocator(new ServantLocatorI(), "x");
            try
//.........这里部分代码省略.........
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:101,代码来源:Client.ts

示例5: run


//.........这里部分代码省略.........
    }
    catch(ex)
    {
        test(ex instanceof Ice.MarshalException, ex);
    }

    await prx.opFloatDouble(Number.NaN, Number.NaN);
    await prx.opFloatDouble(-Number.NaN, -Number.NaN);
    await prx.opFloatDouble(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
    await prx.opFloatDouble(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);

    {
        const [retval, p3] = await prx.opString("hello", "world");
        test(p3 === "world hello");
        test(retval === "hello world");
    }

    {
        const [retval, p2] = await prx.opMyEnum(Test.MyEnum.enum2);
        test(p2 === Test.MyEnum.enum2);
        test(retval === Test.MyEnum.enum3);
    }

    {
        // Test null enum
        const [retval, p2] = await prx.opMyEnum(null);
        test(p2 === Test.MyEnum.enum1);
        test(retval === Test.MyEnum.enum3);
    }

    {
            const [retval, p2, p3] = await prx.opMyClass(prx);

        test(p2.ice_getIdentity().equals(Ice.stringToIdentity("test")));
        test(p3.ice_getIdentity().equals(Ice.stringToIdentity("noSuchIdentity")));
        test(retval.ice_getIdentity().equals(Ice.stringToIdentity("test")));
    }

    {
        const si1 = new Test.Structure();
        si1.p = prx;
        si1.e = Test.MyEnum.enum3;
        si1.s = new Test.AnotherStruct();
        si1.s.s = "abc";
        const si2 = new Test.Structure();
        si2.p = null;
        si2.e = Test.MyEnum.enum2;
        si2.s = new Test.AnotherStruct();
        si2.s.s = "def";

        const [retval, p3] = await prx.opStruct(si1, si2);
        test(retval.p === null);
        test(retval.e === Test.MyEnum.enum2);
        test(retval.s.s === "def");
        test(p3.p !== null);
        test(p3.e === Test.MyEnum.enum3);
        test(p3.s.s === "a new string");
    }

    {
        const si1 = new Test.Structure();
        // Test null struct
        const [retval, p3] = await prx.opStruct(si1, null);

        test(retval.p === null);
        test(retval.e === Test.MyEnum.enum1);
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:67,代码来源:Twoways.ts

示例6: allTests


//.........这里部分代码省略.........
        context.set("_fwd", "t");
        try
        {
            await twoway.initiateCallbackEx(twowayR, context);
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Test.CallbackException, ex);
            test(ex.someValue == 3.14);
            test(ex.someString == "3.14");
        }

        await callbackReceiverImpl.callbackOK();
        out.writeLine("ok");

        out.write("trying twoway callback with fake category... ");
        context = new Ice.Context();
        context.set("_fwd", "t");
        try
        {
            await twoway.initiateCallback(fakeTwowayR, context);
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Ice.ObjectNotExistException, ex);
        }
        out.writeLine("ok");

        out.write("testing whether other allowed category is accepted... ");
        context = new Ice.Context();
        context.set("_fwd", "t");
        let otherCategoryTwoway = CallbackPrx.uncheckedCast(twoway.ice_identity(Ice.stringToIdentity("c2/callback")));
        await otherCategoryTwoway.initiateCallback(twowayR, context);
        await callbackReceiverImpl.callbackOK();
        out.writeLine("ok");

        out.write("testing whether disallowed category gets rejected... ");
        context = new Ice.Context();
        context.set("_fwd", "t");
        otherCategoryTwoway = CallbackPrx.uncheckedCast(twoway.ice_identity(Ice.stringToIdentity("c3/callback")));
        try
        {
            await otherCategoryTwoway.initiateCallback(twowayR, context);
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Ice.ObjectNotExistException, ex);
        }
        out.writeLine("ok");

        out.write("testing whether user-id as category is accepted... ");
        context = new Ice.Context();
        context.set("_fwd", "t");
        otherCategoryTwoway = CallbackPrx.uncheckedCast(twoway.ice_identity(Ice.stringToIdentity("_userid/callback")));
        await otherCategoryTwoway.initiateCallback(twowayR, context);
        await callbackReceiverImpl.callbackOK();
        out.writeLine("ok");

        if(shutdown)
        {
            out.write("testing server shutdown... ");
            await twoway.shutdown();
            out.writeLine("ok");
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:67,代码来源:Client.ts


注:本文中的ice.Ice.stringToIdentity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。