use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class TwitterRemoteServiceTest method testProxyCall.
public void testProxyCall() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
try {
IUserTimeline userTimeline = (IUserTimeline) restClientService.getProxy();
IUserStatus[] statuses = userTimeline.getUserStatuses();
assertNotNull(statuses);
} 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 testSyncCallWithCountParameter1.
public void testSyncCallWithCountParameter1() {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
try {
Object result = restClientService.callSync(RestCallFactory.createRestCall(IUserTimeline.class.getName() + ".getUserStatuses", new String[] { "1" }));
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 testAsyncCallWithListener.
public void testAsyncCallWithListener() throws Exception {
IRemoteService restClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registration.getReference());
restClientService.callAsync(RestCallFactory.createRestCall(IUserTimeline.class.getName() + ".getUserStatuses"), new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) event;
Object response = cce.getResponse();
assertTrue(response instanceof IUserStatus[]);
syncNotify();
}
}
});
syncWaitForNotify(10000);
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class AbstractRemoteServiceTest method testAsyncResult.
public void testAsyncResult() throws Exception {
final IRemoteService service = registerAndGetRemoteService();
if (service == null)
return;
traceCallStart("callAsynchResult");
final IFuture result = service.callAsync(createRemoteConcat("ECF AsynchResults ", "are cool"));
traceCallEnd("callAsynchResult", result);
assertNotNull(result);
Thread.sleep(SLEEPTIME);
}
use of org.eclipse.ecf.remoteservice.IRemoteService in project ecf by eclipse.
the class AbstractRemoteServiceAccessTest method testFireAsync.
public void testFireAsync() 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.fireAsync(createRemoteCall());
Thread.sleep(REGISTER_WAIT);
}
Aggregations