Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjrellerme2008-04-29 07:34:07 -0400
committerjrellerme2008-04-29 07:34:07 -0400
commitf9ebda0380f0deddc2eb5cd2c72c41e3d7974ecf (patch)
tree475ae2c3c4280609a8ab49fe42c173a94e1f155b /tests
parent0dcec1127ff7ba6d3d526534ff0f34ffb0fb2774 (diff)
downloadorg.eclipse.ecf-f9ebda0380f0deddc2eb5cd2c72c41e3d7974ecf.tar.gz
org.eclipse.ecf-f9ebda0380f0deddc2eb5cd2c72c41e3d7974ecf.tar.xz
org.eclipse.ecf-f9ebda0380f0deddc2eb5cd2c72c41e3d7974ecf.zip
added the additional test case for the R-OSGi provider
Diffstat (limited to 'tests')
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/tests/remoteservice/r_osgi/ServiceTrackerTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/tests/remoteservice/r_osgi/ServiceTrackerTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/tests/remoteservice/r_osgi/ServiceTrackerTest.java
index ad87eb1aa..6ed866bb3 100755
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/tests/remoteservice/r_osgi/ServiceTrackerTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.remoteservice/src/org/eclipse/ecf/tests/remoteservice/r_osgi/ServiceTrackerTest.java
@@ -11,8 +11,15 @@
package org.eclipse.ecf.tests.remoteservice.r_osgi;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.eclipse.ecf.remoteservice.Constants;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
import org.eclipse.ecf.tests.remoteservice.AbstractServiceTrackerTest;
+import org.eclipse.ecf.tests.remoteservice.Activator;
+import org.eclipse.ecf.tests.remoteservice.IConcatService;
+import org.osgi.util.tracker.ServiceTracker;
/**
* ServiceTrackerTest, adapted for the R-OSGi provider.
@@ -83,5 +90,30 @@ public class ServiceTrackerTest extends AbstractServiceTrackerTest {
protected String getClientContainerName() {
return R_OSGi.CLIENT_CONTAINER_NAME;
}
+
+ public void testServiceTracker() throws Exception {
+ final IRemoteServiceContainerAdapter[] adapters = getRemoteServiceAdapters();
+ // client [0]/adapter[0] is the service 'server'
+ // client [1]/adapter[1] is the service target (client)
+ final Dictionary props = new Hashtable();
+ props.put(Constants.SERVICE_REGISTRATION_TARGETS, getClients()[0].getConnectedID());
+ props.put(Constants.AUTOREGISTER_REMOTE_PROXY, "true");
+ // Register
+ adapters[0].registerRemoteService(new String[] {IConcatService.class.getName()}, createService(), props);
+ // Give some time for propagation
+ sleep(3000);
+
+ final ServiceTracker st = new ServiceTracker(Activator.getDefault().getContext(), IConcatService.class.getName(), null);
+ assertNotNull(st);
+ st.open();
+ final IConcatService concatService = (IConcatService) st.getService();
+ assertNotNull(concatService);
+ System.out.println("proxy call start");
+ final String result = concatService.concat("OSGi ", "is cool");
+ System.out.println("proxy call end. result=" + result);
+ sleep(3000);
+ st.close();
+ sleep(3000);
+ }
}

Back to the top