1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
using System.Linq;
using Test;
namespace Ice
{
namespace invoke
{
public class ServantLocatorI : Ice.ServantLocator
{
public ServantLocatorI(bool async)
{
if(async)
{
_blobject = new BlobjectAsyncI();
}
else
{
_blobject = new BlobjectI();
}
}
public Ice.Object
locate(Ice.Current current, out System.Object cookie)
{
cookie = null;
return _blobject;
}
public void
finished(Ice.Current current, Ice.Object servant, System.Object cookie)
{
}
public void
deactivate(string category)
{
}
private Ice.Object _blobject;
}
public class Server : TestHelper
{
public override void run(string[] args)
{
bool async = args.Any(v => v.Equals("--async"));
using(var communicator = initialize(ref args))
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.addServantLocator(new ServantLocatorI(async), "");
adapter.activate();
serverReady();
communicator.waitForShutdown();
}
}
public static int Main(string[] args)
{
return TestDriver.runTest<Server>(args);
}
}
}
}
|