Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#PAXCDI-197 #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion itest/src/it/itest-standalone/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.ops4j.pax.cdi</groupId>
Expand Down Expand Up @@ -144,6 +144,20 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.ops4j.pax.cdi.samples</groupId>
<artifactId>pax-cdi-sample10</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.ops4j.pax.cdi.samples</groupId>
<artifactId>pax-cdi-sample10-client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-extension</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* To change this license header, choose License Headers in Project Properties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not code to merge. The test case fails obviously because of the issue. It's just a test case reproducing the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this by intention that this test doesn't do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue happens even when the method is empty. The test can be enhanced later.

// assertNotNull(logger);
// assertEquals(InterBundleProducesTest.class.getName(), logger.getName());
}

}
64 changes: 64 additions & 0 deletions pax-cdi-samples/pax-cdi-sample10-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-samples</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>org.ops4j.pax.cdi.samples</groupId>
<artifactId>pax-cdi-sample10-client</artifactId>
<packaging>bundle</packaging>

<name>OPS4J Pax CDI Sample10 Client</name>

<dependencies>

<dependency>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>org.ops4j.pax.cdi.sample10.client</Bundle-SymbolicName>
<Require-Capability>
org.ops4j.pax.cdi.extension;
filter:="(&amp;(extension=pax-cdi-extension)(version&gt;=${version;==;${pax.cdi.osgi.version.clean}})(!(version&gt;=${version;=+;${pax.cdi.osgi.version.clean}})))",
osgi.extender; filter:="(osgi.extender=pax.cdi)"
</Require-Capability>
</instructions>
</configuration>
<executions>
<execution>
<id>versions</id>
<phase>validate</phase>
<goals>
<goal>cleanVersions</goal>
</goals>
<configuration>
<versions>
<pax.cdi.osgi.version.clean>${project.version}</pax.cdi.osgi.version.clean>
</versions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but wrong license, OPS4j projects are Apache License 2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know how this ended up here, but again: This not code to merge. The test case fails obviously because of the issue. It's just a test case reproducing the issue.

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());
}
}
64 changes: 64 additions & 0 deletions pax-cdi-samples/pax-cdi-sample10/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-samples</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>org.ops4j.pax.cdi.samples</groupId>
<artifactId>pax-cdi-sample10</artifactId>
<packaging>bundle</packaging>

<name>OPS4J Pax CDI Sample10</name>

<dependencies>

<dependency>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>org.ops4j.pax.cdi.sample10</Bundle-SymbolicName>
<Require-Capability>
org.ops4j.pax.cdi.extension;
filter:="(&amp;(extension=pax-cdi-extension)(version&gt;=${version;==;${pax.cdi.osgi.version.clean}})(!(version&gt;=${version;=+;${pax.cdi.osgi.version.clean}})))",
osgi.extender; filter:="(osgi.extender=pax.cdi)"
</Require-Capability>
</instructions>
</configuration>
<executions>
<execution>
<id>versions</id>
<phase>validate</phase>
<goals>
<goal>cleanVersions</goal>
</goals>
<configuration>
<versions>
<pax.cdi.osgi.version.clean>${project.version}</pax.cdi.osgi.version.clean>
</versions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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): .
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again wrong license header, would need to be corrected

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());
}
}
2 changes: 2 additions & 0 deletions pax-cdi-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<module>pax-cdi-sample7-service-impl102</module>
<module>pax-cdi-sample7-client-dynamic</module>
<module>pax-cdi-sample8</module>
<module>pax-cdi-sample10</module>
<module>pax-cdi-sample10-client</module>
</modules>

</project>