當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。