pax-exam 3.0.0 migration ...
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1531939 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PropagateAnnotationTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PropagateAnnotationTest.java
deleted file mode 100644
index 55e33e2..0000000
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/annotation/PropagateAnnotationTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.annotation;
-
-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 static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.test.Base;
-import org.apache.felix.dm.test.BundleGenerator;
-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;
-import org.osgi.framework.Constants;
-
-/**
- * Use case: Verify that dependency "propagate" option is properly propagating properties to provided service.
- */
-@RunWith(JUnit4TestRunner.class)
-public class PropagateAnnotationTest extends AnnotationBase
-{
- @Configuration
- public static Option[] configuration()
- {
- return options(
- systemProperty(DMLOG_PROPERTY).value( "true" ),
- provision(
- mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
- 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"),
- mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager.runtime").versionAsInProject()),
- provision(
- new BundleGenerator()
- .set(Constants.BUNDLE_SYMBOLICNAME, "PropagateAnnotationTest")
- .set("Export-Package", "org.apache.felix.dm.test.bundle.annotation.sequencer")
- .set("Private-Package", "org.apache.felix.dm.test.bundle.annotation.propagate")
- .set("Import-Package", "*")
- .set("-plugin", "org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin")
- .build()));
- }
-
- /**
- * A Service that just registers/unregisters its service, using the @ServiceLifecycle annotation.
- */
- @Test
- public void testServiceDependencyPropagate(BundleContext context)
- {
- DependencyManager m = new DependencyManager(context);
- m.add(makeSequencer(m, "ServiceDependencyPropagateTest"));
- m_ensure.waitForStep(3, 10000);
- }
-}
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/propagate/ServiceDependencyPropagateTest.java b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/PropagateAnnotation.java
similarity index 72%
rename from dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/propagate/ServiceDependencyPropagateTest.java
rename to dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/PropagateAnnotation.java
index 1c53353..b95cf71 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/propagate/ServiceDependencyPropagateTest.java
+++ b/dependencymanager/test2/src/main/java/org/apache/felix/dependencymanager/test2/components/PropagateAnnotation.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.dm.test.bundle.annotation.propagate;
+package org.apache.felix.dependencymanager.test2.components;
import java.util.Map;
@@ -24,25 +24,23 @@
import org.apache.felix.dm.annotation.api.Property;
import org.apache.felix.dm.annotation.api.ServiceDependency;
import org.apache.felix.dm.annotation.api.Start;
-import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
/**
* Verifies ServiceDependencyservice properties propagation.
*/
-public class ServiceDependencyPropagateTest
-{
+public class PropagateAnnotation {
@Component
public static class Consumer {
- private Map m_producerProps;
+ private volatile Map m_producerProps;
@ServiceDependency
void bind(Map props, Producer producer) {
m_producerProps = props;
}
-
- @ServiceDependency(filter="(name=ServiceDependencyPropagateTest)")
- Sequencer m_sequencer;
-
+
+ @ServiceDependency(filter = "(name=test.PropagateAnnotationTest)")
+ volatile Ensure m_sequencer;
+
@Start
void start() {
m_sequencer.step(1);
@@ -54,15 +52,14 @@
}
}
}
-
- @Component(provides={Producer.class}, properties={@Property(name="foo", value="bar")})
- public static class Producer {
- @ServiceDependency(propagate=true)
- Producer2 m_producer;
- }
-
- @Component(provides={Producer2.class}, properties={@Property(name="foo2", value="bar2")})
+ @Component(provides = {Producer.class}, properties = {@Property(name = "foo", value = "bar")})
+ public static class Producer {
+ @ServiceDependency(propagate = true)
+ volatile Producer2 m_producer;
+ }
+
+ @Component(provides = {Producer2.class}, properties = {@Property(name = "foo2", value = "bar2")})
public static class Producer2 {
}
}
diff --git a/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PropagateAnnotationTest.java b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PropagateAnnotationTest.java
new file mode 100644
index 0000000..caea4db
--- /dev/null
+++ b/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/PropagateAnnotationTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.dependencymanager.test2.integration.annotations;
+
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * Use case: Verify that dependency "propagate" option is properly propagating properties to provided service.
+ */
+@RunWith(PaxExam.class)
+public class PropagateAnnotationTest extends TestBase {
+ @Test
+ public void testServiceDependencyPropagate() {
+ Ensure e = new Ensure();
+ ServiceRegistration sr = register(e, "test.PropagateAnnotationTest");
+ e.waitForStep(3, 10000);
+ sr.unregister();
+ }
+}