felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1526626 [3/3] - in /felix/trunk/ipojo: manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/ manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manip...
Date Thu, 26 Sep 2013 17:51:20 GMT
Copied: felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullableTest.java (from r1526161, felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullableTest.java?p2=felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullableTest.java&p1=felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java&r1=1526161&r2=1526626&rev=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java (original)
+++ felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullableTest.java Thu Sep 26 17:51:18 2013
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.ipojo.handler.temporal.test;
+
+package org.apache.felix.ipojo.runtime.test.dependencies.timeout;
 
 import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
+import org.apache.felix.ipojo.runtime.test.dependencies.timeout.services.CheckService;
+import org.apache.felix.ipojo.runtime.test.dependencies.timeout.services.FooService;
 import org.junit.Test;
 import org.osgi.framework.ServiceReference;
 
@@ -29,51 +30,11 @@ import static org.junit.Assert.*;
 public class NullableTest extends Common {
 
     @Test
-    public void testNullable() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
     public void testNullableTimeout() {
         String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
+        ComponentInstance provider = ipojoHelper.createComponentInstance("FooProvider", prov);
         String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un);
+        ComponentInstance under = ipojoHelper.createComponentInstance("NullableCheckServiceProvider", un);
 
         ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
         assertNotNull("Check foo availability", ref_fs);
@@ -107,125 +68,9 @@ public class NullableTest extends Common
     @Test
     public void testDelayTimeout() {
         String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
-    public void testNullableWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
-    public void testNullableTimeoutWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
+        ComponentInstance provider = ipojoHelper.createComponentInstance("FooProvider", prov);
         String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(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;
-    }
-
-    @Test
-    public void testDelayTimeoutWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProviderTimeout", un);
+        ComponentInstance under = ipojoHelper.createComponentInstance("NullableCheckServiceProviderTimeout", un);
 
         ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
         assertNotNull("Check foo availability", ref_fs);
@@ -260,276 +105,4 @@ public class NullableTest extends Common
         under.dispose();
     }
 
-    @Test
-    public void testNullableMultipleTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 400);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(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;
-    }
-
-    @Test
-    public void testNullableCollectionTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 400);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(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;
-    }
-
-    @Test
-    public void testNullableProxiedCollectionTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 400);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(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;
-    }
-
-    @Test
-    public void testDelayOnMultipleDependency() {
-        String prov = "provider";
-        ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String prov2 = "provider2";
-        ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the providers.
-        provider1.stop();
-        provider2.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(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 = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(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();
-    }
-
-    @Test
-    public void testDelayOnCollectionDependency() {
-        String prov = "provider";
-        ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String prov2 = "provider2";
-        ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the providers.
-        provider1.stop();
-        provider2.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(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 = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(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();
-    }
-
-    @Test
-    public void testDelayOnProxiedCollectionDependency() {
-        String prov = "provider";
-        ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String prov2 = "provider2";
-        ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the providers.
-        provider1.stop();
-        provider2.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(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 = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(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();
-    }
 }

Copied: felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/TimeoutTest.java (from r1526161, felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/TimeoutTest.java?p2=felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/TimeoutTest.java&p1=felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java&r1=1526161&r2=1526626&rev=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java (original)
+++ felix/trunk/ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/TimeoutTest.java Thu Sep 26 17:51:18 2013
@@ -17,24 +17,24 @@
  * under the License.
  */
 
-package org.apache.felix.ipojo.handler.temporal.test;
+package org.apache.felix.ipojo.runtime.test.dependencies.timeout;
 
 import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
+import org.apache.felix.ipojo.runtime.test.dependencies.timeout.services.CheckService;
+import org.apache.felix.ipojo.runtime.test.dependencies.timeout.services.FooService;
 import org.junit.Test;
 import org.osgi.framework.ServiceReference;
 
 import static org.junit.Assert.*;
 
-public class TemporalTest extends Common {
+public class TimeoutTest extends Common {
 
     @Test
     public void testDelay() {
         String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
+        ComponentInstance provider = ipojoHelper.createComponentInstance("FooProvider", prov);
         String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un);
+        ComponentInstance under = ipojoHelper.createComponentInstance("CheckServiceProviderTimeout", un);
 
         ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
         assertNotNull("Check foo availability", ref_fs);
@@ -71,246 +71,13 @@ public class TemporalTest extends Common
         under.dispose();
     }
 
-    @Test
-    public void testDelayWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
-    public void testTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 4000);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        try {
-            cs.check();
-        } catch (RuntimeException e) {
-            // OK
-            dp.stop();
-            provider.stop();
-            provider.dispose();
-            under.stop();
-            under.dispose();
-            return;
-        }
-
-        fail("Timeout expected");
-    }
-
-    @Test
-    public void testTimeoutWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 4000);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        try {
-            cs.check();
-        } catch (RuntimeException e) {
-            // OK
-            dp.stop();
-            provider.stop();
-            provider.dispose();
-            under.stop();
-            under.dispose();
-            return;
-        }
-
-        fail("Timeout expected");
-    }
-
-    @Test
-    public void testDelayTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
-    public void testDelayTimeoutWithProxy() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(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) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 2", cs.check());
-        long end = System.currentTimeMillis();
-
-        assertTrue("Assert delay", (end - begin) >= 200);
-
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 3", ref_cs);
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation - 3", cs.check());
-
-        provider.stop();
-        provider.dispose();
-        under.stop();
-        under.dispose();
-    }
-
-    @Test
-    public void testSetTimeout() {
-        String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
-        String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un);
-
-        ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
-        assertNotNull("Check foo availability", ref_fs);
-
-        ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability", ref_cs);
-
-        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        assertTrue("Check invocation", cs.check());
-
-        // Stop the provider.
-        provider.stop();
-        ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
-        assertNotNull("Check cs availability - 2", ref_cs);
-        DelayedProvider dp = new DelayedProvider(provider, 400);
-        dp.start();
-        cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-        try {
-            cs.check();
-        } catch (RuntimeException e) {
-            // OK
-            dp.stop();
-            provider.stop();
-            provider.dispose();
-            under.stop();
-            under.dispose();
-            return;
-        }
-
-        fail("Timeout expected");
-    }
 
     @Test
-    public void testSetTimeoutWithProxy() {
+    public void testTimeoutWithException() {
         String prov = "provider";
-        ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
+        ComponentInstance provider = ipojoHelper.createComponentInstance("FooProvider", prov);
         String un = "under-1";
-        ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un);
+        ComponentInstance under = ipojoHelper.createComponentInstance("ExceptionCheckServiceProviderTimeout", un);
 
         ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
         assertNotNull("Check foo availability", ref_fs);

Modified: felix/trunk/ipojo/runtime/core-it/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/pom.xml?rev=1526626&r1=1526625&r2=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/pom.xml (original)
+++ felix/trunk/ipojo/runtime/core-it/pom.xml Thu Sep 26 17:51:18 2013
@@ -63,6 +63,7 @@
         <module>ipojo-core-service-dependency-policies</module>
         <module>ipojo-core-service-dependency-proxies</module>
         <module>ipojo-core-service-dependency-test</module>
+        <module>ipojo-core-service-dependency-timeout-test</module>
         <module>ipojo-core-service-dependency-interceptor-test</module>
         <module>ipojo-core-service-providing-test</module>
         <module>ipojo-api-test</module>

Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java?rev=1526626&r1=1526625&r2=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java (original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java Thu Sep 26 17:51:18 2013
@@ -18,140 +18,117 @@
  */
 package org.apache.felix.ipojo.handlers.dependency;
 
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.ConstructorInjector;
-import org.apache.felix.ipojo.FieldInterceptor;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.MethodInterceptor;
-import org.apache.felix.ipojo.Nullable;
-import org.apache.felix.ipojo.PolicyServiceContext;
+import org.apache.felix.ipojo.*;
 import org.apache.felix.ipojo.handlers.dependency.ServiceUsage.Usage;
 import org.apache.felix.ipojo.util.DependencyModel;
+import org.apache.felix.ipojo.util.Log;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.ServiceReference;
 
+import java.lang.reflect.*;
+import java.util.*;
+
 /**
  * Represent a service dependency of the component instance.
+ *
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class Dependency extends DependencyModel implements FieldInterceptor, MethodInterceptor,
-    ConstructorInjector {
+        ConstructorInjector {
 
     /**
      * Reference on the Dependency Handler.
      */
     private final DependencyHandler m_handler;
-
     /**
      * Field of the dependency.
      */
     private final String m_field;
-
+    /**
+     * Default-Implementation.
+     */
+    private final String m_di;
+    /**
+     * Exception to throw when no providers are available.
+     */
+    private final String m_exception;
+    /**
+     * Is the Nullable pattern enable?
+     */
+    private final boolean m_supportNullable;
     /**
      * List of dependency callback.
      * Immutable once set.
      */
     private DependencyCallback[] m_callbacks;
-
     /**
      * Is the dependency a service level dependency.
      * Immutable once set.
      */
     private boolean m_isServiceLevelRequirement;
-
     /**
      * Is the provider set frozen ?
      */
     private boolean m_isFrozen;
-
     /**
      * Is the dependency started ?
      */
     private boolean m_isStarted;
-
     /**
      * Thread Local.
      */
     private ServiceUsage m_usage;
-
     /**
      * Type of the object to inject.
      * Cannot change once set.
      */
     private int m_type;
-
     /**
      * Nullable object.
      * Immutable once set.
      */
     private Object m_nullable;
-
-    /**
-     * Default-Implementation.
-     */
-    private final String m_di;
-
-    /**
-     * Is the Nullable pattern enable?
-     */
-    private final boolean m_supportNullable;
-
     /**
      * Id of the dependency.
      * Immutable once set.
      */
     private String m_id;
-
     /**
      * Do we have to inject proxy?
      */
     private boolean m_isProxy;
-
     /**
      * Proxy Object.
      */
     private Object m_proxyObject;
-
     /**
-     * Constructor paramter index.
+     * Constructor parameter index.
      * -1 if not used.
      */
     private int m_index = -1;
+    private int m_timeout;
 
     /**
      * Dependency constructor. After the creation the dependency is not started.
      *
-     * @param handler : the dependency handler managing this dependency
-     * @param field : field of the dependency
-     * @param spec : required specification
-     * @param filter : LDAP filter of the dependency
-     * @param isOptional : is the dependency an optional dependency ?
-     * @param isAggregate : is the dependency an aggregate dependency
-     * @param nullable : describe if the nullable ability is enable or disable
-     * @param isProxy : is the proxied dependency
-     * @param identity : id of the dependency, may be null
-     * @param context : bundle context (or service context) to use.
-     * @param policy : resolution policy
-     * @param cmp : comparator to sort references
-     * @param defaultImplem : default-implementation class
-     */
-    public Dependency(DependencyHandler handler, String field, Class spec, Filter filter, boolean isOptional, boolean isAggregate, boolean nullable, boolean isProxy, String identity, BundleContext context, int policy, Comparator cmp, String defaultImplem) {
+     * @param handler               : the dependency handler managing this dependency
+     * @param field                 : field of the dependency
+     * @param spec                  : required specification
+     * @param filter                : LDAP filter of the dependency
+     * @param isOptional            : is the dependency an optional dependency ?
+     * @param isAggregate           : is the dependency an aggregate dependency
+     * @param nullable              : describe if the nullable ability is enable or disable
+     * @param isProxy               : is the proxied dependency
+     * @param identity              : id of the dependency, may be null
+     * @param context               : bundle context (or service context) to use.
+     * @param policy                : resolution policy
+     * @param cmp                   : comparator to sort references
+     * @param defaultImplementation : default-implementation class
+     */
+    public Dependency(DependencyHandler handler, String field, Class spec, Filter filter, boolean isOptional,
+                      boolean isAggregate, boolean nullable, boolean isProxy, String identity, BundleContext context,
+                      int policy, Comparator cmp, String defaultImplementation, String exception) {
         super(spec, isAggregate, isOptional, filter, cmp, policy, context, handler, handler.getInstanceManager());
         m_handler = handler;
         m_field = field;
@@ -164,7 +141,8 @@ public class Dependency extends Dependen
         }
 
         m_supportNullable = nullable;
-        m_di = defaultImplem;
+        m_di = defaultImplementation;
+        m_exception = exception;
 
         if (identity == null) {
             if (spec != null) {
@@ -182,6 +160,7 @@ public class Dependency extends Dependen
      * In order to store the id of the dependency, this
      * method is override. This method is called during the
      * configuration.
+     *
      * @param spec : request service Class
      * @see org.apache.felix.ipojo.util.DependencyModel#setSpecification(java.lang.Class)
      */
@@ -199,11 +178,12 @@ public class Dependency extends Dependen
     /**
      * Add a callback to the dependency.
      * This method is called during the configuration.
+     *
      * @param callback : callback to add
      */
     protected void addDependencyCallback(DependencyCallback callback) {
         if (m_callbacks == null) {
-            m_callbacks = new DependencyCallback[] { callback };
+            m_callbacks = new DependencyCallback[]{callback};
         } else {
             DependencyCallback[] newCallbacks = new DependencyCallback[m_callbacks.length + 1];
             System.arraycopy(m_callbacks, 0, newCallbacks, 0, m_callbacks.length);
@@ -212,7 +192,6 @@ public class Dependency extends Dependen
         }
     }
 
-
     protected void addConstructorInjection(int index) throws ConfigurationException {
         m_index = index;
         m_usage = new ServiceUsage();
@@ -221,6 +200,7 @@ public class Dependency extends Dependen
 
     /**
      * Stop the current dependency.
+     *
      * @see org.apache.felix.ipojo.util.DependencyModel#stop()
      */
     public synchronized void stop() {
@@ -238,6 +218,7 @@ public class Dependency extends Dependen
 
     /**
      * Unfreeze the dependency.
+     *
      * @see org.apache.felix.ipojo.util.DependencyModel#unfreeze()
      */
     public synchronized void unfreeze() {
@@ -246,13 +227,16 @@ public class Dependency extends Dependen
 
     /**
      * Call the bind method.
+     *
      * @param pojo : pojo instance on which calling the bind method.
      */
     protected void onObjectCreation(Object pojo) {
 
         ServiceReference[] refs;
         synchronized (this) {
-            if (!m_isStarted) { return; }
+            if (!m_isStarted) {
+                return;
+            }
 
             // We are notified of an instance creation, we have to freeze when the static policy is used
             if (getBindingPolicy() == STATIC_BINDING_POLICY) {
@@ -260,7 +244,9 @@ public class Dependency extends Dependen
             }
 
             // Check optional case : nullable object case : do not call bind on nullable object
-            if (isOptional() && getSize() == 0) { return; }
+            if (isOptional() && getSize() == 0) {
+                return;
+            }
 
             refs = getServiceReferences(); // Stack confinement.
         }
@@ -303,6 +289,7 @@ public class Dependency extends Dependen
 
     /**
      * Call unbind callback method.
+     *
      * @param ref : reference to send (if accepted) to the method
      */
     private void callUnbindMethod(ServiceReference ref) {
@@ -317,10 +304,11 @@ public class Dependency extends Dependen
 
     /**
      * Helper method calling the given callback.
-     * @param callback : callback to call.
-     * @param ref : service reference.
+     *
+     * @param callback  : callback to call.
+     * @param ref       : service reference.
      * @param svcObject : the service object
-     * @param pojo : pojo on which calling the callback, if null call on each created pojo objects.
+     * @param pojo      : pojo on which calling the callback, if null call on each created pojo objects.
      */
     private void invokeCallback(DependencyCallback callback, ServiceReference ref, Object svcObject, Object pojo) {
         try {
@@ -342,10 +330,11 @@ public class Dependency extends Dependen
 
     }
 
-   /**
-    * Call 'modify' method with the service reference in parameter (if accepted).
-    * @param ref : the service reference of the modified service
-    */
+    /**
+     * Call 'modify' method with the service reference in parameter (if accepted).
+     *
+     * @param ref : the service reference of the modified service
+     */
     private void callModifyMethod(ServiceReference ref) {
         if (m_handler.getInstanceManager().getState() > InstanceManager.STOPPED && m_handler.getInstanceManager().getPojoObjects() != null) {
             for (int i = 0; m_callbacks != null && i < m_callbacks.length; i++) {
@@ -356,9 +345,9 @@ public class Dependency extends Dependen
         }
     }
 
-
     /**
      * Call  method with the service reference in parameter (if accepted).
+     *
      * @param ref : the service reference of the new service
      */
     private void callBindMethod(ServiceReference ref) {
@@ -381,8 +370,32 @@ public class Dependency extends Dependen
         }
     }
 
+    private RuntimeException createExceptionToThrow() {
+        final String message = "No service available for " + DependencyHandler.getDependencyIdentifier(this);
+        if (m_exception == null) {
+            // Should never happen, but let's see.
+            return new RuntimeException(message);
+        }
+        try {
+            Class<RuntimeException> exceptionClass = (Class<RuntimeException>) getBundleContext()
+                    .getBundle().loadClass(m_exception);
+            // Check constructor
+            final Constructor<RuntimeException> constructor = exceptionClass.getConstructor(new Class[]{String.class});
+            if (constructor != null) {
+                return constructor.newInstance(message);
+            } else {
+                return exceptionClass.newInstance();
+            }
+        } catch (Exception e) {
+            m_handler.getLogger().log(Log.ERROR, "Cannot create the exception object for dependency " +
+                    DependencyHandler.getDependencyIdentifier(this) + " : " + e.getMessage(), e);
+        }
+
+        return new RuntimeException(message);
+    }
+
     private Object createNullableObject() {
-         // To load the proxy we use the POJO class loader. Indeed, this classloader imports iPOJO (so can access to Nullable) and has
+        // To load the proxy we use the POJO class loader. Indeed, this classloader imports iPOJO (so can access to Nullable) and has
         // access to the service specification.
         try {
             ClassLoader cl = new NullableClassLoader(
@@ -390,8 +403,8 @@ public class Dependency extends Dependen
                     getSpecification().getClassLoader());
 
             m_nullable =
-                Proxy.newProxyInstance(cl, new Class[] {
-                        getSpecification(), Nullable.class }, new NullableObject()); // NOPMD
+                    Proxy.newProxyInstance(cl, new Class[]{
+                            getSpecification(), Nullable.class}, new NullableObject()); // NOPMD
 
         } catch (NoClassDefFoundError e) {
             // A NoClassDefFoundError is thrown if the specification uses a class not accessible by the actual instance.
@@ -410,12 +423,12 @@ public class Dependency extends Dependen
     public void start() {
 
         if (isOptional() && !isAggregate()) {
-            if (m_di == null) {
+            if (m_di == null && m_exception == null) {
                 // If nullable are supported, create the nullable object.
                 if (m_supportNullable) {
                     createNullableObject();
                 }
-            } else {
+            } else if (m_di != null) {
                 // Create the default-implementation object.
                 try {
                     Class clazz = getHandler().getInstanceManager().getContext().getBundle().loadClass(m_di);
@@ -494,9 +507,9 @@ public class Dependency extends Dependen
         return m_isServiceLevelRequirement;
     }
 
-
     /**
      * A new service has to be injected.
+     *
      * @param reference : the new matching service reference.
      * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference)
      */
@@ -507,6 +520,7 @@ public class Dependency extends Dependen
 
     /**
      * An already injected service is modified.
+     *
      * @param reference : the modified service reference.
      * @see org.apache.felix.ipojo.util.DependencyModel#onServiceModification(org.osgi.framework.ServiceReference)
      */
@@ -516,6 +530,7 @@ public class Dependency extends Dependen
 
     /**
      * A used (already injected) service disappears.
+     *
      * @param ref : leaving service reference.
      * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)
      */
@@ -527,7 +542,8 @@ public class Dependency extends Dependen
      * The dependency has been reconfigured.
      * Call unbind method and then bind methods. If the dependency cache is not reset,
      * the thread continues to get older services.
-     * @param departs : no more matching services.
+     *
+     * @param departs  : no more matching services.
      * @param arrivals : new services
      * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[])
      */
@@ -555,6 +571,7 @@ public class Dependency extends Dependen
 
     /**
      * Get the used service references list.
+     *
      * @return the used service reference or null if no service reference are available.
      */
     public List<ServiceReference> getServiceReferencesAsList() {
@@ -569,12 +586,13 @@ public class Dependency extends Dependen
     /**
      * Called by the proxy to get  service objects to delegate a method.
      * On aggregate dependencies, it returns a list.
+     *
      * @return a service object or a nullable/default-implementation object.
-     * For aggregate dependencies it returns a list or an empty list.
+     *         For aggregate dependencies it returns a list or an empty list.
      */
     public Object getService() {
         // Check that we're in proxy mode.
-        if (! m_isProxy) {
+        if (!m_isProxy) {
             throw new IllegalStateException("The dependency is not a proxied dependency");
         }
 
@@ -587,7 +605,7 @@ public class Dependency extends Dependen
                 usage.inc(); // Start the caching, so set the stack level to 1
                 m_usage.set(usage);
                 if (isAggregate()) {
-                    Object obj =  usage.m_object;
+                    Object obj = usage.m_object;
                     if (obj instanceof Set) {
                         List list = new ArrayList();
                         list.addAll((Set) obj);
@@ -628,7 +646,7 @@ public class Dependency extends Dependen
             // Use the copy.
             // if the copy is a set, transform to a list
             if (isAggregate()) {
-                Object obj =  usage.m_object;
+                Object obj = usage.m_object;
                 if (obj instanceof Set) {
                     List list = new ArrayList();
                     list.addAll((Set) obj);
@@ -647,9 +665,10 @@ public class Dependency extends Dependen
     /**
      * This method is called by the replaced code in the component
      * implementation class. Construct the service object list is necessary.
-     * @param pojo : POJO object.
+     *
+     * @param pojo      : POJO object.
      * @param fieldName : field
-     * @param value : last value.
+     * @param value     : last value.
      * @return the service object or a nullable / default implementation if defined.
      * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
      */
@@ -662,7 +681,7 @@ public class Dependency extends Dependen
             usage.inc(); // Start the caching, so set the stack level to 1
             m_usage.set(usage);
         }
-        if (! m_isProxy) {
+        if (!m_isProxy) {
             return usage.m_object;
         } else {
             return m_proxyObject;
@@ -670,21 +689,34 @@ public class Dependency extends Dependen
 
     }
 
-
     /**
      * Creates the object to store in the given Thread Local.
      * This object will be injected inside the POJO field.
+     *
      * @param usage : Thread Local to populate.
      */
     private void createServiceObject(Usage usage) {
         ServiceReference[] refs = getServiceReferences();
-        if (! isAggregate()) {
+
+        // manage timeout
+        if (refs == null) {
+            waitForServiceUntilTimeout();
+        }
+
+        refs = getServiceReferences();
+
+        if (!isAggregate()) {
             if (refs == null) {
+                if (m_exception != null) {
+                    // Throw the exception.
+                    throw createExceptionToThrow();
+                }
+
                 if (m_nullable == null && m_supportNullable) {
                     m_handler.warn("[" + m_handler.getInstanceManager().getInstanceName() + "] The dependency is not optional, however no service object can be injected in " + m_field + " -> " + getSpecification().getName());
                     createNullableObject();
                 }
-                usage.m_object = m_nullable; // Add null if the Nullable pattern is disable.
+                usage.m_object = m_nullable; // Add null if the Nullable pattern is disabled.
             } else {
                 ServiceReference ref = getServiceReference();
                 usage.m_object = getService(ref);
@@ -711,7 +743,7 @@ public class Dependency extends Dependen
                 if (refs == null) {
                     usage.m_object = new ArrayList(0); // Create an empty list.
                 } else {
-                   // Use a list to store service objects
+                    // Use a list to store service objects
                     List objs = new ArrayList(refs.length);
                     for (int i = 0; refs != null && i < refs.length; i++) {
                         ServiceReference ref = refs[i];
@@ -723,7 +755,7 @@ public class Dependency extends Dependen
                 if (refs == null) {
                     usage.m_object = new Vector(0); // Create an empty vector.
                 } else {
-                   // Use a vector to store service objects
+                    // Use a vector to store service objects
                     Vector objs = new Vector(refs.length);
                     for (int i = 0; refs != null && i < refs.length; i++) {
                         ServiceReference ref = refs[i];
@@ -735,7 +767,7 @@ public class Dependency extends Dependen
                 if (refs == null) {
                     usage.m_object = new HashSet(0); // Create an empty vector.
                 } else {
-                   // Use a vector to store service objects
+                    // Use a vector to store service objects
                     Set objs = new HashSet(refs.length);
                     for (int i = 0; refs != null && i < refs.length; i++) {
                         ServiceReference ref = refs[i];
@@ -748,11 +780,34 @@ public class Dependency extends Dependen
     }
 
     /**
+     * Waits a service providers. The wait stops when the timeout is reached.
+     */
+    private void waitForServiceUntilTimeout() {
+        // Begin to wait ...
+        long enter = System.currentTimeMillis();
+        boolean exhausted = false;
+        synchronized (this) {
+            while (getServiceReference() == null && !exhausted) {
+                try {
+                    wait(1);
+                } catch (InterruptedException e) {
+                    // We was interrupted ....
+                } finally {
+                    long end = System.currentTimeMillis();
+                    exhausted = (end - enter) > m_timeout;
+                }
+            }
+        }
+        // When this method exit, the check will be done...
+    }
+
+    /**
      * The field was set.
      * This method should not be call if the POJO is written correctly.
-     * @param pojo : POJO object
+     *
+     * @param pojo      : POJO object
      * @param fieldName : field name
-     * @param value : set value.
+     * @param value     : set value.
      * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object, java.lang.String, java.lang.Object)
      */
     public void onSet(Object pojo, String fieldName, Object value) {
@@ -761,9 +816,10 @@ public class Dependency extends Dependen
 
     /**
      * A POJO method will be invoked.
-     * @param pojo : Pojo object
+     *
+     * @param pojo   : Pojo object
      * @param method : called method
-     * @param args : arguments
+     * @param args   : arguments
      * @see org.apache.felix.ipojo.MethodInterceptor#onEntry(java.lang.Object, java.lang.reflect.Member, java.lang.Object[])
      */
     public void onEntry(Object pojo, Member method, Object[] args) {
@@ -780,8 +836,9 @@ public class Dependency extends Dependen
     /**
      * A POJO method has thrown an error.
      * This method does nothing and wait for the finally.
-     * @param pojo : POJO object.
-     * @param method : Method object.
+     *
+     * @param pojo      : POJO object.
+     * @param method    : Method object.
      * @param throwable : thrown error
      * @see org.apache.felix.ipojo.MethodInterceptor#onError(java.lang.Object, java.lang.reflect.Member, java.lang.Throwable)
      */
@@ -791,8 +848,9 @@ public class Dependency extends Dependen
 
     /**
      * A POJO method has returned.
-     * @param pojo : POJO object.
-     * @param method : Method object.
+     *
+     * @param pojo        : POJO object.
+     * @param method      : Method object.
      * @param returnedObj : returned object (null for void method)
      * @see org.apache.felix.ipojo.MethodInterceptor#onExit(java.lang.Object, java.lang.reflect.Member, java.lang.Object)
      */
@@ -802,7 +860,8 @@ public class Dependency extends Dependen
 
     /**
      * A POJO method is finished.
-     * @param pojo : POJO object.
+     *
+     * @param pojo   : POJO object.
      * @param method : Method object.
      * @see org.apache.felix.ipojo.MethodInterceptor#onFinally(java.lang.Object, java.lang.reflect.Member)
      */
@@ -822,6 +881,7 @@ public class Dependency extends Dependen
 
     /**
      * Gets true if the dependency use Nullable objects.
+     *
      * @return true if the dependency is optional and supports nullable objects.
      */
     public boolean supportsNullable() {
@@ -843,6 +903,7 @@ public class Dependency extends Dependen
     /**
      * Set the type to inject.
      * This method set the dependency as aggregate.
+     *
      * @param type either list of vector
      */
     protected void setType(int type) {
@@ -851,22 +912,84 @@ public class Dependency extends Dependen
     }
 
     /**
+     * Sets the dependency timeout.
+     *
+     * @param timeout the timeout in ms.
+     */
+    public void setTimeout(int timeout) {
+        m_timeout = timeout;
+    }
+
+    /**
+     * Gets the constructor parameter.
+     *
+     * @return the index of the constructor parameter,
+     *         or <code>-1</code> if not set.
+     */
+    public int getConstructorParameterIndex() {
+        return m_index;
+    }
+
+    /**
+     * Gets the object to inject in the constructor parameter.
+     *
+     * @param index the index of the parameter
+     * @return the created proxy object
+     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameter(int)
+     */
+    public Object getConstructorParameter(int index) {
+        if (m_index == index && m_proxyObject != null) {
+            return m_proxyObject;
+        }
+        return null;
+    }
+
+    /**
+     * Gets the type of the constructor parameter.
+     *
+     * @param index the parameter index
+     * @return the class of the object. For scalar dependency, it's the
+     *         specification, for aggregate it depends of the container object:
+     *         {@link List} or {@link Set}.
+     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameterType(int)
+     */
+    public Class getConstructorParameterType(int index) {
+        if (m_index == index && m_proxyObject != null) {
+            if (isAggregate()) {
+                switch (m_type) {
+                    case DependencyHandler.LIST:
+                        return List.class;
+                    case DependencyHandler.SET:
+                        return Set.class;
+                    //TODO We should also manage the Collection type.
+                    default:
+                        return null; // Should never happen, it was checked before.
+                }
+            } else {
+                return getSpecification();
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
      * Classloader for nullable objects.
      */
     private static class NullableClassLoader extends ClassLoader {
-       /**
-        * Component classloader.
-        */
+        /**
+         * Component classloader.
+         */
         private ClassLoader m_component;
-
-       /**
-        * Specification classloader.
-        */
+        /**
+         * Specification classloader.
+         */
         private ClassLoader m_specification;
 
         /**
          * Creates a NullableClassLoader.
-         * @param cmp the component class loader.
+         *
+         * @param cmp  the component class loader.
          * @param spec the specification class loader.
          */
         public NullableClassLoader(ClassLoader cmp, ClassLoader spec) {
@@ -878,6 +1001,7 @@ public class Dependency extends Dependen
          * Loads the given class.
          * This method uses the classloader of the component class
          * and (if not found) the specification classloader.
+         *
          * @param name the class name
          * @return the class object
          * @throws ClassNotFoundException if the class is not found by the two classloaders.
@@ -906,6 +1030,7 @@ public class Dependency extends Dependen
 
         /**
          * Creates the proxy classloader.
+         *
          * @param parent the handler classloader.
          */
         public SmartProxyFactory(ClassLoader parent) {
@@ -915,6 +1040,7 @@ public class Dependency extends Dependen
 
         /**
          * Loads a proxy class generated for the given (interface) class.
+         *
          * @param clazz the service specification to proxy
          * @return the Class object of the proxy.
          */
@@ -931,8 +1057,9 @@ public class Dependency extends Dependen
         /**
          * Create a proxy object for the given specification. The proxy
          * uses the given dependency to get the service object.
+         *
          * @param spec the service specification (interface)
-         * @param dep the dependency used to get the service
+         * @param dep  the dependency used to get the service
          * @return the proxy object.
          */
         public Object getProxy(Class spec, Dependency dep) {
@@ -940,7 +1067,7 @@ public class Dependency extends Dependen
                 Class clazz = getProxyClass(getSpecification());
                 Constructor constructor = clazz.getConstructor(
                         new Class[]{clazz.getClassLoader().loadClass(Dependency.class.getName())});
-                return constructor.newInstance(new Object[] {dep});
+                return constructor.newInstance(new Object[]{dep});
             } catch (Throwable e) {
                 m_handler.error("Cannot create the proxy object", e);
                 m_handler.getInstanceManager().stop();
@@ -952,6 +1079,7 @@ public class Dependency extends Dependen
          * Loads the given class.
          * This method uses the classloader of the specification class
          * or the handler class loader.
+         *
          * @param name the class name
          * @return the class object
          * @throws ClassNotFoundException if the class is not found by the two classloaders.
@@ -975,12 +1103,10 @@ public class Dependency extends Dependen
          * HashCode method.
          */
         private Method m_hashCodeMethod;
-
         /**
          * Equals method.
          */
         private Method m_equalsMethod;
-
         /**
          * toStirng method.
          */
@@ -993,7 +1119,7 @@ public class Dependency extends Dependen
             try {
                 m_hashCodeMethod = Object.class.getMethod("hashCode", null);
                 m_equalsMethod = Object.class
-                    .getMethod("equals", new Class[] { Object.class });
+                        .getMethod("equals", new Class[]{Object.class});
                 m_toStringMethod = Object.class.getMethod("toString", null);
             } catch (NoSuchMethodException e) {
                 throw new NoSuchMethodError(e.getMessage());
@@ -1003,22 +1129,24 @@ public class Dependency extends Dependen
         /**
          * Creates a proxy object for the given specification. The proxy
          * uses the given dependency to get the service object.
+         *
          * @param spec the service specification (interface)
          * @return the proxy object.
          */
         public Object getProxy(Class spec) {
             return java.lang.reflect.Proxy.newProxyInstance(
                     getHandler().getInstanceManager().getClazz().getClassLoader(),
-                    new Class[] {spec},
+                    new Class[]{spec},
                     this);
         }
 
         /**
          * Invocation Handler delegating invocation on the
          * service object.
-         * @param proxy the proxy object
+         *
+         * @param proxy  the proxy object
          * @param method the method
-         * @param args the arguments
+         * @param args   the arguments
          * @return a proxy object.
          * @throws Exception if the invocation throws an exception
          * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
@@ -1044,51 +1172,4 @@ public class Dependency extends Dependen
 
     }
 
-    /**
-     * Gets the constructor parameter.
-     * @return the index of the constructor parameter,
-     * or <code>-1</code> if not set.
-     */
-    public int getConstructorParameterIndex() {
-        return m_index;
-    }
-
-    /**
-     * Gets the object to inject in the constructor parameter.
-     * @param index the index of the parameter
-     * @return the created proxy object
-     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameter(int)
-     */
-    public Object getConstructorParameter(int index) {
-        if (m_index == index  && m_proxyObject != null) {
-            return m_proxyObject;
-        }
-        return null;
-    }
-
-    /**
-     * Gets the type of the constructor parameter.
-     * @param index the parameter index
-     * @return the class of the object. For scalar dependency, it's the
-     * specification, for aggregate it depends of the container object:
-     * {@link List} or {@link Set}.
-     * @see org.apache.felix.ipojo.ConstructorInjector#getConstructorParameterType(int)
-     */
-    public Class getConstructorParameterType(int index) {
-        if (m_index == index  && m_proxyObject != null) {
-            if (isAggregate()) {
-                switch (m_type) {
-                case DependencyHandler.LIST: return List.class;
-                case DependencyHandler.SET : return Set.class;
-                //TODO We should also manage the Collection type.
-                default: return null; // Should never happen, it was checked before.
-                }
-            } else {
-                return getSpecification();
-            }
-        } else {
-            return null;
-        }
-    }
-
 }

Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?rev=1526626&r1=1526625&r2=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java (original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java Thu Sep 26 17:51:18 2013
@@ -453,6 +453,12 @@ public class DependencyHandler extends P
             String opt = dependencyElement.getAttribute("optional");
             boolean optional = opt != null && opt.equalsIgnoreCase("true");
             String defaultImpl = dependencyElement.getAttribute("default-implementation");
+            String exception = dependencyElement.getAttribute("exception");
+            String to = dependencyElement.getAttribute("timeout");
+            int timeout = 0;
+            if (to != null) {
+                timeout = Integer.parseInt(to);
+            }
 
             String agg = dependencyElement.getAttribute("aggregate");
             boolean aggregate = agg != null && agg.equalsIgnoreCase("true");
@@ -477,7 +483,9 @@ public class DependencyHandler extends P
             int policy = DependencyMetadataHelper.getPolicy(dependencyElement);
             Comparator cmp = DependencyMetadataHelper.getComparator(dependencyElement, getInstanceManager().getGlobalContext());
 
-            Dependency dep = new Dependency(this, field, spec, fil, optional, aggregate, nullable, isProxy, identity, context, policy, cmp, defaultImpl);
+            Dependency dep = new Dependency(this, field, spec, fil, optional, aggregate, nullable, isProxy, identity,
+                    context, policy, cmp, defaultImpl, exception);
+            dep.setTimeout(timeout);
 
             // Look for dependency callback :
             addCallbacksToDependency(dependencyElement, dep);

Modified: felix/trunk/ipojo/runtime/core/src/main/resources/core.xsd
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/resources/core.xsd?rev=1526626&r1=1526625&r2=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/resources/core.xsd (original)
+++ felix/trunk/ipojo/runtime/core/src/main/resources/core.xsd Thu Sep 26 17:51:18 2013
@@ -299,6 +299,26 @@
                     </xs:annotation>
                 </xs:attribute>
 
+                <xs:attribute name="exception" type="xs:string" use="optional">
+                    <xs:annotation>
+                        <xs:documentation>Specifies the exception to throw for an optional service
+                            dependency. If no providers are found, iPOJO creates an instance of the
+                            exception (with either no parameter or a String parameter as constructor argument), and
+                            throws it. The given class name must extends RuntimeException.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+
+                <xs:attribute name="timeout" type="xs:int" use="optional">
+                    <xs:annotation>
+                        <xs:documentation>Specifies the timeout after which the 'no service policy' is executed
+                            (nullable, null, empty collection, exception...). The value is the time in millisecond to
+                            wait. -1 is used to indicate an infinite wait, 0 executes the no service policy
+                            immediately.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+
                 <xs:attribute name="from" type="xs:string" use="optional">
                     <xs:annotation>
                         <xs:documentation>Specific service provider. The dependency can only be fulfilled by the

Modified: felix/trunk/ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/SmartProxyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/SmartProxyTest.java?rev=1526626&r1=1526625&r2=1526626&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/SmartProxyTest.java (original)
+++ felix/trunk/ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/SmartProxyTest.java Thu Sep 26 17:51:18 2013
@@ -63,7 +63,7 @@ public class SmartProxyTest extends Test
         Mockito.when(handler.getLogger()).thenReturn(logger);
 
         Dependency dependency = new Dependency(handler, "a_field", ArrayList.class, null, false, false, false,
-                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null);
+                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null, null);
         dependency.start();
 
         // No service
@@ -73,7 +73,7 @@ public class SmartProxyTest extends Test
 
         // Try with an Object.
         dependency = new Dependency(handler, "a_field", Object.class, null, false, false, false,
-                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null);
+                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null, null);
         dependency.start();
         // OK
         Assert.assertNull(dependency.onGet(new Object(), "a_field", null));
@@ -111,7 +111,7 @@ public class SmartProxyTest extends Test
 
         // Try with java.List
         Dependency dependency = new Dependency(handler, "a_field", List.class, null, false, false, false,
-                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null);
+                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null, null);
         dependency.start();
 
         // OK
@@ -122,7 +122,7 @@ public class SmartProxyTest extends Test
 
         // Try with javax.sql.CommonDataSource
         dependency = new Dependency(handler, "a_field", javax.sql.DataSource.class, null, false, false, false,
-                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null);
+                true, "dep", context, Dependency.DYNAMIC_BINDING_POLICY, null, null, null);
         dependency.start();
         // OK
         Assert.assertNotNull(dependency.onGet(new Object(), "a_field", null));



Mime
View raw message