Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2009-02-19 02:20:21 -0500
committermkuppe2009-02-19 02:20:21 -0500
commit71f58dc6f06f945a3d7a55a0dd646e3b03ab8e60 (patch)
treeb815f1dde451badd6fa68ffeafc82fe3069a829a /tests/bundles/org.eclipse.ecf.tests.provider.jslp
parent659bbd9a8f7ba92be10e8427d9c0e20f6d3b1c62 (diff)
downloadorg.eclipse.ecf-71f58dc6f06f945a3d7a55a0dd646e3b03ab8e60.tar.gz
org.eclipse.ecf-71f58dc6f06f945a3d7a55a0dd646e3b03ab8e60.tar.xz
org.eclipse.ecf-71f58dc6f06f945a3d7a55a0dd646e3b03ab8e60.zip
RESOLVED - bug 265410: [Discovery] Reorder test inheritance to fix setUp/tearDown bugs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=265410
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests.provider.jslp')
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryWithoutRegTest.java22
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java9
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java47
3 files changed, 51 insertions, 27 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryWithoutRegTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryWithoutRegTest.java
new file mode 100644
index 000000000..45e0de729
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryWithoutRegTest.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Markus Alexander Kuppe.
+ * 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:
+ * Markus Alexander Kuppe (ecf-dev_eclipse.org <at> lemmster <dot> de) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.tests.provider.jslp;
+
+import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer;
+import org.eclipse.ecf.tests.discovery.DiscoveryTestsWithoutRegister;
+
+public class JSLPDiscoveryWithoutRegTest extends DiscoveryTestsWithoutRegister {
+
+ public JSLPDiscoveryWithoutRegTest() {
+ super(JSLPDiscoveryContainer.NAME);
+ }
+
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java
index 66bfd71c3..93b234e31 100755
--- a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java
@@ -18,22 +18,23 @@ import org.eclipse.ecf.discovery.ServiceProperties;
import org.eclipse.ecf.discovery.identity.IServiceID;
import org.eclipse.ecf.provider.jslp.container.JSLPServiceInfo;
import org.eclipse.ecf.provider.jslp.identity.JSLPNamespace;
+import org.eclipse.ecf.tests.discovery.DiscoveryTestHelper;
import org.eclipse.ecf.tests.discovery.ServiceInfoTest;
public class JSLPServiceInfoTest extends ServiceInfoTest {
public JSLPServiceInfoTest() {
super();
- uri = createDefaultURI();
- priority = PRIORITY;
- weight = WEIGHT;
+ uri = DiscoveryTestHelper.createDefaultURI();
+ priority = DiscoveryTestHelper.PRIORITY;
+ weight = DiscoveryTestHelper.WEIGHT;
serviceProperties = new ServiceProperties();
serviceProperties.setProperty("foobar", new String("foobar"));
Namespace namespace = IDFactory.getDefault().getNamespaceByName(
JSLPNamespace.NAME);
try {
serviceID = (IServiceID) IDFactory.getDefault().createID(namespace,
- new Object[] {SERVICE_TYPE, getHost()});
+ new Object[] {DiscoveryTestHelper.SERVICE_TYPE, DiscoveryTestHelper.getHost()});
} catch (IDCreateException e) {
fail(e.getMessage());
}
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java
index 249f7c600..fa41347f5 100755
--- a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java
@@ -24,6 +24,7 @@ import org.eclipse.ecf.internal.provider.jslp.ServiceURLAdapter;
import org.eclipse.ecf.provider.jslp.container.JSLPServiceInfo;
import org.eclipse.ecf.provider.jslp.identity.JSLPNamespace;
import org.eclipse.ecf.provider.jslp.identity.JSLPServiceTypeID;
+import org.eclipse.ecf.tests.discovery.DiscoveryTestHelper;
import org.eclipse.ecf.tests.discovery.identity.ServiceIDTest;
import ch.ethz.iks.slp.ServiceLocationException;
@@ -59,16 +60,16 @@ public class JSLPServiceIDTest extends ServiceIDTest {
* test from ECF discovery -> jSLP
*/
public void testRemoveServicePrefixECFtojSLP() throws ServiceLocationException {
- final IServiceID sid = (IServiceID) createIDFromString(SERVICE_TYPE);
+ final IServiceID sid = (IServiceID) createIDFromString(DiscoveryTestHelper.SERVICE_TYPE);
final JSLPServiceTypeID stid = (JSLPServiceTypeID) sid.getServiceTypeID();
- assertEquals("service:" + SERVICES[0] + ":" + SERVICES[1] + "." + NAMINGAUTHORITY + ":" + SERVICES[2], stid.getInternal());
- assertEquals(SERVICE_TYPE, stid.getName());
+ assertEquals("service:" + DiscoveryTestHelper.SERVICES[0] + ":" + DiscoveryTestHelper.SERVICES[1] + "." + DiscoveryTestHelper.NAMINGAUTHORITY + ":" + DiscoveryTestHelper.SERVICES[2], stid.getInternal());
+ assertEquals(DiscoveryTestHelper.SERVICE_TYPE, stid.getName());
- assertEquals(NAMINGAUTHORITY, stid.getNamingAuthority());
- assertTrue(Arrays.equals(SERVICES, stid.getServices()));
- assertTrue(Arrays.equals(new String[] {SCOPE}, stid.getScopes()));
- assertTrue(Arrays.equals(new String[] {PROTOCOL}, stid.getProtocols()));
+ assertEquals(DiscoveryTestHelper.NAMINGAUTHORITY, stid.getNamingAuthority());
+ assertTrue(Arrays.equals(DiscoveryTestHelper.SERVICES, stid.getServices()));
+ assertTrue(Arrays.equals(new String[] {DiscoveryTestHelper.SCOPE}, stid.getScopes()));
+ assertTrue(Arrays.equals(new String[] {DiscoveryTestHelper.PROTOCOL}, stid.getProtocols()));
}
/* (non-Javadoc)
@@ -80,11 +81,11 @@ public class JSLPServiceIDTest extends ServiceIDTest {
final String internalRep = "service:foo.eclipse:bar";
final ServiceURL sUrl = new ServiceURL(internalRep + "://localhost:1234/a/path/to/something", ServiceURL.LIFETIME_PERMANENT);
- final IServiceInfo serviceInfo = new JSLPServiceInfo(new ServiceURLAdapter(sUrl, SERVICENAME), PRIORITY, WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
- assertEquals(serviceInfo.getPriority(), PRIORITY);
- assertEquals(serviceInfo.getWeight(), WEIGHT);
+ final IServiceInfo serviceInfo = new JSLPServiceInfo(new ServiceURLAdapter(sUrl, DiscoveryTestHelper.SERVICENAME), DiscoveryTestHelper.PRIORITY, DiscoveryTestHelper.WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
+ assertEquals(serviceInfo.getPriority(), DiscoveryTestHelper.PRIORITY);
+ assertEquals(serviceInfo.getWeight(), DiscoveryTestHelper.WEIGHT);
final IServiceID sid = serviceInfo.getServiceID();
- assertEquals(sid.getServiceName(), SERVICENAME);
+ assertEquals(sid.getServiceName(), DiscoveryTestHelper.SERVICENAME);
final IServiceTypeID stid = sid.getServiceTypeID();
String internal = stid.getInternal();
@@ -106,11 +107,11 @@ public class JSLPServiceIDTest extends ServiceIDTest {
final String internalRep = "service:service:foo.eclipse:bar";
final ServiceURL sUrl = new ServiceURL(internalRep + "://localhost:1234/a/path/to/something", ServiceURL.LIFETIME_PERMANENT);
- final IServiceInfo serviceInfo = new JSLPServiceInfo(new ServiceURLAdapter(sUrl, SERVICENAME), PRIORITY, WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
- assertEquals(serviceInfo.getPriority(), PRIORITY);
- assertEquals(serviceInfo.getWeight(), WEIGHT);
+ final IServiceInfo serviceInfo = new JSLPServiceInfo(new ServiceURLAdapter(sUrl, DiscoveryTestHelper.SERVICENAME), DiscoveryTestHelper.PRIORITY, DiscoveryTestHelper.WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
+ assertEquals(serviceInfo.getPriority(), DiscoveryTestHelper.PRIORITY);
+ assertEquals(serviceInfo.getWeight(), DiscoveryTestHelper.WEIGHT);
final IServiceID sid = serviceInfo.getServiceID();
- assertEquals(sid.getServiceName(), SERVICENAME);
+ assertEquals(sid.getServiceName(), DiscoveryTestHelper.SERVICENAME);
final IServiceTypeID stid = sid.getServiceTypeID();
assertEquals(internalRep, stid.getInternal());
@@ -141,33 +142,33 @@ public class JSLPServiceIDTest extends ServiceIDTest {
String expected = "some Name";
Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
- IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, SERVICES, PROTOCOLS, expected);
+ IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, DiscoveryTestHelper.SERVICES, DiscoveryTestHelper.PROTOCOLS, expected);
assertNotNull(aServiceID);
IServiceTypeID stid = aServiceID.getServiceTypeID();
- assertTrue(Arrays.equals(SERVICES, stid.getServices()));
+ assertTrue(Arrays.equals(DiscoveryTestHelper.SERVICES, stid.getServices()));
assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_SCOPE, stid.getScopes()));
- assertTrue(Arrays.equals(PROTOCOLS, stid.getProtocols()));
+ assertTrue(Arrays.equals(DiscoveryTestHelper.PROTOCOLS, stid.getProtocols()));
String internal = stid.getInternal();
- assertEquals("service:" + SERVICES[0] + ":" + SERVICES[1] + ":" + SERVICES[2], internal);
+ assertEquals("service:" + DiscoveryTestHelper.SERVICES[0] + ":" + DiscoveryTestHelper.SERVICES[1] + ":" + DiscoveryTestHelper.SERVICES[2], internal);
}
public void testjSLPDefaultsToECF() {
String expected = "some Name";
Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
- IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, SERVICES, new String[]{SCOPE}, PROTOCOLS, NAMINGAUTHORITY, expected);
+ IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, DiscoveryTestHelper.SERVICES, new String[]{DiscoveryTestHelper.SCOPE}, DiscoveryTestHelper.PROTOCOLS, DiscoveryTestHelper.NAMINGAUTHORITY, expected);
assertNotNull(aServiceID);
IServiceTypeID stid = aServiceID.getServiceTypeID();
- assertEquals(NAMINGAUTHORITY, stid.getNamingAuthority());
- assertEquals("_ecf._junit._tests._someProtocol." + SCOPE + "._" + NAMINGAUTHORITY + "@" + expected, aServiceID.getName());
+ assertEquals(DiscoveryTestHelper.NAMINGAUTHORITY, stid.getNamingAuthority());
+ assertEquals("_ecf._junit._tests._someProtocol." + DiscoveryTestHelper.SCOPE + "._" + DiscoveryTestHelper.NAMINGAUTHORITY + "@" + expected, aServiceID.getName());
}
public void testjSLPDefaultsToECF2() {
String expected = "some Name";
Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
- IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, SERVICES, PROTOCOLS, expected);
+ IServiceID aServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, DiscoveryTestHelper.SERVICES, DiscoveryTestHelper.PROTOCOLS, expected);
assertNotNull(aServiceID);
IServiceTypeID stid = aServiceID.getServiceTypeID();

Back to the top