Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-03-28 14:24:26 +0000
committerslewis2014-03-28 14:24:26 +0000
commit69486db2214f497c8857e7b544869bad3e63eedd (patch)
treea090f98bcc0af4a571a8c391282957378af71788
parent62fe1aff4134f2436d39877f34e4d36a00e1e700 (diff)
downloadorg.eclipse.ecf-bug421569.tar.gz
org.eclipse.ecf-bug421569.tar.xz
org.eclipse.ecf-bug421569.zip
Added NoRegistryContainerFactoryTestbug421569
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/NoRegistryContainerFactoryTest.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/NoRegistryContainerFactoryTest.java b/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/NoRegistryContainerFactoryTest.java
new file mode 100644
index 000000000..ca5eb6e6b
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/NoRegistryContainerFactoryTest.java
@@ -0,0 +1,65 @@
+package org.eclipse.ecf.tests.core;
+
+import junit.framework.TestCase;
+
+import org.eclipse.ecf.core.BaseContainer;
+import org.eclipse.ecf.core.ContainerCreateException;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.IContainerFactory;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
+import org.eclipse.ecf.internal.tests.core.Activator;
+import org.osgi.framework.ServiceRegistration;
+
+public class NoRegistryContainerFactoryTest extends TestCase {
+
+ static class TestContainer extends BaseContainer {
+ public TestContainer(ID id) {
+ super(id);
+ }
+ }
+ protected ContainerTypeDescription createContainerTypeDescription() {
+ return new ContainerTypeDescription(getClass().getName(),new IContainerInstantiator() {
+
+ public IContainer createInstance(
+ ContainerTypeDescription description, Object[] parameters)
+ throws ContainerCreateException {
+ return new TestContainer(IDFactory.getDefault().createGUID());
+ }
+
+ public String[] getSupportedAdapterTypes(
+ ContainerTypeDescription description) {
+ return null;
+ }
+
+ public Class[][] getSupportedParameterTypes(
+ ContainerTypeDescription description) {
+ return null;
+ }
+
+ public String[] getSupportedIntents(
+ ContainerTypeDescription description) {
+ return null;
+ }});
+ }
+
+ private ServiceRegistration r;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ r = Activator.getContext().registerService(ContainerTypeDescription.class, createContainerTypeDescription(), null);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (r != null) r.unregister();
+ }
+
+ public void testCreateContainer() throws Exception {
+ IContainerFactory f = Activator.getDefault().getContainerFactory();
+ IContainer c = f.createContainer(getClass().getName());
+ assertNotNull(c);
+ }
+}

Back to the top