Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2008-01-24 04:33:49 -0500
committermkuppe2008-01-24 04:33:49 -0500
commit496295c2d037318dd7f58abe9e6b6246bd7b8194 (patch)
tree3b72afae24cafcf97568b36295359250f128108f /tests/bundles/org.eclipse.ecf.tests.provider.jslp
parent4801d7049d96eed0462b80cfdca5a85e5100df8b (diff)
downloadorg.eclipse.ecf-496295c2d037318dd7f58abe9e6b6246bd7b8194.tar.gz
org.eclipse.ecf-496295c2d037318dd7f58abe9e6b6246bd7b8194.tar.xz
org.eclipse.ecf-496295c2d037318dd7f58abe9e6b6246bd7b8194.zip
NEW - bug 216405: Migrate jSLP contribution from ecf1.osuosl.org to dev.eclipse.org
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216405
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests.provider.jslp')
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/.classpath7
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/.project28
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.jdt.core.prefs7
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.pde.core.prefs4
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/META-INF/MANIFEST.MF16
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/about.html28
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/build.properties4
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/config.ini64
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/plugin.properties10
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/AllTests.java33
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryServiceTest.java21
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryTest.java36
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java41
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPTestComparator.java59
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java42
15 files changed, 400 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.classpath b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.classpath
new file mode 100755
index 000000000..7cdeb7319
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.project b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.project
new file mode 100755
index 000000000..1c5744904
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.tests.provider.jslp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.jdt.core.prefs b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 000000000..74de1f6a4
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Oct 22 09:56:07 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.pde.core.prefs b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.pde.core.prefs
new file mode 100755
index 000000000..38a01704a
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Sun Oct 07 16:26:19 PDT 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/META-INF/MANIFEST.MF b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/META-INF/MANIFEST.MF
new file mode 100755
index 000000000..0d7d8c77a
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %plugin.name
+Bundle-SymbolicName: org.eclipse.ecf.tests.provider.jslp
+Bundle-Version: 2.0.0.qualifier
+Import-Package: org.osgi.framework;version="1.4.0",
+ org.osgi.util.tracker;version="1.3.3"
+Require-Bundle: org.junit,
+ org.eclipse.ecf,
+ org.eclipse.ecf.discovery,
+ org.eclipse.equinox.common,
+ org.eclipse.ecf.tests.discovery,
+ org.eclipse.ecf.provider.jslp
+Bundle-Vendor: %plugin.provider
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/about.html b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/about.html
new file mode 100755
index 000000000..2535c6aaa
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>October 14, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/build.properties b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/build.properties
new file mode 100755
index 000000000..34d2e4d2d
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/config.ini b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/config.ini
new file mode 100755
index 000000000..d8b864c80
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/config.ini
@@ -0,0 +1,64 @@
+# Eclipse runtime configuration file
+# This file contains a number of key/value pairs that are merged into the
+# System properties on system startup. The values control the way the
+# runtime is structured and runs.
+
+# Note: Only platform:/base/ and file: URLs are supported. In general the
+# URLs given may include a version number (e.g., .../location_1.2.3).
+# If a version is not specified, the system binds
+# to the location which matches exactly or to the versioned location with the
+# latest version number. If a version number is given then only exact matches
+# are considered.
+
+# The URL for the runtime entry point. The default value is
+# platform:/base/plugins/org.eclipse.osgi
+#osgi.framework = platform:/base/plugins/org.eclipse.osgi
+
+# The classpath for the framework found at the osgi.framework location. This
+# comma-separated list contains either URLs or simple element names. Simple
+# names are assumed to be relative to the framework's install directory.
+# Typically this value need not be set as it is initialized by the framework itself.
+# Version match searching is not done for URLs listed here.
+#osgi.frameworkClassPath =
+
+# The comma-separated list of locations to search for the splash screen file (splash.bmp).
+# For each list element a subdirectory structure based on the pattern nl/<locale> is searched.
+# The system binds to the first matching file. There is no default value.
+osgi.splashPath = platform:/base/plugins/org.eclipse.platform
+
+# The location of the splash screen file. If this value is set at system startup it is used
+# in favour of the osgi.splashPath searching outlined above. If the value is not set
+# the searching is done and this key is bound to the result of the search.
+#osgi.splashLocation =
+
+# The comma-separated list of bundles which are automatically installed and optionally started
+# once the system is up and running. Each entry if of the form
+# <URL | simple bundle location>[@ [<startlevel>] [":start"]]
+# If the startlevel is omitted then the framework will use the default start level for the bundle.
+# If the "start" tag is added then the bundle will be marked as started after being installed.
+# Simple bundle locations are interepreted as relative to the framework's parent directory.
+# The startlevel indicates the OSGi start level at which the bundle should run.
+# If this value is not set, the system computes an appropriate default.
+osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start, org.eclipse.equinox.log@4:start
+
+# The product to run. A given Eclipse configuration may contain many products.
+# The product identified will supply the branding (window icons, title bar text) etc
+# as well as define the default application to run.
+eclipse.product=org.eclipse.sdk.ide
+
+# The application to run. The value specified here is the id of the application extension
+# the runtime will find, instantiate and execute once the system is up. Note that typically
+# the identified eclipse.product defines the default application to run.
+#eclipse.application=
+
+# The default workspace location
+osgi.instance.area.default=@user.home/workspace
+
+# The build identifier
+eclipse.buildId=M20071023-1652
+
+# entry required for gtk configurations of eclipse to enable stand-alone help
+osgi.ws=gtk
+
+# End of file marker - must be here
+eof=eof
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/plugin.properties b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/plugin.properties
new file mode 100755
index 000000000..2641c8285
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/plugin.properties
@@ -0,0 +1,10 @@
+/****************************************************************************
+* Copyright (c) 2007 Versant Corp., IBM Corp. 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
+*
+*****************************************************************************/
+plugin.name = ECF jSLP Discovery Provider Tests
+plugin.provider = Eclipse.org
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/AllTests.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/AllTests.java
new file mode 100755
index 000000000..d1535b4be
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/AllTests.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.ecf.tests.provider.jslp.identity.JSLPServiceIDTest;
+
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.eclipse.ecf.tests.discovery.jslp");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(JSLPServiceInfoTest.class);
+ suite.addTestSuite(JSLPServiceIDTest.class);
+ suite.addTestSuite(JSLPDiscoveryTest.class);
+ suite.addTestSuite(JSLPDiscoveryServiceTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryServiceTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryServiceTest.java
new file mode 100755
index 000000000..15f8baa81
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryServiceTest.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp;
+
+import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer;
+import org.eclipse.ecf.tests.discovery.DiscoveryServiceTest;
+
+public class JSLPDiscoveryServiceTest extends DiscoveryServiceTest {
+
+ public JSLPDiscoveryServiceTest() {
+ super(JSLPDiscoveryContainer.NAME);
+ }
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryTest.java
new file mode 100755
index 000000000..bbdb1e64e
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPDiscoveryTest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp;
+
+import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer;
+import org.eclipse.ecf.tests.discovery.DiscoveryTest;
+
+public class JSLPDiscoveryTest extends DiscoveryTest {
+
+ public JSLPDiscoveryTest() {
+ super(JSLPDiscoveryContainer.NAME, JSLPDiscoveryContainer.REDISCOVER, new JSLPTestComparator());
+ }
+
+ public void testJSLPLocatorNull() {
+ //Activator.getDefault().getLocator() == null always
+ fail("not yet implemented");
+ }
+
+ public void testJSLPAdvertiserNull() {
+ //Activator.getDefault().getAdvertiser() == null always
+ fail("not yet implemtend");
+ }
+
+ public void testJSLPBundleBecomesUnavailable() {
+ // dynamic OSGi!
+ fail("not yet implemtend");
+ }
+}
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
new file mode 100755
index 000000000..1d57f27b8
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPServiceInfoTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp;
+
+import java.net.URI;
+
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.core.identity.Namespace;
+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.ITestConstants;
+import org.eclipse.ecf.tests.discovery.ServiceInfoTest;
+
+public class JSLPServiceInfoTest extends ServiceInfoTest {
+
+ public JSLPServiceInfoTest() {
+ uri = URI.create(ITestConstants.URI);
+ priority = 456;
+ weight = 789;
+ serviceProperties = new ServiceProperties();
+ serviceProperties.setProperty("foobar", new String("foobar"));
+ Namespace namespace = IDFactory.getDefault().getNamespaceByName(JSLPNamespace.NAME);
+ try {
+ serviceID = (IServiceID) IDFactory.getDefault().createID(namespace, ITestConstants.SERVICE_TYPE);
+ } catch (IDCreateException e) {
+ fail(e.getMessage());
+ }
+ serviceInfo = new JSLPServiceInfo(uri, serviceID, priority, weight, serviceProperties);
+ }
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPTestComparator.java b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPTestComparator.java
new file mode 100755
index 000000000..d86bc42d7
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/JSLPTestComparator.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.eclipse.ecf.discovery.IServiceInfo;
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+import org.eclipse.ecf.provider.jslp.identity.JSLPServiceID;
+
+/**
+ * Used for testing equality
+ */
+public class JSLPTestComparator implements Comparator {
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object arg0, Object arg1) {
+ if(arg0 instanceof IServiceInfo && arg1 instanceof IServiceInfo) {
+
+ IServiceInfo first = (IServiceInfo) arg0;
+ IServiceInfo second = (IServiceInfo) arg1;
+
+ //TODO-mkuppe No prio, weight, scope and protocol atm in the JSLP testcase
+ JSLPServiceID firstID = (JSLPServiceID) first.getServiceID();
+ JSLPServiceID secondID = (JSLPServiceID) second.getServiceID();
+ IServiceTypeID firstTypeID = firstID.getServiceTypeID();
+ IServiceTypeID secondTypeID = secondID.getServiceTypeID();
+
+ boolean protocolsSame = Arrays.equals(firstTypeID.getProtocols(), secondTypeID.getProtocols());
+ boolean scopesSame = Arrays.equals(firstTypeID.getScopes(), secondTypeID.getScopes());
+ boolean weightSame = first.getWeight() == second.getWeight();
+ boolean prioSame = first.getPriority() == second.getPriority();
+
+ boolean namesSame = firstID.getAddress().equals(secondID.getAddress());
+ boolean servicesSame = Arrays.equals(firstTypeID.getServices(), secondTypeID.getServices());
+ boolean namespacesSame = firstID.getNamespace().equals(secondID.getNamespace());
+ boolean naSame = firstTypeID.getNamingAuthority().equals(secondTypeID.getNamingAuthority());
+ boolean addressesSame = first.getLocation().equals(second.getLocation());
+ boolean propertiesSame = first.getServiceProperties().asProperties().equals(second.getServiceProperties().asProperties());
+ boolean result = namesSame && namespacesSame && servicesSame && naSame && addressesSame && propertiesSame;
+ if(result == true) {
+ return 0;
+ }
+ }
+ return -1;
+ }
+
+}
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
new file mode 100755
index 000000000..ba5fe4cda
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.jslp/src/org/eclipse/ecf/tests/provider/jslp/identity/JSLPServiceIDTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.provider.jslp.identity;
+
+import java.util.Arrays;
+
+import org.eclipse.ecf.discovery.identity.IServiceID;
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+import org.eclipse.ecf.provider.jslp.identity.JSLPNamespace;
+import org.eclipse.ecf.tests.discovery.identity.ServiceIDTest;
+
+public class JSLPServiceIDTest extends ServiceIDTest {
+
+ public JSLPServiceIDTest() {
+ super(JSLPNamespace.NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.tests.discovery.identity.ServiceIDTest#testCreateServiceTypeIDFromInternalString()
+ */
+ public void testCreateServiceTypeIDFromInternalString() {
+ final String internalRep = "service:foo.eclipse:bar";
+ final IServiceID sid = (IServiceID) createIDFromString(internalRep);
+ final IServiceTypeID stid = sid.getServiceTypeID();
+
+ assertEquals(internalRep, stid.getInternal());
+ assertNotSame(internalRep, stid.getName());
+
+ assertEquals("eclipse", stid.getNamingAuthority());
+ assertTrue(Arrays.equals(new String[] {"service", "foo", "bar"}, stid.getServices()));
+ assertTrue(Arrays.equals(new String[] {"default"}, stid.getScopes()));
+ assertTrue(Arrays.equals(new String[] {"unknown"}, stid.getProtocols()));
+ }
+}

Back to the top