Browse code

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

Change-Id: I8918c157648067f269f5a00bb290448180155e87

Hafid Haddouti authored on26/04/2014 22:16:27
Showing4 changed files
... ...
@@ -50,11 +50,13 @@
50 50
 					</compilerArguments>
51 51
 				</configuration>
52 52
 			</plugin>
53
+
53 54
 			<!-- Updating the Surefire plugin to resolve a bug with clearing the context -->
54 55
 			<plugin>
55 56
 				<artifactId>maven-surefire-plugin</artifactId>
56 57
 				<version>2.12</version>
57 58
 			</plugin>
59
+
58 60
 			<plugin>
59 61
 				<groupId>org.apache.maven.plugins</groupId>
60 62
 				<artifactId>maven-war-plugin</artifactId>
... ...
@@ -65,17 +67,18 @@
65 67
 			</plugin>
66 68
 		</plugins>
67 69
 	</build>
68
-	
69
-	
70
+
71
+
70 72
 	<dependencies>
71
-		<!-- JEE Spec -->
73
+		<!-- JEE Spec 
72 74
 		<dependency>
73
-            <groupId>org.jboss.spec</groupId>
74
-            <artifactId>jboss-javaee-6.0</artifactId>
75
-            <version>1.0.0.Final</version>
76
-            <type>pom</type>
77
-            <scope>provided</scope>
78
-        </dependency>
75
+			<groupId>org.jboss.spec</groupId>
76
+			<artifactId>jboss-javaee-6.0</artifactId>
77
+			<version>1.0.0.Final</version>
78
+			<type>pom</type>
79
+			<scope>provided</scope>
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>
110
+			<groupId>org.glassfish.main.extras</groupId>
111
+			<artifactId>glassfish-embedded-all</artifactId>
112
+			<version>3.1.2</version>
113
+			<scope>provided</scope>
104 114
 		</dependency>
105
-		<dependency>
106
-			<groupId>org.slf4j</groupId>
107
-			<artifactId>slf4j-simple</artifactId>
108
-			<version>1.6.4</version>
109
-			<scope>test</scope>
110
-		</dependency>
111
-		
112
-		
113
-		
115
+
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