You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by jo...@apache.org on 2014/11/28 22:38:51 UTC
incubator-tamaya git commit: TAMAYA-5 Changed build to use CDI Test
runner and run against both OWB and Weld.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master f3b0475a2 -> 78083c753
TAMAYA-5 Changed build to use CDI Test runner and run against both OWB and Weld.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/78083c75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/78083c75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/78083c75
Branch: refs/heads/master
Commit: 78083c753edea1c093e4ce1ad3e8527d3e71a374
Parents: f3b0475
Author: John D. Ament <jo...@apache.org>
Authored: Fri Nov 28 16:38:49 2014 -0500
Committer: John D. Ament <jo...@apache.org>
Committed: Fri Nov 28 16:38:49 2014 -0500
----------------------------------------------------------------------
modules/cdi/pom.xml | 117 ++++++++++++++++---
.../apache/tamaya/ext/cdi/ConfiguredClass.java | 8 ++
.../apache/tamaya/ext/cdi/ConfiguredTest.java | 20 +++-
3 files changed, 124 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78083c75/modules/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cdi/pom.xml b/modules/cdi/pom.xml
index 785b705..c692e8c 100644
--- a/modules/cdi/pom.xml
+++ b/modules/cdi/pom.xml
@@ -35,6 +35,13 @@ under the License.
<junit.version>4.8.2</junit.version>
<maven.compile.targetLevel>${jdkVersion}</maven.compile.targetLevel>
<maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel>
+ <owb.version>1.5.0-SNAPSHOT</owb.version>
+ <weld.version>2.2.7.Final</weld.version>
+ <geronimo-jcdi-1.1-spec.version>1.0-SNAPSHOT</geronimo-jcdi-1.1-spec.version>
+ <geronimo-interceptor-1.2-spec.version>1.0-SNAPSHOT</geronimo-interceptor-1.2-spec.version>
+ <geronimo-atinject-1.0-spec.version>1.0</geronimo-atinject-1.0-spec.version>
+ <bval.version>0.5</bval.version>
+ <ds.version>1.1.0</ds.version>
</properties>
<build>
@@ -80,15 +87,6 @@ under the License.
</plugin>
</plugins>
</build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se</artifactId>
- <version>2.2.4.Final</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -96,16 +94,105 @@ under the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.weld.se</groupId>
- <artifactId>weld-se</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tamaya-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.1_spec</artifactId>
+ <version>${geronimo-jcdi-1.1-spec.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-test-control-module-api</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-test-control-module-impl</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>OWB</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- OWB specific dependencies-->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${geronimo-atinject-1.0-spec.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.2_spec</artifactId>
+ <version>${geronimo-interceptor-1.2-spec.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.2_spec</artifactId>
+ <version>1.0.MR2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-el_2.2_spec</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.bval</groupId>
+ <artifactId>bval-jsr303</artifactId>
+ <version>${bval.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-owb</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>Weld</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld.se</groupId>
+ <artifactId>weld-se</artifactId>
+ <version>${weld.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-weld</artifactId>
+ <version>${ds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78083c75/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredClass.java
----------------------------------------------------------------------
diff --git a/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredClass.java b/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredClass.java
index 13cb9bb..ef737ef 100644
--- a/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredClass.java
+++ b/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredClass.java
@@ -54,6 +54,10 @@ public class ConfiguredClass{
@ConfiguredProperty("BD")
private BigDecimal bigNumber;
+ @WithConfig("test")
+ @ConfiguredProperty("double1")
+ private double doubleValue;
+
@ConfigChanged
public void changeListener1(PropertyChangeEvent configChange){
// will be called
@@ -95,6 +99,10 @@ public class ConfiguredClass{
return bigNumber;
}
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
public String toString(){
return super.toString() + ": testProperty="+testProperty+", value1="+value1+", value2="+value2
+", int1="+int1+", int2="+int2+", booleanT="+booleanT+", bigNumber="+bigNumber
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/78083c75/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredTest.java
----------------------------------------------------------------------
diff --git a/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredTest.java b/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredTest.java
index fbabb3a..571ae8c 100644
--- a/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredTest.java
+++ b/modules/cdi/src/test/java/org/apache/tamaya/ext/cdi/ConfiguredTest.java
@@ -15,24 +15,32 @@
*/
package org.apache.tamaya.ext.cdi;
-import org.jboss.weld.environment.se.Weld;
-import org.jboss.weld.environment.se.WeldContainer;
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.junit.Assert;
import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.enterprise.inject.spi.CDI;
+import java.util.OptionalDouble;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
/**
* Created by Anatole on 08.09.2014.
*/
+@RunWith(CdiTestRunner.class)
public class ConfiguredTest{
@Test
public void testInjection(){
- Weld weld = new Weld();
- WeldContainer container = weld.initialize();
- ConfiguredClass item = container.instance().select(ConfiguredClass.class).get();
+ ConfiguredClass item = CDI.current().select(ConfiguredClass.class).get();
System.out.println("********************************************");
System.out.println(item);
System.out.println("********************************************");
- weld.shutdown();
+
+ double actual = 1234.5678;
+ assertThat(item.getDoubleValue(),is(actual));
}
}