本文整理汇总了TypeScript中ice.Ice类的典型用法代码示例。如果您正苦于以下问题:TypeScript Ice类的具体用法?TypeScript Ice怎么用?TypeScript Ice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ice类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: run
async run(args:string[])
{
let communicator:Ice.Communicator;
let echo:Test.EchoPrx;
try
{
const [properties] = this.createTestProperties(args);
properties.setProperty("Ice.Warn.Dispatch", "0");
[communicator] = this.initialize(properties);
echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint()));
const adapter = await communicator.createObjectAdapter("");
adapter.addServantLocator(new ServantLocatorI("category"), "category");
adapter.addServantLocator(new ServantLocatorI(""), "");
adapter.add(new TestI(), Ice.stringToIdentity("asm"));
adapter.add(new TestActivationI(), Ice.stringToIdentity("test/activation"));
await echo.setConnection();
echo.ice_getCachedConnection().setAdapter(adapter);
this.serverReady();
await adapter.waitForDeactivate();
}
finally
{
if(echo)
{
await echo.shutdown();
}
if(communicator)
{
await communicator.destroy();
}
}
}
示例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();
}
}
}
示例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)];
}
示例4: allTests
allTests()
{
const out = this.getWriter();
out.write("testing Slice predefined macros... ");
const d = new Test._Default();
test(d.x == 10);
test(d.y == 10);
const nd = new Test.NoDefault();
test(nd.x != 10);
test(nd.y != 10);
const c = new Test.JsOnly();
test(c.lang == "js");
test(c.version == Ice.intVersion());
out.writeLine("ok");
}
示例5: init
async init()
{
const initData = new Ice.InitializationData();
initData.properties = this._com.ice_getCommunicator().getProperties().clone();
initData.logger = this._logger;
initData.properties.setProperty("Ice.ACM.Timeout", "2");
if(this._clientACMTimeout >= 0)
{
initData.properties.setProperty("Ice.ACM.Client.Timeout", String(this._clientACMTimeout));
}
if(this._clientACMClose >= 0)
{
initData.properties.setProperty("Ice.ACM.Client.Close", String(this._clientACMClose));
}
if(this._clientACMHeartbeat >= 0)
{
initData.properties.setProperty("Ice.ACM.Client.Heartbeat", String(this._clientACMHeartbeat));
}
this._communicator = Ice.initialize(initData);
this._adapter = await this._com.createObjectAdapter(this._serverACMTimeout,
this._serverACMClose,
this._serverACMHeartbeat);
}
示例6: 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
//.........这里部分代码省略.........