diff options
author | slewis | 2014-03-13 02:51:46 +0000 |
---|---|---|
committer | slewis | 2014-03-13 02:51:46 +0000 |
commit | d968a9c60bb41bf570712046749bf5296347ab85 (patch) | |
tree | 049a2dde5ddc12ab3b115696efea7cd2d434f9fb /tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src | |
parent | 7f9f7e0a843ed5486bed7b7c416140f34943d2a7 (diff) | |
download | org.eclipse.ecf-d968a9c60bb41bf570712046749bf5296347ab85.tar.gz org.eclipse.ecf-d968a9c60bb41bf570712046749bf5296347ab85.tar.xz org.eclipse.ecf-d968a9c60bb41bf570712046749bf5296347ab85.zip |
Updated to rfc 203/rsa1.1 version of
org.osgi.service.remoteserviceadmin.* classes. Also updated ECF remote
service admin implementation and abstracttopologymanager.
Change-Id: Id5bcf7b0aa5262d33f10a35a34290a968c5f57a8
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src')
-rw-r--r-- | tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractRemoteServiceRegisterTest.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractRemoteServiceRegisterTest.java b/tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractRemoteServiceRegisterTest.java index 56e703c6d..fce9f0f12 100644 --- a/tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractRemoteServiceRegisterTest.java +++ b/tests/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractRemoteServiceRegisterTest.java @@ -9,6 +9,7 @@ ******************************************************************************/ package org.eclipse.ecf.tests.osgi.services.remoteserviceadmin; +import java.util.Map; import java.util.Properties; import java.util.Vector; @@ -20,6 +21,8 @@ import org.eclipse.ecf.remoteservice.Constants; import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter; import org.eclipse.ecf.remoteservice.IRemoteServiceReference; import org.osgi.framework.ServiceRegistration; +import org.osgi.service.remoteserviceadmin.EndpointDescription; +import org.osgi.service.remoteserviceadmin.ExportReference; import org.osgi.service.remoteserviceadmin.RemoteConstants; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener; @@ -239,4 +242,45 @@ public abstract class AbstractRemoteServiceRegisterTest extends listenerReg.unregister(); } + public void testRegisterAndUpdateProperties() throws Exception { + remoteServiceAdminEvents.clear(); + // register RemoteServiceAdminListener + ServiceRegistration listenerReg = getContext().registerService(RemoteServiceAdminListener.class.getName(), createRemoteServiceAdminListener(), null); + // Create server container + this.server = ContainerFactory.getDefault().createContainer(getServerContainerTypeName(),new Object[] {createServerID()}); + // Create props + Properties props = getServiceProperties(); + // Put "1" for "testonekey" + props.put("testonekey", "1"); + // Actually register with default service (IConcatService) as a remote service + registration = registerDefaultService(props); + Thread.sleep(REGISTER_WAIT/2); + // remoteServiceAdminEvents should have the Export registration + assertTrue(remoteServiceAdminEvents.size() > 0); + // Get ExportReference + ExportReference exportRef = remoteServiceAdminEvents.get(0).getExportReference(); + EndpointDescription oldED = exportRef.getExportedEndpoint(); + assertNotNull(oldED); + Map<String,?> oldEDProperties = oldED.getProperties(); + assertNotNull(oldEDProperties); + assertTrue("1".equals(oldEDProperties.get("testonekey"))); + assertTrue(oldEDProperties.get("testtwokey")==null); + + // Change testonekey value to "two" and set a new property "testtwokey" to "2" + props.put("testonekey", "two"); + props.put("testtwokey", "2"); + // Set/update the properties on the registration + this.registration.setProperties(props); + + // Now get new EndpointDescription and test that new properties have been changed in EndpointDescription + EndpointDescription updatedED = exportRef.getExportedEndpoint(); + assertNotNull(updatedED); + Map<String,?> updatedEDProperties = updatedED.getProperties(); + assertNotNull(updatedEDProperties); + assertTrue("two".equals(updatedEDProperties.get("testonekey"))); + assertTrue("2".equals(updatedEDProperties.get("testtwokey"))); + + listenerReg.unregister(); + } + } |