Fix issue Felix-855 and Felix-860
Felix-855:
iPOJO Temporal dependencies now support Collection. So aggregate dependencies can be injected inside collections. When using a collection, the dependency description must specify the service specification thanks to the 'specification' attribute.
Felix-860
iPOJO temporal dependencies is now able to inject proxies. So injected objects can be given to collaborators.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@728714 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CollectionCheckServiceProvider.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CollectionCheckServiceProvider.java
new file mode 100644
index 0000000..03c5776
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CollectionCheckServiceProvider.java
@@ -0,0 +1,58 @@
+/*
+ * 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.ipojo.test.scenarios.component;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
+
+public class CollectionCheckServiceProvider implements CheckService {
+
+ /**
+ * Temporal dependency.
+ */
+ private Collection fs;
+
+ public boolean check() {
+ boolean result = true;
+ //Use a local variable to avoid to wait at each access.
+ Collection col = fs;
+ if (col != null) {
+ Iterator it = col.iterator();
+ while (it.hasNext()) {
+ FooService svc = (FooService) it.next();
+ result = result && svc.foo();
+ }
+ }
+ return result;
+ }
+
+ public Properties getProps() {
+ Iterator it = fs.iterator();
+ if (it.hasNext()) {
+ FooService svc = (FooService) it.next();
+ return svc.fooProps();
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CheckServiceProviderHelper.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CheckServiceProviderHelper.java
new file mode 100755
index 0000000..cfa5b70
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CheckServiceProviderHelper.java
@@ -0,0 +1,57 @@
+/*
+ * 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.ipojo.test.scenarios.component.proxy;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
+
+public class CheckServiceProviderHelper implements CheckService {
+
+ /**
+ * injected dependency.
+ */
+ private FooService fs;
+
+ public CheckServiceProviderHelper(FooService svc) {
+ fs = svc;
+ }
+
+ public boolean check() {
+ if (fs != null) { // Cannot be null
+ try {
+ return fs.foo();
+ } catch (NullPointerException e) {
+ // Can throw a NPE for null policy.
+ System.out.println(e.getMessage());
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public Properties getProps() {
+ if (fs != null) {
+ return fs.fooProps();
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CollectionCheckServiceProviderHelper.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CollectionCheckServiceProviderHelper.java
new file mode 100644
index 0000000..9344722
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/CollectionCheckServiceProviderHelper.java
@@ -0,0 +1,62 @@
+/*
+ * 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.ipojo.test.scenarios.component.proxy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
+
+public class CollectionCheckServiceProviderHelper implements CheckService {
+
+ /**
+ * Injected dependency.
+ */
+ private Collection fs;
+
+ public CollectionCheckServiceProviderHelper(Collection col) {
+ fs = col;
+ }
+
+ public boolean check() {
+ boolean result = true;
+ //Use a local variable to avoid to wait at each access.
+ Collection col = fs;
+ if (col != null) {
+ Iterator it = col.iterator(); // Get the cached copy
+ while (it != null && it.hasNext()) {
+ FooService svc = (FooService) it.next();
+ result = result && svc.foo();
+ }
+ }
+ return result;
+ }
+
+ public Properties getProps() {
+ Iterator it = fs.iterator();
+ if (it.hasNext()) {
+ FooService svc = (FooService) it.next();
+ return svc.fooProps();
+ }
+ return null;
+ }
+
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCheckServiceProvider.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCheckServiceProvider.java
new file mode 100755
index 0000000..f4b4099
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCheckServiceProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.ipojo.test.scenarios.component.proxy;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
+
+public class HelpedCheckServiceProvider implements CheckService {
+
+ /**
+ * Temporal dependency.
+ */
+ private FooService fs;
+
+ private CheckServiceProviderHelper helper = new CheckServiceProviderHelper(fs);
+
+ public boolean check() {
+ return helper.check();
+ }
+
+ public Properties getProps() {
+ return helper.getProps();
+ }
+
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCollectionCheckServiceProvider.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCollectionCheckServiceProvider.java
new file mode 100644
index 0000000..f0c0e5d
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/component/proxy/HelpedCollectionCheckServiceProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.ipojo.test.scenarios.component.proxy;
+
+import java.util.Collection;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+
+public class HelpedCollectionCheckServiceProvider implements CheckService {
+
+ /**
+ * Temporal dependency.
+ */
+ private Collection fs;
+
+ private CollectionCheckServiceProviderHelper helper = new CollectionCheckServiceProviderHelper(fs);
+
+ public boolean check() {
+ return helper.check();
+ }
+
+ public Properties getProps() {
+ return helper.getProps();
+ }
+
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
index 11a8539..bf3e7b0 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DefaultImplementationTest.java
@@ -66,6 +66,45 @@
under.dispose();
}
+ public void testDefaultImplementationWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-DIProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testDefaultImplementationTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -101,6 +140,41 @@
return;
}
+ public void testDefaultImplementationTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-DIProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
public void testDelayTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -140,6 +214,45 @@
under.dispose();
}
+ public void testDelayTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-DIProxiedCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testDefaultImplementationMultipleTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -178,6 +291,82 @@
return;
}
+ public void testDefaultImplementationCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-DIColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testDefaultImplementationProxiedCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-DIProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
public void testDelayOnMultipleDependency() {
String prov = "provider";
ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -228,4 +417,106 @@
under.stop();
under.dispose();
}
+
+ public void testDelayOnCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnProxiedCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DelayTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DelayTest.java
index 023801b..6adb197 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DelayTest.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/DelayTest.java
@@ -66,6 +66,45 @@
under.dispose();
}
+ public void testDelayWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -103,6 +142,43 @@
fail("Timeout expected");
}
+ public void testTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 4000);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ try {
+ cs.check();
+ } catch(RuntimeException e) {
+ // OK
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ fail("Timeout expected");
+ }
+
public void testDelayTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -142,6 +218,45 @@
under.dispose();
}
+ public void testDelayTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testSetTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -179,6 +294,43 @@
fail("Timeout expected");
}
+ public void testSetTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ try {
+ cs.check();
+ } catch(RuntimeException e) {
+ // OK
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ fail("Timeout expected");
+ }
+
public void testDelayOnMultipleDependency() {
String prov = "provider";
ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -227,4 +379,102 @@
under.stop();
under.dispose();
}
+
+ public void testDelayOnCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider1.stop();
+ provider2.stop();
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnProxiedCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider1.stop();
+ provider2.stop();
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyArrayTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyArrayTest.java
deleted file mode 100644
index c89456a..0000000
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyArrayTest.java
+++ /dev/null
@@ -1,118 +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.ipojo.test.scenarios.temporal;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
-import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
-import org.osgi.framework.ServiceReference;
-
-public class EmptyArrayTest extends OSGiTestCase {
-
- public void testEmptyArrayTimeout() {
- String prov = "provider";
- ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) context.getService(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) context.getService(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch(RuntimeException e) {
- fail("An empty array was expected ...");
- }
- assertTrue("Check empty array", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyMultipleCheckServiceProvider", un);
-
- ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) context.getService(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) context.getService(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) context.getService(ref_cs);
-
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyTest.java
new file mode 100755
index 0000000..1ecf5bf
--- /dev/null
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/EmptyTest.java
@@ -0,0 +1,296 @@
+/*
+ * 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.ipojo.test.scenarios.temporal;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.temporal.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class EmptyTest extends OSGiTestCase {
+
+ public void testEmptyArrayTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyMultipleCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("An empty array was expected ...");
+ }
+ assertTrue("Check empty array", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testEmptyCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("An empty array was expected ...");
+ }
+ assertTrue("Check empty array", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testEmptyProxiedCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("An empty array was expected ...");
+ }
+ assertTrue("Check empty array", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testDelayOnMultipleDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyMultipleCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnProxiedCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-EmptyProxiedColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NoDelayTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NoDelayTest.java
index 974af3f..0e31841 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NoDelayTest.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NoDelayTest.java
@@ -50,6 +50,29 @@
under.dispose();
}
+ public void testNoDelayWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedCheckServiceProvider", un);
+ assertNotNull("Check creation", under);
+ assertNotNull("Check provider creation", prov);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testMultipleNoDelay() {
String prov1 = "provider-1";
ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov1);
@@ -70,5 +93,47 @@
under.stop();
under.dispose();
}
+
+ public void testCollectionNoDelay() {
+ String prov1 = "provider-1";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov1);
+ String un = "under-2";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov1);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ provider1.stop();
+ provider1.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testProxiedCollectionNoDelay() {
+ String prov1 = "provider-1";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov1);
+ String un = "under-2";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-ProxiedColCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov1);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ provider1.stop();
+ provider1.dispose();
+ under.stop();
+ under.dispose();
+ }
}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
index f33c4ff..81ad5b0 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullTest.java
@@ -27,7 +27,7 @@
public class NullTest extends OSGiTestCase {
- public void testNullable() {
+ public void testNull() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
String un = "under-1";
@@ -66,7 +66,7 @@
under.dispose();
}
- public void testNullableTimeout() {
+ public void testNullTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
String un = "under-1";
@@ -140,7 +140,120 @@
under.dispose();
}
- public void testNullableMultipleTimeout() {
+ public void testNullWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testNullTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A null was expected ...");
+ }
+ assertFalse("Check null", res); // Return false when the foo service is null.
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testDelayTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullProxiedCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testNullMultipleTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
String un = "under-1";
@@ -178,6 +291,83 @@
return;
}
+ public void testNullCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A null was expected ...");
+ }
+ assertTrue("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testNullProxiedCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A null was expected ... : " + e.getMessage());
+ e.printStackTrace();
+ }
+ assertTrue("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
public void testDelayOnMultipleDependency() {
String prov = "provider";
ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -228,4 +418,106 @@
under.stop();
under.dispose();
}
+
+ public void testDelayOnCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnProxiedCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
index b31100b..b4a4c04 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/NullableTest.java
@@ -140,6 +140,119 @@
under.dispose();
}
+ public void testNullableWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testNullableTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedCheckServiceProvider", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testDelayTimeoutWithProxy() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider, 200);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+
+ assertTrue("Assert delay", (end - begin) >= 200);
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 3", cs.check());
+
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ }
+
public void testNullableMultipleTimeout() {
String prov = "provider";
ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -178,6 +291,82 @@
return;
}
+ public void testNullableCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
+ public void testNullableProxiedCollectionTimeout() {
+ String prov = "provider";
+ ComponentInstance provider = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the provider.
+ provider.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ DelayedProvider dp = new DelayedProvider(provider, 400);
+ dp.start();
+ cs = (CheckService) context.getService(ref_cs);
+ boolean res = false;
+ try {
+ res = cs.check();
+ } catch(RuntimeException e) {
+ fail("A nullable was expected ...");
+ }
+ assertFalse("Check nullable", res);
+
+ dp.stop();
+ provider.stop();
+ provider.dispose();
+ under.stop();
+ under.dispose();
+ return;
+ }
+
public void testDelayOnMultipleDependency() {
String prov = "provider";
ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
@@ -228,4 +417,106 @@
under.stop();
under.dispose();
}
+
+ public void testDelayOnCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
+
+ public void testDelayOnProxiedCollectionDependency() {
+ String prov = "provider";
+ ComponentInstance provider1 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov);
+ String prov2 = "provider2";
+ ComponentInstance provider2 = Utils.getComponentInstanceByName(context, "TEMPORAL-FooProvider", prov2);
+ String un = "under-1";
+ ComponentInstance under = Utils.getComponentInstanceByName(context, "TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
+
+ ServiceReference ref_fs = Utils.getServiceReferenceByName(context, FooService.class.getName(), prov);
+ assertNotNull("Check foo availability", ref_fs);
+
+ ServiceReference ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability", ref_cs);
+
+ CheckService cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation", cs.check());
+
+ // Stop the providers.
+ provider1.stop();
+ provider2.stop();
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 2", ref_cs);
+ long begin = System.currentTimeMillis();
+ DelayedProvider dp = new DelayedProvider(provider1, 1500);
+ DelayedProvider dp2 = new DelayedProvider(provider2, 100);
+ dp.start();
+ dp2.start();
+ cs = (CheckService) context.getService(ref_cs);
+ assertTrue("Check invocation - 2", cs.check());
+ long end = System.currentTimeMillis();
+ System.out.println("delay = " + (end - begin));
+ assertTrue("Assert min delay", (end - begin) >= 100);
+ assertTrue("Assert max delay", (end - begin) <= 1000);
+ dp.stop();
+ dp2.stop();
+
+ provider1.stop();
+ provider2.stop();
+
+ ref_cs = Utils.getServiceReferenceByName(context, CheckService.class.getName(), un);
+ assertNotNull("Check cs availability - 3", ref_cs);
+ cs = (CheckService) context.getService(ref_cs);
+
+ assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
+
+ provider1.dispose();
+ provider2.dispose();
+ under.stop();
+ under.dispose();
+ }
}
diff --git a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/TemporalTestSuite.java b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/TemporalTestSuite.java
index 7f5d1cd..a03b6a5 100644
--- a/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/TemporalTestSuite.java
+++ b/ipojo/tests/handler/temporal/src/main/java/org/apache/felix/ipojo/test/scenarios/temporal/TemporalTestSuite.java
@@ -33,7 +33,7 @@
ots.addTestSuite(NullableTest.class);
ots.addTestSuite(DefaultImplementationTest.class);
ots.addTestSuite(NullTest.class);
- ots.addTestSuite(EmptyArrayTest.class);
+ ots.addTestSuite(EmptyTest.class);
return ots;
}
diff --git a/ipojo/tests/handler/temporal/src/main/resources/metadata.xml b/ipojo/tests/handler/temporal/src/main/resources/metadata.xml
index 9613248..2ce1fbb 100644
--- a/ipojo/tests/handler/temporal/src/main/resources/metadata.xml
+++ b/ipojo/tests/handler/temporal/src/main/resources/metadata.xml
@@ -1,24 +1,40 @@
-<ipojo
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="org.apache.felix.ipojo http://people.apache.org/~clement/ipojo/schemas/core.xsd
- org.apache.felix.ipojo.handler.temporal http://people.apache.org/~clement/ipojo/schemas/temporal.xsd"
- xmlns="org.apache.felix.ipojo"
+<ipojo
xmlns:temp="org.apache.felix.ipojo.handler.temporal">
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-CheckServiceProvider">
<temp:requires field="fs"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-ProxiedCheckServiceProvider">
+ <temp:requires field="fs" proxy="true"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-CheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-ProxiedCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" timeout="300"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-MultipleCheckServiceProvider">
<temp:requires field="fs"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-ColCheckServiceProvider">
+ <temp:requires field="fs" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-ProxiedColCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.FooProvider" name="TEMPORAL-FooProvider">
<provides/>
</component>
@@ -29,71 +45,181 @@
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-NullableColCheckServiceProvider">
+ <temp:requires field="fs" onTimeout="nullable" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-NullableProxiedColCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="nullable" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-NullableCheckServiceProvider">
<temp:requires field="fs" onTimeout="nullable"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-NullableProxiedCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="nullable"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-NullableCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="nullable"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-NullableProxiedCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" onTimeout="nullable" timeout="300"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-NullableMultipleCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="nullable"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-NullableColCheckServiceProviderTimeout">
+ <temp:requires field="fs" onTimeout="nullable" timeout="300" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-NullableProxiedColCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" onTimeout="nullable" timeout="300" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<!-- Dependencies using default implementation -->
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-DIMultipleCheckServiceProvider">
<temp:requires field="fs" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-DIColCheckServiceProvider">
+ <temp:requires field="fs" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-DIProxiedColCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-DICheckServiceProvider">
<temp:requires field="fs" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-DIProxiedCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-DICheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-DIProxiedCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" timeout="300" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-DIMultipleCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-DIColCheckServiceProviderTimeout">
+ <temp:requires field="fs" timeout="300" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-DIProxiedColCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" timeout="300" onTimeout="org.apache.felix.ipojo.test.scenarios.component.NullableFooProvider" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<!-- Dependencies using null -->
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-NullMultipleCheckServiceProvider">
<temp:requires field="fs" onTimeout="null"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-NullColCheckServiceProvider">
+ <temp:requires field="fs" onTimeout="null" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-NullProxiedColCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="null" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-NullCheckServiceProvider">
<temp:requires field="fs" onTimeout="null"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-NullProxiedCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="null"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider" name="TEMPORAL-NullCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="null"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCheckServiceProvider" name="TEMPORAL-NullProxiedCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" timeout="300" onTimeout="null"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-NullMultipleCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="null"/>
<provides/>
</component>
- <!-- Dependencies using empty arrays -->
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-NullColCheckServiceProviderTimeout">
+ <temp:requires field="fs" timeout="300" onTimeout="null" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-NullProxiedColCheckServiceProviderTimeout">
+ <temp:requires field="fs" proxy="true" timeout="300" onTimeout="null" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <!-- Dependencies using empty arrays -->
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-EmptyMultipleCheckServiceProvider">
<temp:requires field="fs" onTimeout="empty-array"/>
<provides/>
</component>
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-EmptyColCheckServiceProvider">
+ <temp:requires field="fs" onTimeout="empty" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-EmptyProxiedColCheckServiceProvider">
+ <temp:requires field="fs" proxy="true" onTimeout="empty" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
<component classname="org.apache.felix.ipojo.test.scenarios.component.MultipleCheckServiceProvider" name="TEMPORAL-EmptyMultipleCheckServiceProviderTimeout">
<temp:requires field="fs" timeout="300" onTimeout="empty-array"/>
<provides/>
</component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckServiceProvider" name="TEMPORAL-EmptyColCheckServiceProviderTimeout">
+ <temp:requires field="fs" timeout="300" onTimeout="empty" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
+
+ <component classname="org.apache.felix.ipojo.test.scenarios.component.proxy.HelpedCollectionCheckServiceProvider" name="TEMPORAL-EmptyProxiedColCheckServiceProviderTimeout">
+ <temp:requires field="fs" timeout="300" proxy="true" onTimeout="empty" specification="org.apache.felix.ipojo.test.scenarios.temporal.service.FooService"/>
+ <provides/>
+ </component>
</ipojo>
\ No newline at end of file