use of org.eclipse.ecf.core.util.ECFException in project ecf by eclipse.
the class AbstractRemoteServiceTest method testBadCallSynch.
public void testBadCallSynch() throws Exception {
final IRemoteService service = registerAndGetRemoteService();
if (service == null)
return;
// exist
try {
service.callSync(createRemoteCall("concat1", new Object[] { "first", "second" }));
fail();
} catch (final ECFException e) {
// Exception should occur
}
// concat
try {
service.callSync(createRemoteCall("concat", new Object[] { "first" }));
fail();
} catch (final ECFException e) {
// Exception should occur
}
Thread.sleep(SLEEPTIME);
}
use of org.eclipse.ecf.core.util.ECFException 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.core.util.ECFException 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.core.util.ECFException 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.core.util.ECFException in project ecf by eclipse.
the class SyncResourcesCore method distributeChanges.
private void distributeChanges() {
for (Iterator it = resourceChanges.entrySet().iterator(); it.hasNext(); ) {
Entry entry = (Entry) it.next();
ResourcesShare share = (ResourcesShare) entry.getKey();
List changes = (List) entry.getValue();
List messages = new ArrayList();
for (int i = 0; i < changes.size(); i++) {
ResourceChangeMessage change = (ResourceChangeMessage) changes.get(i);
switch(change.getKind()) {
case IResourceDelta.ADDED:
if (getInt(PreferenceConstants.LOCAL_RESOURCE_ADDITION) == PreferenceConstants.IGNORE_VALUE) {
change.setIgnored(true);
continue;
}
break;
case IResourceDelta.CHANGED:
if (getInt(PreferenceConstants.LOCAL_RESOURCE_CHANGE) == PreferenceConstants.IGNORE_VALUE) {
change.setIgnored(true);
continue;
}
break;
case IResourceDelta.REMOVED:
if (getInt(PreferenceConstants.LOCAL_RESOURCE_DELETION) == PreferenceConstants.IGNORE_VALUE) {
change.setIgnored(true);
continue;
}
break;
}
IModelChangeMessage[] changeMessages = ResourcesSynchronizationStrategy.getInstance().registerLocalChange(change);
messages.addAll(Arrays.asList(changeMessages));
}
try {
if (!messages.isEmpty()) {
IModelChangeMessage[] messagesArray = (IModelChangeMessage[]) messages.toArray(new IModelChangeMessage[messages.size()]);
BatchModelChange batchChange = new BatchModelChange(messagesArray);
share.send(Message.serialize(batchChange));
add(batchChange);
}
} catch (ECFException e) {
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Could not send resource change message", // $NON-NLS-1$
e));
}
}
}
Aggregations