use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class AbstractRemoteServiceAccessTest method testCallAsync.
public void testCallAsync() throws Exception {
createServiceTrackerAndRegister();
// Client - Get service references from service tracker
final ServiceReference[] remoteReferences = st.getServiceReferences();
assertReferencesValid(remoteReferences);
final Object o = remoteReferences[0].getProperty(RemoteConstants.SERVICE_IMPORTED);
assertNotNull(o);
assertTrue(o instanceof IRemoteService);
final IRemoteService rs = (IRemoteService) o;
// Call asynchronously
rs.callAsync(createRemoteCall(), new IRemoteCallListener() {
public void handleEvent(final IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
final Object result = ((IRemoteCallCompleteEvent) event).getResponse();
Trace.trace(Activator.PLUGIN_ID, "callSync.doStuff1 result=" + result);
assertStringResultValid(result, TestServiceInterface1.TEST_SERVICE_STRING1);
syncNotify();
}
}
});
syncWaitForNotify(REGISTER_WAIT);
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class SSLSimpleTest method testSimpleClientAndServerWithCallSync.
public void testSimpleClientAndServerWithCallSync() throws Exception {
IRemoteService remoteService = client.getRemoteService();
assertNotNull(remoteService);
// Use callSync
String result = (String) remoteService.callSync(getRemoteConcatCall(TEST_STRING_2, TEST_STRING_1));
assertTrue(result != null && result.equals(TEST_STRING_2 + TEST_STRING_1));
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class SSLSimpleTest method testSimpleClientAndServerWithCallAsync.
public void testSimpleClientAndServerWithCallAsync() throws Exception {
IRemoteService remoteService = client.getRemoteService();
assertNotNull(remoteService);
// Use callSync
remoteService.callAsync(getRemoteConcatCall(TEST_STRING_2, TEST_STRING_1));
Thread.sleep(1000);
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class SSLSimpleTest method testSimpleClientAndServerWithCallAsyncListener.
public void testSimpleClientAndServerWithCallAsyncListener() throws Exception {
IRemoteService remoteService = client.getRemoteService();
assertNotNull(remoteService);
// Use callSync
remoteService.callAsync(getRemoteConcatCall(TEST_STRING_2, TEST_STRING_1), new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
result = (String) ((IRemoteCallCompleteEvent) event).getResponse();
}
}
});
Thread.sleep(1000);
assertNotNull(result);
assertTrue(result.equals(TEST_STRING_2 + TEST_STRING_1));
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class SSLSimpleTest method testSimpleClientAndServerWithFuture.
public void testSimpleClientAndServerWithFuture() throws Exception {
IRemoteService remoteService = client.getRemoteService();
assertNotNull(remoteService);
// Use callSync
IFuture future = remoteService.callAsync(getRemoteConcatCall(TEST_STRING_2, TEST_STRING_1));
assertNotNull(future);
String result = (String) future.get();
assertTrue(result.equals(TEST_STRING_2 + TEST_STRING_1));
}
Aggregations