Skip to content

Commit 277d2d1

Browse files
author
Reza Rahman
committed
Switching to JBoss EAP
1 parent 946733b commit 277d2d1

17 files changed

Lines changed: 56 additions & 348 deletions

File tree

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@ Testing Java EE Applications using Arquillian
33
This application demonstrates how Java EE applications can be effectively
44
tested using Arquillian. The application contains a
55
set of JUnit tests that you should examine. The tests will be run as part
6-
of the Maven build. We used GlassFish 4.1 for the application (see setup
6+
of the Maven build. We used JBoss EAP 7 for the application (see setup
77
instructions below) but it should be easy to port to any Java EE 7 application
8-
server such as JBoss, WildFly, WebLogic or WebSphere.
8+
server such as GlassFish, WildFly, WebLogic or WebSphere.
99

1010
Setup
1111
-----
12-
* Install GlassFish 4.1
12+
* Install JBoss EAP 7. It should be a simple matter of downloading the installation
13+
jar and running the GUI wizard (you will need a Red Hat account). Just accept
14+
all the defaults. Remember the admin password you choose.
1315
* Please download this repository. You can use Git or just the simple zip
1416
download.
1517
* The demo is just a simple Maven project under the [actionbazaar](actionbazaar)
1618
directory. You should be able to open it up in any Maven capable IDE, we used
1719
NetBeans.
18-
* If desired setup GlassFish in your IDE.
19-
* The tests in the Maven build are executed against an installed GlassFish instance.
20+
* If desired setup JBoss EAP in your IDE; we did. At the current time, NetBeans does
21+
not directly support JBoss EAP 7 yet. You can use the NetBeans features for
22+
WildFly 10; it worked fine for us.
23+
* Make sure JBoss EAP 7 is up and running before you run the tests.
24+
* The tests in the Maven build are executed against a running JBoss EAP instance.
2025
You will need to configure
2126
[this file] (actionbazaar/src/test/resources/arquillian.xml) with the details
22-
of your GlassFish installation. For details on configuring GlassFish for
23-
Arquillian, look
24-
[here] (https://docs.jboss.org/author/display/ARQ/GlassFish+3.1+-+Managed).
25-
Note that in this case we are using GlassFish in managed mode. This means that
26-
Arquillian still automatically start and stop GlassFish as needed. You must
27-
set an admin password for GlassFish. Due to a GlassFish bug, Arquillian can't
28-
start GlassFish with an empty admin password. Also, GlassFish embedded is
29-
no longer supported as of GlassFish 4 and cannot be used. Similarly, we ran
30-
into GlassFish bugs trying to use remote mode (normally the fastest option
31-
with Arquillian).
27+
of your JBoss EAP installation. You must set the admin password for JBoss EAP.
3228
* If desired, you can deploy and run the application manually. We did this both
3329
via NetBeans and by using the plain Maven generated war file.

actionbazaar/nb-configuration.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ That way multiple projects can share the same settings (useful for formatting ru
1414
Any value defined here will override the pom.xml file value but is only applicable to the current project.
1515
-->
1616
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
17+
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>WildFly</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
1718
</properties>
1819
</project-shared-configuration>

actionbazaar/pom.xml

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@
4747
<version>7.0</version>
4848
<scope>provided</scope>
4949
</dependency>
50-
<dependency>
51-
<groupId>org.glassfish.jersey.containers</groupId>
52-
<artifactId>jersey-container-servlet-core</artifactId>
53-
<version>2.0</version>
54-
<type>jar</type>
55-
<scope>provided</scope>
56-
</dependency>
5750
<dependency>
5851
<groupId>junit</groupId>
5952
<artifactId>junit</artifactId>
@@ -78,34 +71,11 @@
7871
<scope>test</scope>
7972
</dependency>
8073
<dependency>
81-
<groupId>org.jboss.arquillian.container</groupId>
82-
<artifactId>arquillian-glassfish-managed-3.1</artifactId>
83-
<version>1.0.0.CR4</version>
84-
<scope>test</scope>
85-
</dependency>
86-
<!-- WebSocket client dependencies -->
87-
<!--
88-
<dependency>
89-
<groupId>org.glassfish.tyrus</groupId>
90-
<artifactId>tyrus-server</artifactId>
91-
<version>1.7</version>
74+
<groupId>org.arquillian.container</groupId>
75+
<artifactId>arquillian-container-chameleon</artifactId>
76+
<version>1.0.0.Alpha6</version>
9277
<scope>test</scope>
9378
</dependency>
94-
<dependency>
95-
<groupId>org.glassfish.tyrus</groupId>
96-
<artifactId>tyrus-container-grizzly-server</artifactId>
97-
<version>1.7</version>
98-
<scope>test</scope>
99-
</dependency>
100-
-->
101-
<!-- Jersey client dependencies -->
102-
<!--
103-
<dependency>
104-
<groupId>org.glassfish.jersey.core</groupId>
105-
<artifactId>jersey-client</artifactId>
106-
<version>2.16</version>
107-
</dependency>
108-
-->
10979
</dependencies>
11080
<build>
11181
<finalName>actionbazaar</finalName>
Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,16 @@
1-
/*
2-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3-
*
4-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5-
*
6-
* The contents of this file are subject to the terms of either the GNU
7-
* General Public License Version 2 only ("GPL") or the Common Development
8-
* and Distribution License("CDDL") (collectively, the "License"). You
9-
* may not use this file except in compliance with the License. You can
10-
* obtain a copy of the License at
11-
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12-
* or packager/legal/LICENSE.txt. See the License for the specific
13-
* language governing permissions and limitations under the License.
14-
*
15-
* When distributing the software, include this License Header Notice in each
16-
* file and include the License file at packager/legal/LICENSE.txt.
17-
*
18-
* GPL Classpath Exception:
19-
* Oracle designates this particular file as subject to the "Classpath"
20-
* exception as provided by Oracle in the GPL Version 2 section of the License
21-
* file that accompanied this code.
22-
*
23-
* Modifications:
24-
* If applicable, add the following below the License Header, with the fields
25-
* enclosed by brackets [] replaced by your own identifying information:
26-
* "Portions Copyright [year] [name of copyright owner]"
27-
*
28-
* Contributor(s):
29-
* If you wish your version of this file to be governed by only the CDDL or
30-
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31-
* elects to include this software in this distribution under the [CDDL or GPL
32-
* Version 2] license." If you don't indicate a single choice of license, a
33-
* recipient has the option to distribute your version of this file under
34-
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35-
* its licensees as provided above. However, if you add GPL Version 2 code
36-
* and therefore, elected the GPL Version 2 license, then the option applies
37-
* only if the new code is made subject to such option by the copyright
38-
* holder.
39-
*/
401
package com.actionbazaar.interfaces.rest;
412

3+
import java.util.Set;
424
import javax.ws.rs.ApplicationPath;
43-
import org.glassfish.jersey.server.ResourceConfig;
5+
import javax.ws.rs.core.Application;
446

45-
/**
46-
* JAX-RS configuration.
47-
*/
487
@ApplicationPath("rest")
49-
// TODO Move this to XML.
50-
public class RestConfiguration extends ResourceConfig {
8+
public class RestConfiguration extends Application {
519

52-
public RestConfiguration() {
53-
// Resource
54-
packages(new String[]{BidRestService.class.getPackage().getName()});
10+
@Override
11+
public Set<Class<?>> getClasses() {
12+
Set<Class<?>> resources = new java.util.HashSet<>();
13+
resources.add(BidRestService.class);
14+
return resources;
5515
}
56-
}
16+
}

actionbazaar/src/main/java/com/actionbazaar/interfaces/web/AddBid.java

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
1-
/*
2-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3-
*
4-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5-
*
6-
* The contents of this file are subject to the terms of either the GNU
7-
* General Public License Version 2 only ("GPL") or the Common Development
8-
* and Distribution License("CDDL") (collectively, the "License"). You
9-
* may not use this file except in compliance with the License. You can
10-
* obtain a copy of the License at
11-
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12-
* or packager/legal/LICENSE.txt. See the License for the specific
13-
* language governing permissions and limitations under the License.
14-
*
15-
* When distributing the software, include this License Header Notice in each
16-
* file and include the License file at packager/legal/LICENSE.txt.
17-
*
18-
* GPL Classpath Exception:
19-
* Oracle designates this particular file as subject to the "Classpath"
20-
* exception as provided by Oracle in the GPL Version 2 section of the License
21-
* file that accompanied this code.
22-
*
23-
* Modifications:
24-
* If applicable, add the following below the License Header, with the fields
25-
* enclosed by brackets [] replaced by your own identifying information:
26-
* "Portions Copyright [year] [name of copyright owner]"
27-
*
28-
* Contributor(s):
29-
* If you wish your version of this file to be governed by only the CDDL or
30-
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31-
* elects to include this software in this distribution under the [CDDL or GPL
32-
* Version 2] license." If you don't indicate a single choice of license, a
33-
* recipient has the option to distribute your version of this file under
34-
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35-
* its licensees as provided above. However, if you add GPL Version 2 code
36-
* and therefore, elected the GPL Version 2 license, then the option applies
37-
* only if the new code is made subject to such option by the copyright
38-
* holder.
39-
*/
401
package com.actionbazaar.interfaces.web;
412

423
import com.actionbazaar.application.BidService;
@@ -48,7 +9,7 @@
489
import javax.inject.Named;
4910

5011
@Named
51-
@ApplicationScoped // TODO Change this to flow scope.
12+
@ApplicationScoped // TODO Change this to flow scoped.
5213
public class AddBid implements Serializable {
5314

5415
private static final long serialVersionUID = 1L;

actionbazaar/src/main/resources/META-INF/persistence.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
2+
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
35
<persistence-unit name="action-bazaar-unit" transaction-type="JTA">
46
<jta-data-source>java:global/jdbc/ActionBazaarDB</jta-data-source>
57
<properties>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
2+
<deployment>
3+
<dependencies>
4+
<module name="com.h2database.h2"/>
5+
</dependencies>
6+
</deployment>
7+
</jboss-deployment-structure>

actionbazaar/src/main/webapp/WEB-INF/web.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</welcome-file-list>
2525
<data-source>
2626
<name>java:global/jdbc/ActionBazaarDB</name>
27-
<class-name>org.apache.derby.jdbc.EmbeddedDriver</class-name>
28-
<url>jdbc:derby:/tmp/actionbazaar-development-database;create=true</url>
27+
<class-name>org.h2.jdbcx.JdbcDataSource</class-name>
28+
<url>jdbc:h2:/tmp/actionbazaar-development-database</url>
2929
</data-source>
3030
</web-app>

actionbazaar/src/test/java/com/actionbazaar/application/BidServiceTest.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
1-
/*
2-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3-
*
4-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5-
*
6-
* The contents of this file are subject to the terms of either the GNU
7-
* General Public License Version 2 only ("GPL") or the Common Development
8-
* and Distribution License("CDDL") (collectively, the "License"). You
9-
* may not use this file except in compliance with the License. You can
10-
* obtain a copy of the License at
11-
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12-
* or packager/legal/LICENSE.txt. See the License for the specific
13-
* language governing permissions and limitations under the License.
14-
*
15-
* When distributing the software, include this License Header Notice in each
16-
* file and include the License file at packager/legal/LICENSE.txt.
17-
*
18-
* GPL Classpath Exception:
19-
* Oracle designates this particular file as subject to the "Classpath"
20-
* exception as provided by Oracle in the GPL Version 2 section of the License
21-
* file that accompanied this code.
22-
*
23-
* Modifications:
24-
* If applicable, add the following below the License Header, with the fields
25-
* enclosed by brackets [] replaced by your own identifying information:
26-
* "Portions Copyright [year] [name of copyright owner]"
27-
*
28-
* Contributor(s):
29-
* If you wish your version of this file to be governed by only the CDDL or
30-
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31-
* elects to include this software in this distribution under the [CDDL or GPL
32-
* Version 2] license." If you don't indicate a single choice of license, a
33-
* recipient has the option to distribute your version of this file under
34-
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35-
* its licensees as provided above. However, if you add GPL Version 2 code
36-
* and therefore, elected the GPL Version 2 license, then the option applies
37-
* only if the new code is made subject to such option by the copyright
38-
* holder.
39-
*/
401
package com.actionbazaar.application;
412

423
import static org.junit.Assert.assertEquals;
@@ -69,6 +30,7 @@ public static WebArchive createDeployment() {
6930
Profiled.class, ProfilingInterceptor.class,
7031
BidRepository.class, DefaultBidRepository.class, Bid.class)
7132
.addAsWebInfResource("test-persistence-web.xml", "web.xml")
33+
.addAsWebInfResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
7234
.addAsWebInfResource("test-persistence-beans.xml", "beans.xml")
7335
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
7436
}

actionbazaar/src/test/java/com/actionbazaar/application/BidServiceUnitTest.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
1-
/*
2-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3-
*
4-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5-
*
6-
* The contents of this file are subject to the terms of either the GNU
7-
* General Public License Version 2 only ("GPL") or the Common Development
8-
* and Distribution License("CDDL") (collectively, the "License"). You
9-
* may not use this file except in compliance with the License. You can
10-
* obtain a copy of the License at
11-
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12-
* or packager/legal/LICENSE.txt. See the License for the specific
13-
* language governing permissions and limitations under the License.
14-
*
15-
* When distributing the software, include this License Header Notice in each
16-
* file and include the License file at packager/legal/LICENSE.txt.
17-
*
18-
* GPL Classpath Exception:
19-
* Oracle designates this particular file as subject to the "Classpath"
20-
* exception as provided by Oracle in the GPL Version 2 section of the License
21-
* file that accompanied this code.
22-
*
23-
* Modifications:
24-
* If applicable, add the following below the License Header, with the fields
25-
* enclosed by brackets [] replaced by your own identifying information:
26-
* "Portions Copyright [year] [name of copyright owner]"
27-
*
28-
* Contributor(s):
29-
* If you wish your version of this file to be governed by only the CDDL or
30-
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31-
* elects to include this software in this distribution under the [CDDL or GPL
32-
* Version 2] license." If you don't indicate a single choice of license, a
33-
* recipient has the option to distribute your version of this file under
34-
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35-
* its licensees as provided above. However, if you add GPL Version 2 code
36-
* and therefore, elected the GPL Version 2 license, then the option applies
37-
* only if the new code is made subject to such option by the copyright
38-
* holder.
39-
*/
401
package com.actionbazaar.application;
412

423
import com.actionbazaar.domain.Bid;

0 commit comments

Comments
 (0)