added some new adapters and a few fixes, work in progress, more changes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@888295 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/pom.xml b/dependencymanager/core/pom.xml
index d7e5425..eb89cb7 100644
--- a/dependencymanager/core/pom.xml
+++ b/dependencymanager/core/pom.xml
@@ -31,12 +31,12 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
</dependencies>
<build>
diff --git a/dependencymanager/shell/pom.xml b/dependencymanager/shell/pom.xml
index 2dc5b06..bb05859 100644
--- a/dependencymanager/shell/pom.xml
+++ b/dependencymanager/shell/pom.xml
@@ -33,12 +33,12 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
diff --git a/dependencymanager/test/pom.xml b/dependencymanager/test/pom.xml
index 4457461..1ff6e5f 100644
--- a/dependencymanager/test/pom.xml
+++ b/dependencymanager/test/pom.xml
@@ -30,12 +30,12 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>4.2.0</version>
+ <version>4.1.0</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
new file mode 100644
index 0000000..5d10d0f
--- /dev/null
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
@@ -0,0 +1,113 @@
+
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.felix.dm.test;
+
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import junit.framework.Assert;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.service.Service;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+
+@RunWith(JUnit4TestRunner.class)
+public class AbstractServiceDependencyTest {
+ @Configuration
+ public static Option[] configuration() {
+ return options(
+ provision(
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
+ )
+ );
+ }
+
+ @Test
+ public void testAbstractClassDependency(BundleContext context) {
+ DependencyManager m = new DependencyManager(context);
+ // helper class that ensures certain steps get executed in sequence
+ Ensure e = new Ensure();
+ // create a service provider and consumer
+ Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceAbstract.class.getName(), null);
+ Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceAbstract.class).setRequired(true).setCallbacks("bind", "unbind"));
+ m.add(sp);
+ m.add(sc);
+ m.remove(sp);
+ // ensure we executed all steps inside the component instance
+ e.step(8);
+ }
+
+ static abstract class ServiceAbstract {
+ public abstract void invoke();
+ }
+
+ static class ServiceProvider extends ServiceAbstract {
+ private final Ensure m_ensure;
+ public ServiceProvider(Ensure e) {
+ m_ensure = e;
+ }
+
+ public void start() {
+ m_ensure.step(1);
+ }
+
+ public void invoke() {
+ m_ensure.step(4);
+ }
+
+ public void stop() {
+ m_ensure.step(7);
+ }
+ }
+
+ static class ServiceConsumer {
+ private volatile ServiceAbstract m_service;
+ private final Ensure m_ensure;
+
+ public ServiceConsumer(Ensure e) {
+ m_ensure = e;
+ }
+
+ public void bind(ServiceAbstract service) {
+ m_ensure.step(2);
+ m_service = service;
+ }
+
+ public void start() {
+ m_ensure.step(3);
+ m_service.invoke();
+ }
+
+ public void stop() {
+ m_ensure.step(5);
+ }
+
+ public void unbind(ServiceAbstract service) {
+ Assert.assertEquals(m_service, service);
+ m_ensure.step(6);
+ }
+ }
+}
\ No newline at end of file
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
index 7e34cdb..3bf4140 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
@@ -40,7 +40,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
index eb1bc20..00234aa 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
@@ -39,7 +39,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
index 0c03b1c..5859ea4 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
@@ -37,7 +37,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
index 6059641..cb089ed 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
@@ -46,7 +46,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
index ed09ed5..03b053f 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
@@ -40,7 +40,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
index 79eb674..e155332 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
@@ -33,9 +33,9 @@
import junit.framework.Assert;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.service.Service;
import org.apache.felix.dm.resources.Resource;
import org.apache.felix.dm.resources.ResourceHandler;
+import org.apache.felix.dm.service.Service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -52,7 +52,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
index ad0f4d3..ad7ebc9 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
@@ -37,7 +37,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
index 41f7335..39cbd72 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
@@ -28,13 +28,13 @@
import java.util.Properties;
import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.service.Service;
import org.apache.felix.dm.dependencies.BundleDependency;
import org.apache.felix.dm.dependencies.ConfigurationDependency;
import org.apache.felix.dm.dependencies.ResourceDependency;
import org.apache.felix.dm.dependencies.ServiceDependency;
import org.apache.felix.dm.resources.Resource;
import org.apache.felix.dm.resources.ResourceHandler;
+import org.apache.felix.dm.service.Service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -54,7 +54,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject(),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4")
)
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
index c5575dc..47fd5da 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
@@ -37,7 +37,7 @@
public static Option[] configuration() {
return options(
provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+ mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
)
);