Skip to content

Commit 3d1fc6d

Browse files
committed
Using EAR to deploy EJB, since Arquillian can't/won't deploy ejb jars.
1 parent e768eff commit 3d1fc6d

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

ejb/remote/roles-allowed-ssl/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</parent>
99

1010
<artifactId>ejb-remote-roles-allowed-ssl</artifactId>
11-
<packaging>war</packaging>
11+
<packaging>jar</packaging>
1212

1313
<name>Java EE 7 Sample: ejb - remote - Roles Allowed</name>
1414

ejb/remote/roles-allowed-ssl/src/test/java/org/javaee7/ejb/remote/ssl/RemoteBeanTest.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package org.javaee7.ejb.remote.ssl;
33

44
import static org.javaee7.ServerOperations.addUsersToContainerIdentityStore;
5+
import static org.jboss.shrinkwrap.api.ShrinkWrap.create;
56
import static org.jboss.shrinkwrap.api.asset.EmptyAsset.INSTANCE;
67
import static org.junit.Assert.assertEquals;
78
import static org.junit.Assume.assumeTrue;
@@ -18,7 +19,9 @@
1819
import org.jboss.arquillian.junit.Arquillian;
1920
import org.jboss.shrinkwrap.api.Archive;
2021
import org.jboss.shrinkwrap.api.ShrinkWrap;
22+
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
2123
import org.jboss.shrinkwrap.api.spec.JavaArchive;
24+
import org.jboss.shrinkwrap.api.spec.WebArchive;
2225
import org.junit.After;
2326
import org.junit.Before;
2427
import org.junit.Test;
@@ -40,14 +43,36 @@ public class RemoteBeanTest {
4043
private RemoteEJBContextProvider remoteEJBContextProvider;
4144

4245
@Deployment
43-
public static Archive<?> deployment() {
44-
46+
public static Archive<EnterpriseArchive> deployment() {
47+
try {
4548
// Add user u1 with password p1 and group g1 to the container's native identity store
4649
addUsersToContainerIdentityStore();
50+
51+
Archive<EnterpriseArchive> archive =
52+
// EAR module
53+
create(EnterpriseArchive.class, "my.ear")
54+
.setApplicationXML("META-INF/application.xml")
55+
56+
// EJB module
57+
.addAsModule(
58+
create(JavaArchive.class, "myEJB.jar")
59+
.addClasses(Bean.class, BeanRemote.class)
60+
.addAsResource("META-INF/glassfish-ejb-jar.xml")
61+
.addAsManifestResource(INSTANCE, "beans.xml")
62+
)
4763

48-
return ShrinkWrap.create(JavaArchive.class)
49-
.addClasses(Bean.class, BeanRemote.class)
50-
.addAsManifestResource(INSTANCE, "beans.xml");
64+
// Web module
65+
.addAsModule(
66+
create(WebArchive.class, "test.war")
67+
);
68+
69+
System.out.println(archive.toString(true));
70+
71+
return archive;
72+
} catch (Exception e) {
73+
e.printStackTrace();
74+
throw e;
75+
}
5176
}
5277

5378
@Before

0 commit comments

Comments
 (0)