Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-05-01 19:27:32 +0000
committerslewis2009-05-01 19:27:32 +0000
commit1f463a2120cdb951416adf5687db7ae37dffdc18 (patch)
treef0d41e3415825cd72dd572d084acf2514c522d42
parentef0ebdd7bb9db8bd6bdad0abd2c9618406ea13ef (diff)
downloadorg.eclipse.ecf-1f463a2120cdb951416adf5687db7ae37dffdc18.tar.gz
org.eclipse.ecf-1f463a2120cdb951416adf5687db7ae37dffdc18.tar.xz
org.eclipse.ecf-1f463a2120cdb951416adf5687db7ae37dffdc18.zip
Added new API: IHostDistributionListener, IProxyDistributionListener, IHostDiscoveryListener, IProxyDiscoveryListener to allow notification of discovery and distribution for host and proxy events.
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/AbstractServiceRegisterListenerTest.java87
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/generic/GenericServiceRegisterListenerTest.java43
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/r_osgi/R_OSGiServiceRegisterListenerTest.java63
3 files changed, 193 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/AbstractServiceRegisterListenerTest.java b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/AbstractServiceRegisterListenerTest.java
new file mode 100644
index 000000000..f2eae8218
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/AbstractServiceRegisterListenerTest.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+* Copyright (c) 2009 EclipseSource and others. All rights reserved. This
+* program and the accompanying materials are made available under the terms of
+* the Eclipse Public License v1.0 which accompanies this distribution, and is
+* available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* EclipseSource - initial API and implementation
+******************************************************************************/
+package org.eclipse.ecf.tests.osgi.services.distribution;
+
+import org.eclipse.ecf.osgi.services.discovery.IRemoteServiceEndpointDescription;
+import org.eclipse.ecf.osgi.services.distribution.IHostDistributionListener;
+import org.eclipse.ecf.osgi.services.distribution.IProxyDistributionListener;
+import org.eclipse.ecf.remoteservice.IRemoteServiceContainer;
+import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
+import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
+import org.eclipse.ecf.tests.internal.osgi.services.distribution.Activator;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+public abstract class AbstractServiceRegisterListenerTest extends AbstractServiceRegisterTest {
+
+ ServiceRegistration hostDistributionListenerRegistration;
+ ServiceRegistration proxyDistributionListenerRegistration;
+
+ protected IHostDistributionListener createHostDistributionListener() {
+ return new IHostDistributionListener() {
+
+ public void registered(ServiceReference serviceReference,
+ IRemoteServiceContainer remoteServiceContainer, IRemoteServiceRegistration remoteRegistration) {
+ System.out.println("hostRegistered\n\tserviceReference="+serviceReference+"\n\tremoteServiceContainer="+remoteServiceContainer+"\n\tremoteRegistration="+remoteRegistration);
+ }
+
+ public void unregistered(ServiceReference serviceReference, IRemoteServiceRegistration remoteRegistration) {
+ System.out.println("hostUnregistered\n\tserviceReference="+serviceReference+"\n\tremoteRegistration="+remoteRegistration);
+ }
+
+ };
+ }
+
+ protected IProxyDistributionListener createProxyDistributionListener() {
+ return new IProxyDistributionListener() {
+
+ public void registered(
+ IRemoteServiceEndpointDescription endpointDescription,
+ IRemoteServiceContainer remoteServiceContainer,
+ IRemoteServiceReference remoteServiceReference,
+ ServiceRegistration proxyServiceRegistration) {
+ System.out.println("proxyRegistered\n\tendpointDescription="+endpointDescription+"\n\tremoteServiceContainer="+remoteServiceContainer+"\n\tremoteServiceReference="+remoteServiceReference+"\n\tproxyServiceRegistration="+proxyServiceRegistration);
+ }
+
+ public void retrievingRemoteServiceReferences(
+ IRemoteServiceEndpointDescription endpointDescription,
+ IRemoteServiceContainer remoteServiceContainer) {
+ System.out.println("proxyRetrievingRemoteServiceReferences\n\tendpointDescription="+endpointDescription+"\n\tremoteServiceContainer="+remoteServiceContainer);
+ }
+
+ public void registering(
+ IRemoteServiceEndpointDescription endpointDescription,
+ IRemoteServiceContainer remoteServiceContainer,
+ IRemoteServiceReference remoteServiceReference) {
+ System.out.println("proxyRegistering\n\tendpointDescription="+endpointDescription+"\n\tremoteServiceContainer="+remoteServiceContainer+"\n\tremoteServiceReference="+remoteServiceReference);
+ }
+
+ public void unregistered(
+ IRemoteServiceEndpointDescription endpointDescription,
+ ServiceRegistration proxyServiceRegistration) {
+ System.out.println("proxyUnregistered\n\tendpointDescription="+endpointDescription+"\n\tproxyServiceRegistration="+proxyServiceRegistration);
+ }
+
+ };
+ }
+
+ protected void setUp() throws Exception {
+ // Register listeners
+ hostDistributionListenerRegistration = Activator.getDefault().getContext().registerService(IHostDistributionListener.class.getName(), createHostDistributionListener(), null);
+ proxyDistributionListenerRegistration = Activator.getDefault().getContext().registerService(IProxyDistributionListener.class.getName(), createProxyDistributionListener(), null);
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ hostDistributionListenerRegistration.unregister();
+ proxyDistributionListenerRegistration.unregister();
+ }
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/generic/GenericServiceRegisterListenerTest.java b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/generic/GenericServiceRegisterListenerTest.java
new file mode 100644
index 000000000..cd71179dc
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/generic/GenericServiceRegisterListenerTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+* Copyright (c) 2009 EclipseSource and others. All rights reserved. This
+* program and the accompanying materials are made available under the terms of
+* the Eclipse Public License v1.0 which accompanies this distribution, and is
+* available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* EclipseSource - initial API and implementation
+******************************************************************************/
+package org.eclipse.ecf.tests.osgi.services.distribution.generic;
+
+
+import org.eclipse.ecf.tests.osgi.services.distribution.AbstractServiceRegisterListenerTest;
+
+
+public class GenericServiceRegisterListenerTest extends AbstractServiceRegisterListenerTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ setClientCount(1);
+ createServerAndClients();
+ connectClients();
+ setupRemoteServiceAdapters();
+ }
+
+
+ protected void tearDown() throws Exception {
+ cleanUpServerAndClients();
+ super.tearDown();
+ }
+
+ protected String getClientContainerName() {
+ return "ecf.generic.client";
+ }
+
+
+
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/r_osgi/R_OSGiServiceRegisterListenerTest.java b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/r_osgi/R_OSGiServiceRegisterListenerTest.java
new file mode 100644
index 000000000..9bd69036f
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.osgi.services.distribution/src/org/eclipse/ecf/tests/osgi/services/distribution/r_osgi/R_OSGiServiceRegisterListenerTest.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+* Copyright (c) 2009 EclipseSource and others. All rights reserved. This
+* program and the accompanying materials are made available under the terms of
+* the Eclipse Public License v1.0 which accompanies this distribution, and is
+* available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* EclipseSource - initial API and implementation
+******************************************************************************/
+package org.eclipse.ecf.tests.osgi.services.distribution.r_osgi;
+
+
+import org.eclipse.ecf.core.ContainerFactory;
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.tests.osgi.services.distribution.AbstractServiceRegisterListenerTest;
+import org.osgi.framework.ServiceReference;
+
+
+public class R_OSGiServiceRegisterListenerTest extends AbstractServiceRegisterListenerTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ setClientCount(1);
+ createServerAndClients();
+ setupRemoteServiceAdapters();
+ }
+
+
+ protected void tearDown() throws Exception {
+ cleanUpServerAndClients();
+ super.tearDown();
+ }
+
+ protected IContainer createClient(int index) throws Exception {
+ return ContainerFactory.getDefault().createContainer("ecf.r_osgi.peer",
+ new Object[] { IDFactory.getDefault().createStringID(
+ "r-osgi://localhost:"+(9279+index)) });
+ }
+
+ protected IContainer createServer() throws Exception {
+ return ContainerFactory.getDefault().createContainer("ecf.r_osgi.peer",
+ new Object[] { IDFactory.getDefault().createStringID(
+ "r-osgi://localhost:9278") });
+ }
+
+
+ protected String getClientContainerName() {
+ return "ecf.r_osgi.peer";
+ }
+
+
+ public ServiceReference getReference() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}

Back to the top