use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class TwitterRemoteServiceTest method testGetProxy.
public void testGetProxy() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
try {
IUserTimeline userTimeline = (IUserTimeline) restClientService.getProxy();
assertNotNull(userTimeline);
} catch (ECFException e) {
fail("Could not contact the service");
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class TwitterRemoteServiceTest method testSyncCall.
public void testSyncCall() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
try {
Object result = restClientService.callSync(RestCallFactory.createRestCall(IUserTimeline.class.getName() + ".getUserStatuses"));
assertNotNull(result);
} catch (ECFException e) {
fail("Could not contact the service");
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class TwitterRemoteServiceTest method testAsyncCall.
public void testAsyncCall() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
IFuture future = restClientService.callAsync(RestCallFactory.createRestCall(IUserTimeline.class.getName() + ".getUserStatuses"));
try {
Object response = future.get();
assertTrue(response instanceof IUserStatus[]);
} 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 TwitterRemoteServiceTest method testSyncCallWithCountParameter.
public void testSyncCallWithCountParameter() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
try {
Object result = restClientService.callSync(RestCallFactory.createRestCall(IUserTimeline.class.getName() + ".getUserStatuses", new IRemoteCallParameter[] { new RemoteCallParameter("count", "1") }));
assertNotNull(result);
assertTrue(result instanceof IUserStatus[]);
assertTrue(((IUserStatus[]) result).length == 1);
} catch (ECFException e) {
fail("Could not contact the service");
}
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class AbstractRemoteServiceAccessTest method testCallFuture.
public void testCallFuture() 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
final IFuture futureResult = rs.callAsync(createRemoteCall());
// now get result from futureResult
final Object result = futureResult.get();
Trace.trace(Activator.PLUGIN_ID, "callSync.doStuff1 result=" + result);
assertStringResultValid(result, TestServiceInterface1.TEST_SERVICE_STRING1);
}
Aggregations