Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2008-06-12 06:26:57 -0400
committermkuppe2008-06-12 06:26:57 -0400
commit003a4b78b9824a60f32b77000fe72e279525004e (patch)
tree7010d8bd9a75aef4bd6ddf2b601bda2d0c34fdbb
parent75e9bb6bf101ccdc69743251ddad2c8473a2fbf5 (diff)
downloadorg.eclipse.ecf-003a4b78b9824a60f32b77000fe72e279525004e.tar.gz
org.eclipse.ecf-003a4b78b9824a60f32b77000fe72e279525004e.tar.xz
org.eclipse.ecf-003a4b78b9824a60f32b77000fe72e279525004e.zip
RESOLVED - bug 236831: [Discovery][SLP] JSLPNamespace discards IServiceID.getname()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236831
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/ServiceIDTest.java34
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestNamespace.java36
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestServiceID.java23
3 files changed, 91 insertions, 2 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/ServiceIDTest.java b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/ServiceIDTest.java
index 4cb55b755..3829f2091 100755
--- a/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/ServiceIDTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/ServiceIDTest.java
@@ -18,6 +18,7 @@ import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.discovery.identity.IServiceID;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.discovery.identity.ServiceIDFactory;
+import org.eclipse.ecf.discovery.identity.ServiceTypeID;
import org.eclipse.ecf.tests.discovery.AbstractDiscoveryTest;
public abstract class ServiceIDTest extends AbstractDiscoveryTest {
@@ -40,7 +41,7 @@ public abstract class ServiceIDTest extends AbstractDiscoveryTest {
}
protected IServiceID createIDFromStringWithEx(String serviceType) throws IDCreateException {
- return ServiceIDFactory.getDefault().createServiceID(IDFactory.getDefault().getNamespaceByName(namespace), serviceType, null);
+ return ServiceIDFactory.getDefault().createServiceID(IDFactory.getDefault().getNamespaceByName(namespace), serviceType);
}
protected IServiceID createIDFromServiceTypeID(IServiceTypeID serviceType) {
@@ -55,7 +56,7 @@ public abstract class ServiceIDTest extends AbstractDiscoveryTest {
}
protected IServiceID createIDFromServiceTypeIDWithEx(IServiceTypeID serviceType) throws IDCreateException {
- return ServiceIDFactory.getDefault().createServiceID(IDFactory.getDefault().getNamespaceByName(namespace), serviceType, null);
+ return ServiceIDFactory.getDefault().createServiceID(IDFactory.getDefault().getNamespaceByName(namespace), serviceType);
}
public void testServiceTypeIDWithNullString() {
@@ -144,6 +145,35 @@ public abstract class ServiceIDTest extends AbstractDiscoveryTest {
createFromAnother(aServiceTypeID, stid);
createFromAnother(stid, aServiceTypeID);
}
+
+ /*
+ * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String, String)
+ */
+ public void testServiceIDFactory1() throws IDCreateException, SecurityException {
+ String expected = "some Name";
+ Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
+ IServiceID createServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, "_service._ecf._foo._bar._tcp.ecf.eclipse.org._IANA", expected);
+ assertNotNull(createServiceID);
+ }
+
+ /*
+ * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String, String)
+ */
+ public void testServiceIDFactory2() throws IDCreateException, SecurityException {
+ Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
+ ServiceTypeID serviceTypeID = new ServiceTypeID(new TestNamespace(), "_service._ecf._foo._bar._tcp.ecf.eclipse.org._IANA");
+ IServiceID createServiceID = ServiceIDFactory.getDefault().createServiceID(namespaceByName, serviceTypeID, "some Name");
+ assertNotNull(createServiceID);
+
+ // members should be the same
+ IServiceTypeID aServiceTypeID = createServiceID.getServiceTypeID();
+ assertEquals(aServiceTypeID.getNamingAuthority(), serviceTypeID.getNamingAuthority());
+ assertTrue(Arrays.equals(aServiceTypeID.getServices(), serviceTypeID.getServices()));
+ assertTrue(Arrays.equals(aServiceTypeID.getScopes(), serviceTypeID.getScopes()));
+ assertTrue(Arrays.equals(aServiceTypeID.getProtocols(), serviceTypeID.getProtocols()));
+
+ assertSame(namespaceByName, createServiceID.getNamespace());
+ }
/**
* Creates a new instance of IServiceTypeId with the Namespace of the second parameter and the instance of the first parameter
diff --git a/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestNamespace.java b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestNamespace.java
new file mode 100755
index 000000000..32e0a38fc
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestNamespace.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Versant Corp.
+ * 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 Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.tests.discovery.identity;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+
+public class TestNamespace extends Namespace {
+
+ private static final long serialVersionUID = 719152465556165109L;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
+ */
+ public ID createInstance(Object[] parameters) throws IDCreateException {
+ return new TestServiceID(this, (IServiceTypeID) parameters[0], (String) parameters[1]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.identity.Namespace#getScheme()
+ */
+ public String getScheme() {
+ return "testnamespace";
+ }
+
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestServiceID.java b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestServiceID.java
new file mode 100755
index 000000000..c431ab31c
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.discovery/src/org/eclipse/ecf/tests/discovery/identity/TestServiceID.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Versant Corp.
+ * 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 Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.tests.discovery.identity;
+
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+import org.eclipse.ecf.discovery.identity.ServiceID;
+
+public class TestServiceID extends ServiceID {
+
+ private static final long serialVersionUID = 2115324301690822446L;
+
+ public TestServiceID(TestNamespace aNamespace, IServiceTypeID aServiceTypeID, String aName) {
+ super(aNamespace, aServiceTypeID, aName);
+ }
+}

Back to the top