use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class RpcRemoteServiceAdapterTest method testGetRemoteService.
public void testGetRemoteService() {
IRemoteServiceRegistration registration = createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
IRemoteServiceReference reference = registration.getReference();
assertNotNull(reference);
IRemoteService remoteService = getRemoteServiceClientContainerAdapter().getRemoteService(reference);
assertNotNull(remoteService);
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class RpcRemoteServiceTest method testAsynCall.
public void testAsynCall() {
IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationCalc.getReference());
IFuture future = rpcClientService.callAsync(getCalcPlusCall());
try {
Object response = future.get();
assertTrue(response instanceof Integer);
} catch (OperationCanceledException e) {
fail(e.getMessage());
} catch (InterruptedException e) {
fail(e.getMessage());
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class RpcRemoteServiceTest method testCallViaProxy2.
public void testCallViaProxy2() {
IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationEchoProxy.getReference());
try {
IEcho echo = (IEcho) rpcClientService.getProxy();
assertNotNull(echo);
Object result = echo.echo(ECHO_TEST_DATA);
assertNotNull(result);
assertEquals(result, ECHO_TEST_DATA);
} catch (ECFException e) {
e.printStackTrace();
fail("Could not contact the service");
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class RpcRemoteServiceTest method testCallViaProxy.
public void testCallViaProxy() {
IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationEchoProxy.getReference());
try {
IEcho echo = (IEcho) rpcClientService.getProxy(Activator.class.getClassLoader(), new Class[] { IEcho.class });
assertNotNull(echo);
Object result = echo.echo(ECHO_TEST_DATA);
assertNotNull(result);
assertEquals(result, ECHO_TEST_DATA);
} catch (ECFException e) {
e.printStackTrace();
fail("Could not contact the service");
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class RpcRemoteServiceTest method testAsyncCallWithListener.
public void testAsyncCallWithListener() throws Exception {
IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationCalc.getReference());
rpcClientService.callAsync(getCalcPlusCall(), new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) event;
Object response = cce.getResponse();
assertTrue(response instanceof Integer);
syncNotify();
}
}
});
syncWaitForNotify(10000);
}
Aggregations