use of org.eclipse.ecf.remoteservice.IRemoteCallListener in project ecf by eclipse.
the class Activator method createRemoteCallListener.
private IRemoteCallListener createRemoteCallListener() {
return new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) event;
if (!cce.hadException()) {
System.out.println("Remote call completed successfully!");
SyndFeed feed = (SyndFeed) cce.getResponse();
printFeedContent(feed);
} else {
System.out.println("Remote call completed with exception: " + cce.getException());
}
}
}
};
}
use of org.eclipse.ecf.remoteservice.IRemoteCallListener in project ecf by eclipse.
the class AbstractRemoteServiceAccessTest method testCallAsync.
public void testCallAsync() throws Exception {
startTest("testCallAsync");
createServiceTrackerAndRegister();
// Client - Get service references from service tracker
final ServiceReference[] remoteReferences = st.getServiceReferences();
assertReferencesValid(remoteReferences);
final Object o = remoteReferences[0].getProperty(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);
endTest("testCallAsync");
}
Aggregations