- change CDI to EJB - change arquillian container from Weld to Glassfish embedded - MS JEE-Testapp-03
Hafid Haddouti

Hafid Haddouti commited on 2014-04-26 22:16:27
Zeige 4 geänderte Dateien mit 24 Einfügungen und 20 Löschungen.


Change-Id: I8918c157648067f269f5a00bb290448180155e87
... ...
@@ -68,7 +70,7 @@
68 70
 
69 71
 
70 72
 	<dependencies>
71
-		<!-- JEE Spec -->
73
+		<!-- JEE Spec 
72 74
 		<dependency>
73 75
 			<groupId>org.jboss.spec</groupId>
74 76
 			<artifactId>jboss-javaee-6.0</artifactId>
... ...
@@ -76,6 +78,7 @@
76 78
 			<type>pom</type>
77 79
 			<scope>provided</scope>
78 80
 		</dependency>
81
+		-->
79 82
 
80 83
 		<!-- Testing: JUnit, Arquillian -->
81 84
 		<dependency>
... ...
@@ -89,28 +92,27 @@
89 92
 			<scope>test</scope>
90 93
 		</dependency>
91 94
 
92
-		<!-- Weld EE container -->
95
+		<!-- Arquillian Container: Weld EE container <dependency> <groupId>org.jboss.arquillian.container</groupId> 
96
+			<artifactId>arquillian-weld-ee-embedded-1.1</artifactId> <version>1.0.0.CR3</version> 
97
+			<scope>test</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> 
98
+			<artifactId>weld-core</artifactId> <version>1.1.5.Final</version> <scope>test</scope> 
99
+			</dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> 
100
+			<version>1.6.4</version> <scope>test</scope> </dependency> -->
101
+
102
+		<!-- ArquillianContainer: Glassfish embedded -->
93 103
 		<dependency>
94 104
 			<groupId>org.jboss.arquillian.container</groupId>
95
-			<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
105
+			<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
96 106
 			<version>1.0.0.CR3</version>
97 107
 			<scope>test</scope>
98 108
 		</dependency>
99 109
 		<dependency>
100
-			<groupId>org.jboss.weld</groupId>
101
-			<artifactId>weld-core</artifactId>
102
-			<version>1.1.5.Final</version>
103
-			<scope>test</scope>
104
-		</dependency>
105
-		<dependency>
106
-			<groupId>org.slf4j</groupId>
107
-			<artifactId>slf4j-simple</artifactId>
108
-			<version>1.6.4</version>
109
-			<scope>test</scope>
110
+			<groupId>org.glassfish.main.extras</groupId>
111
+			<artifactId>glassfish-embedded-all</artifactId>
112
+			<version>3.1.2</version>
113
+			<scope>provided</scope>
110 114
 		</dependency>
111 115
 
112
-		
113
-		
114 116
 	</dependencies>
115 117
 
116 118
 </project>
... ...
@@ -1,16 +1,18 @@
1 1
 package com.haddouti.pg.jee6;
2 2
 
3 3
 import javax.annotation.PostConstruct;
4
-import javax.inject.Inject;
4
+import javax.ejb.EJB;
5
+import javax.ejb.Stateless;
5 6
 
6 7
 import com.haddouti.pg.jee6.service.OneStatelessBean;
7 8
 
8 9
 /**
9 10
  * This is service
10 11
  */
12
+@Stateless
11 13
 public class OneService {
12 14
 
13
-	@Inject
15
+	@EJB
14 16
 	private OneStatelessBean bean;
15 17
 	
16 18
 	@PostConstruct
... ...
@@ -1,11 +1,13 @@
1 1
 package com.haddouti.pg.jee6.service;
2 2
 
3 3
 import javax.annotation.PostConstruct;
4
+import javax.ejb.Stateless;
4 5
 
5 6
 
6 7
 /**
7 8
  * Session Bean implementation class OneStatelessBean
8 9
  */
10
+@Stateless
9 11
 public class OneStatelessBean {
10 12
 
11 13
     /**
... ...
@@ -1,6 +1,6 @@
1 1
 package com.haddouti.pg.jee6;
2 2
 
3
-import javax.inject.Inject;
3
+import javax.ejb.EJB;
4 4
 
5 5
 import junit.framework.Assert;
6 6
 
... ...
@@ -15,13 +15,13 @@ import org.junit.runner.RunWith;
15 15
 import com.haddouti.pg.jee6.service.OneStatelessBean;
16 16
 
17 17
 /**
18
- * Arquillian test case for CDI classes
18
+ * Arquillian test case for EJB classes
19 19
  *
20 20
  */
21 21
 @RunWith(Arquillian.class)
22 22
 public class OneServiceJarTest {
23 23
 
24
-	@Inject
24
+	@EJB
25 25
 	OneService oneService;
26 26
 	
27 27
 	@Deployment
28 28