FELIX-5177: added test case for the support of configuration proxy used with the @FactoryConfigurationAdapterService annotation.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1729676 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
index 9a8b950..11f5923 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
@@ -193,6 +193,10 @@
}
}
+ public interface Config {
+ String getFoo();
+ }
+
// This component configures the FactoryPidComponent / FactoryPidComponent2 components.
@Component
public static class FactoryPidConfigurator {
@@ -204,6 +208,7 @@
private Configuration m_conf1;
private Configuration m_conf2;
+ private Configuration m_conf3;
@Start
void start() throws IOException {
@@ -216,12 +221,18 @@
props = new Hashtable<>();
props.put("foo", "bar");
m_conf2.update(props);
+
+ m_conf3 = m_cm.createFactoryConfiguration(Config.class.getName());
+ props = new Hashtable<>();
+ props.put("foo", "bar");
+ m_conf3.update(props);
}
@Stop
void stop() throws IOException {
m_conf1.delete();
m_conf2.delete();
+ m_conf3.delete();
}
}
@@ -265,4 +276,25 @@
m_ensure.step();
}
}
+
+ // This is a factory pid component with an updated callback having the "updated(Config)" signature
+ @FactoryConfigurationAdapterService(factoryPidClass=Config.class)
+ public static class FactoryPidComponent3 {
+ Config m_properties;
+
+ void updated(Config properties) {
+ m_properties = properties;
+ }
+
+ @ServiceDependency(filter="(name=" + ENSURE_FACTORYPID + ")")
+ Ensure m_ensure;
+
+ @Start
+ void start() {
+ Thread.dumpStack();
+ Assert.assertNotNull(m_properties);
+ Assert.assertEquals("bar", m_properties.getFoo());
+ m_ensure.step();
+ }
+ }
}
diff --git a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
index 1a52580..cff7189 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
@@ -45,7 +45,7 @@
public void testFactoryPidUpdatedSignature1() {
Ensure e = new Ensure();
ServiceRegistration sr = register(e, MethodSignatures.ENSURE_FACTORYPID);
- e.waitForStep(2, 5000);
+ e.waitForStep(3, 5000);
sr.unregister();
}
}