diff --git a/itest/src/it/itest-standalone/pom.xml b/itest/src/it/itest-standalone/pom.xml index a1b71c20..67784b9c 100644 --- a/itest/src/it/itest-standalone/pom.xml +++ b/itest/src/it/itest-standalone/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.ops4j.pax.cdi @@ -144,6 +144,20 @@ provided + + org.ops4j.pax.cdi.samples + pax-cdi-sample10 + ${project.version} + provided + + + + org.ops4j.pax.cdi.samples + pax-cdi-sample10-client + ${project.version} + provided + + org.ops4j.pax.cdi pax-cdi-extension diff --git a/itest/src/it/itest-standalone/src/test/java/org/ops4j/pax/cdi/test/InterBundleProducesTest.java b/itest/src/it/itest-standalone/src/test/java/org/ops4j/pax/cdi/test/InterBundleProducesTest.java new file mode 100644 index 00000000..c34a06a8 --- /dev/null +++ b/itest/src/it/itest-standalone/src/test/java/org/ops4j/pax/cdi/test/InterBundleProducesTest.java @@ -0,0 +1,44 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.ops4j.pax.cdi.test; + +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.ops4j.pax.cdi.test.support.TestConfiguration.cdiProviderBundles; +import static org.ops4j.pax.cdi.test.support.TestConfiguration.paxCdiProviderAdapter; +import static org.ops4j.pax.cdi.test.support.TestConfiguration.regressionDefaults; +import static org.ops4j.pax.cdi.test.support.TestConfiguration.workspaceBundle; +import org.ops4j.pax.exam.Configuration; +import static org.ops4j.pax.exam.CoreOptions.options; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class InterBundleProducesTest { + +// @Inject +// @OsgiService +// private Logger logger; + @Configuration + public Option[] config() { + return options( + regressionDefaults(), + workspaceBundle("org.ops4j.pax.cdi.samples", "pax-cdi-sample10"), + workspaceBundle("org.ops4j.pax.cdi.samples", "pax-cdi-sample10-client"), + paxCdiProviderAdapter(), + cdiProviderBundles()); + } + + @Test + public void testParameterizedTypeSupported() { +// assertNotNull(logger); +// assertEquals(InterBundleProducesTest.class.getName(), logger.getName()); + } + +} diff --git a/pax-cdi-samples/pax-cdi-sample10-client/pom.xml b/pax-cdi-samples/pax-cdi-sample10-client/pom.xml new file mode 100644 index 00000000..4ceb2305 --- /dev/null +++ b/pax-cdi-samples/pax-cdi-sample10-client/pom.xml @@ -0,0 +1,64 @@ + + 4.0.0 + + org.ops4j.pax.cdi + pax-cdi-samples + 1.0.0-SNAPSHOT + + org.ops4j.pax.cdi.samples + pax-cdi-sample10-client + bundle + + OPS4J Pax CDI Sample10 Client + + + + + org.ops4j.pax.cdi + pax-cdi-api + ${project.version} + + + org.slf4j + slf4j-api + + + javax.enterprise + cdi-api + + + + + + + org.apache.felix + maven-bundle-plugin + + + org.ops4j.pax.cdi.sample10.client + + org.ops4j.pax.cdi.extension; + filter:="(&(extension=pax-cdi-extension)(version>=${version;==;${pax.cdi.osgi.version.clean}})(!(version>=${version;=+;${pax.cdi.osgi.version.clean}})))", + osgi.extender; filter:="(osgi.extender=pax.cdi)" + + + + + + versions + validate + + cleanVersions + + + + ${project.version} + + + + + + + + \ No newline at end of file diff --git a/pax-cdi-samples/pax-cdi-sample10-client/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerConsumer.java b/pax-cdi-samples/pax-cdi-sample10-client/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerConsumer.java new file mode 100644 index 00000000..d8ed0360 --- /dev/null +++ b/pax-cdi-samples/pax-cdi-sample10-client/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerConsumer.java @@ -0,0 +1,31 @@ +/* + * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Notice + * + * The contents of this file are subject to the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.opensource.org/licenses/cddl1.txt + * + * The Original Code is Drombler.org. The Initial Developer of the + * Original Code is Florian Brunner (Sourceforge.net user: puce). + * Copyright 2014 Drombler.org. All Rights Reserved. + * + * Contributor(s): . + */ +package org.ops4j.pax.cdi.sample10.impl; + +import javax.inject.Inject; +import org.ops4j.pax.cdi.api.OsgiService; +import org.slf4j.Logger; + + +public class LoggerConsumer { + + @Inject + @OsgiService + private Logger logger; + + public void setUp() { + logger.info(logger.getName()); + } +} diff --git a/pax-cdi-samples/pax-cdi-sample10/pom.xml b/pax-cdi-samples/pax-cdi-sample10/pom.xml new file mode 100644 index 00000000..2b8e9ca2 --- /dev/null +++ b/pax-cdi-samples/pax-cdi-sample10/pom.xml @@ -0,0 +1,64 @@ + + 4.0.0 + + org.ops4j.pax.cdi + pax-cdi-samples + 1.0.0-SNAPSHOT + + org.ops4j.pax.cdi.samples + pax-cdi-sample10 + bundle + + OPS4J Pax CDI Sample10 + + + + + org.ops4j.pax.cdi + pax-cdi-api + ${project.version} + + + org.slf4j + slf4j-api + + + javax.enterprise + cdi-api + + + + + + + org.apache.felix + maven-bundle-plugin + + + org.ops4j.pax.cdi.sample10 + + org.ops4j.pax.cdi.extension; + filter:="(&(extension=pax-cdi-extension)(version>=${version;==;${pax.cdi.osgi.version.clean}})(!(version>=${version;=+;${pax.cdi.osgi.version.clean}})))", + osgi.extender; filter:="(osgi.extender=pax.cdi)" + + + + + + versions + validate + + cleanVersions + + + + ${project.version} + + + + + + + + \ No newline at end of file diff --git a/pax-cdi-samples/pax-cdi-sample10/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerProducer.java b/pax-cdi-samples/pax-cdi-sample10/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerProducer.java new file mode 100644 index 00000000..050d73ac --- /dev/null +++ b/pax-cdi-samples/pax-cdi-sample10/src/main/java/org/ops4j/pax/cdi/sample10/impl/LoggerProducer.java @@ -0,0 +1,33 @@ +/* + * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Notice + * + * The contents of this file are subject to the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.opensource.org/licenses/cddl1.txt + * + * The Original Code is Drombler.org. The Initial Developer of the + * Original Code is Florian Brunner (Sourceforge.net user: puce). + * Copyright 2014 Drombler.org. All Rights Reserved. + * + * Contributor(s): . + */ +package org.ops4j.pax.cdi.sample10.impl; + +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.spi.InjectionPoint; +import org.ops4j.pax.cdi.api.OsgiServiceProvider; +import org.ops4j.pax.cdi.api.PrototypeScoped; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class LoggerProducer { + + @Produces + @OsgiServiceProvider + @PrototypeScoped + public Logger getLogger(InjectionPoint injectionPoint) { + return LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass()); + } +} diff --git a/pax-cdi-samples/pom.xml b/pax-cdi-samples/pom.xml index b71f2615..103af7f0 100644 --- a/pax-cdi-samples/pom.xml +++ b/pax-cdi-samples/pom.xml @@ -30,6 +30,8 @@ pax-cdi-sample7-service-impl102 pax-cdi-sample7-client-dynamic pax-cdi-sample8 + pax-cdi-sample10 + pax-cdi-sample10-client \ No newline at end of file