diff options
author | slewis@composent.com | 2010-10-27 00:21:18 +0000 |
---|---|---|
committer | slewis@composent.com | 2010-10-27 00:21:18 +0000 |
commit | 202e9022c3f64e821da5e2d3da871c8055d97054 (patch) | |
tree | 17f5f1a75b3941bba00a761d6fa3ea9a24e6a09f | |
parent | 94af357a559cb3f6d6abd22855526d40e2de513b (diff) | |
download | org.eclipse.ecf-202e9022c3f64e821da5e2d3da871c8055d97054.tar.gz org.eclipse.ecf-202e9022c3f64e821da5e2d3da871c8055d97054.tar.xz org.eclipse.ecf-202e9022c3f64e821da5e2d3da871c8055d97054.zip |
rsa additions and rsa test bundle added.
13 files changed, 274 insertions, 2 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java index b4e9429be..4a13ab8c3 100644 --- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java +++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java @@ -13,8 +13,6 @@ import java.util.StringTokenizer; import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.IDFactory;
-import org.eclipse.ecf.discovery.IDiscoveryLocator;
-import org.eclipse.ecf.discovery.IServiceInfo;
import org.eclipse.ecf.discovery.IServiceProperties;
import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.Activator;
@@ -30,6 +28,7 @@ public abstract class AbstractMetadataFactory { org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,
org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,
org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED,
// ECF properties
RemoteConstants.ENDPOINT_ID,
RemoteConstants.ENDPOINT_ID_NAMESPACE,
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.classpath b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.classpath new file mode 100644 index 000000000..8a8f1668c --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.gitignore b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.gitignore new file mode 100644 index 000000000..e660fd93d --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.project b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.project new file mode 100644 index 000000000..5fce69511 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.tests.osgi.services.remoteserviceadmin</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/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.jdt.core.prefs b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..948947496 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Oct 26 17:03:06 PDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.pde.core.prefs b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..75b58abe5 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Tue Oct 26 17:03:06 PDT 2010
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF new file mode 100644 index 000000000..3f188db57 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %bundle.name +Bundle-SymbolicName: org.eclipse.ecf.tests.osgi.services.remoteserviceadmin +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.ecf.tests.osgi.services.remoteserviceadmin.Activator +Bundle-Vendor: %bundle.provider +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: bundle +Import-Package: org.eclipse.ecf.core.identity;version="3.2.0", + org.eclipse.ecf.discovery;version="4.0.0", + org.eclipse.ecf.discovery.identity;version="3.0.0", + org.eclipse.ecf.osgi.services.remoteserviceadmin, + org.osgi.framework;version="1.3.0", + org.osgi.service.remoteserviceadmin;version="1.0.0", + org.osgi.util.tracker +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0", + org.junit;bundle-version="4.8.1", + org.eclipse.ecf.tests;bundle-version="2.1.0" diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/about.html b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/about.html new file mode 100644 index 000000000..4c79781a5 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/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>June 25, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/build.properties b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/build.properties new file mode 100644 index 000000000..0cf66274b --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/build.properties @@ -0,0 +1,8 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ bundle.properties
+src.includes = about.html,\
+ bundle.properties
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/bundle.properties b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/bundle.properties new file mode 100644 index 000000000..8675daf70 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/bundle.properties @@ -0,0 +1,10 @@ +############################################################################
+# Copyright (c) 2010 Composent Inc. 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
+#
+############################################################################
+bundle.name=ECF Remote Service Admin Tests
+bundle.provider=Eclipse.org - ECF
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractMetadataFactoryTest.java b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractMetadataFactoryTest.java new file mode 100644 index 000000000..1aff8a49e --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/AbstractMetadataFactoryTest.java @@ -0,0 +1,108 @@ +package org.eclipse.ecf.tests.osgi.services.remoteserviceadmin;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
+import org.eclipse.ecf.discovery.IDiscoveryLocator;
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription;
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteConstants;
+import org.eclipse.ecf.tests.ECFAbstractTestCase;
+import org.osgi.framework.Constants;
+import org.osgi.util.tracker.ServiceTracker;
+
+public abstract class AbstractMetadataFactoryTest extends ECFAbstractTestCase {
+
+ private static final String DEFAULT_ENDPOINT_ID = "ecftcp://localhost:3282/server";
+ private static final String DEFAULT_SERVICE_IMPORTED_CONFIG = "ecf.generic.server";
+ protected IDiscoveryAdvertiser discoveryAdvertiser;
+ protected IDiscoveryLocator discoveryLocator;
+
+ protected IDiscoveryLocator getDiscoveryLocator() {
+ ServiceTracker serviceTracker = new ServiceTracker(Activator.getContext(),IDiscoveryLocator.class.getName(), null);
+ serviceTracker.open();
+ IDiscoveryLocator result = (IDiscoveryLocator) serviceTracker.getService();
+ serviceTracker.close();
+ return result;
+ }
+
+ protected IDiscoveryAdvertiser getDiscoveryAdvertiser() {
+ ServiceTracker serviceTracker = new ServiceTracker(Activator.getContext(),IDiscoveryAdvertiser.class.getName(), null);
+ serviceTracker.open();
+ IDiscoveryAdvertiser result = (IDiscoveryAdvertiser) serviceTracker.getService();
+ serviceTracker.close();
+ return result;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ discoveryAdvertiser = null;
+ discoveryLocator = null;
+ super.tearDown();
+ }
+
+ protected String[] createOSGiObjectClass() {
+ return new String[] { "com.foo.IFoo" };
+ }
+
+ protected String createOSGiEndpointFrameworkUUID() {
+ return UUID.randomUUID().toString();
+ }
+
+ protected String createOSGiEndpointId() {
+ return DEFAULT_ENDPOINT_ID;
+ }
+
+ protected Long createOSGiEndpointServiceId() {
+ return new Long(1);
+ }
+
+ protected EndpointDescription createRequiredEndpointDescription() {
+ Map<String,Object> props = new HashMap<String,Object>();
+ // Add required OSGi properties
+ addRequiredOSGiProperties(props);
+ // Add required ECF properties
+ addRequiredECFProperties(props);
+ return new EndpointDescription(props);
+ }
+
+ protected String createOSGiServiceImportedConfig() {
+ return DEFAULT_SERVICE_IMPORTED_CONFIG;
+ }
+
+ protected ID createECFContainerID(Map<String,Object> props) {
+ return getIDFactory().createStringID(createOSGiEndpointId());
+ }
+
+ protected Long createECFRemoteServiceId(Map<String,Object> props) {
+ return new Long(101);
+ }
+
+ protected void addRequiredOSGiProperties(Map<String,Object> props) {
+ // OBJECTCLASS
+ props.put(Constants.OBJECTCLASS,createOSGiObjectClass());
+ // endpoint.service.id
+ props.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID, createOSGiEndpointServiceId());
+ // endpoint.framework.id
+ props.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID, createOSGiEndpointFrameworkUUID());
+ // endpoint.id
+ props.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID, createOSGiEndpointId());
+ // service imported configs
+ props.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,createOSGiServiceImportedConfig());
+ }
+
+
+ protected void addRequiredECFProperties(Map<String,Object> props) {
+ // ecf.endpoint.id
+ props.put(RemoteConstants.ENDPOINT_ID,createECFContainerID(props));
+ // ecf.endpoint.
+ props.put(RemoteConstants.ENDPOINT_REMOTESERVICE_ID, createECFRemoteServiceId(props));
+ }
+
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/Activator.java b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/Activator.java new file mode 100644 index 000000000..497647bca --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/Activator.java @@ -0,0 +1,30 @@ +package org.eclipse.ecf.tests.osgi.services.remoteserviceadmin;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/ServiceInfoFactoryTest.java b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/ServiceInfoFactoryTest.java new file mode 100644 index 000000000..5a5620582 --- /dev/null +++ b/incubation/bundles/org.eclipse.ecf.tests.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/tests/osgi/services/remoteserviceadmin/ServiceInfoFactoryTest.java @@ -0,0 +1,21 @@ +package org.eclipse.ecf.tests.osgi.services.remoteserviceadmin;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.ecf.discovery.IServiceInfo;
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.DefaultServiceInfoFactory;
+import org.eclipse.ecf.osgi.services.remoteserviceadmin.IServiceInfoFactory;
+
+public class ServiceInfoFactoryTest extends AbstractMetadataFactoryTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ discoveryAdvertiser = getDiscoveryAdvertiser();
+ Assert.isNotNull(discoveryAdvertiser);
+ }
+
+ public void testCreateServiceInfoFromMinimalEndpointDescription() throws Exception {
+ IServiceInfoFactory serviceInfoFactory = new DefaultServiceInfoFactory();
+ IServiceInfo serviceInfo = serviceInfoFactory.createServiceInfoForDiscovery(discoveryAdvertiser, createRequiredEndpointDescription());
+ assertNotNull(serviceInfo);
+ }
+}
|