|
1 | | -Testing Java EE Applications on WebLogic 12.1.3 Using Arquillian |
| 1 | +Testing Java EE Applications using Arquillian |
2 | 2 | ================================================================ |
3 | 3 | This application demonstrates how Java EE applications can be effectively |
4 | | -tested using Arquillian on WebLogic 12.1.3. The application contains a |
| 4 | +tested using Arquillian. The application contains a |
5 | 5 | set of JUnit tests that you should examine. The tests will be run as part |
6 | | -of the Maven build. The tests require a running instance of |
7 | | -WebLogic (please see setup instructions). The WebLogic Maven plugin used as |
8 | | -part of the build also requires a running instance of WebLogic to be present. |
9 | | - |
10 | | -WebLogic 12.1.3 supports Java EE 6 and some key Java EE 7 APIs - |
11 | | -WebSocket, JAX-RS 2, JSON-P and JPA 2.1. The application uses both |
12 | | -these APIs as well as Java EE 6 features such as CDI, EJB 3.1 and JSF 2. |
| 6 | +of the Maven build. We used GlassFish 4.1 for the application (see setup |
| 7 | +instructions below) but it should be easy to port to any Java EE 7 application |
| 8 | +server such as JBoss, WildFly, WebLogic or WebSphere. |
13 | 9 |
|
14 | 10 | Setup |
15 | 11 | ----- |
16 | | -* Install WebLogic 12.1.3 |
17 | | -* The Java EE 7 APIs are not automatically enabled. This |
18 | | - [Aquarium blog entry](https://blogs.oracle.com/theaquarium/entry/java_ee_7_support_comes) |
19 | | - is invaluable in better understanding the Java EE 7 API support in |
20 | | - WebLogic 12.1.3. The referenced white paper explains the steps necessary to |
21 | | - enable the APIs. |
22 | | -* The demo application requires a data source. WebLogic 12.1.3 supports the |
23 | | - Java EE 6 standard @DataSourceDefinition and corresponding XML elements. |
24 | | - However, this does not seem to work with JPA 2.1 so we could not use it. A bug |
25 | | - has been filed to get this fixed. Yet another approach is to use WebLogic |
26 | | - proprietary JDBC modules. This requires an EAR file and would significantly |
27 | | - complicate an otherwise simple WAR build. For this reason, this was not an |
28 | | - approach we used. As a result, however, you will need to manually create a |
29 | | - data source for the demo application. The data source is expected to be bound |
30 | | - to 'jdbc/ActionBazaarDB'. We used embedded Derby but any underlying database |
31 | | - should work. If helpful, a sample WebLogic data source definition is provided |
32 | | - [here](ActionBazaarDB-jdbc.xml). |
33 | | -* The demo application uses the WebLogic Maven plugin to automatically deploy |
34 | | - as part of the build. You will need to enable the plugin in your environment. |
35 | | - The detailed instructions to do this can be found |
36 | | - [here](http://docs.oracle.com/middleware/1213/wls/WLPRG/maven.htm). This |
37 | | - resource also contains details on how to configure the Maven plugin, which |
38 | | - you will need to do (see below). |
| 12 | +* Install GlassFish 4.1 |
39 | 13 | * Please download this repository. You can use Git or just the simple zip |
40 | 14 | download. |
41 | 15 | * The demo is just a simple Maven project under the [actionbazaar](actionbazaar) |
42 | 16 | directory. You should be able to open it up in any Maven capable IDE, we used |
43 | 17 | NetBeans. |
44 | | -* If desired setup WebLogic in your IDE. This is what we tested. |
45 | | -* The tests in the Maven build are executed against a running WebLogic instance. |
| 18 | +* If desired setup GlassFish in your IDE. |
| 19 | +* The tests in the Maven build are executed against an installed GlassFish instance. |
46 | 20 | You will need to configure |
47 | 21 | [this file] (actionbazaar/src/test/resources/arquillian.xml) with the details |
48 | | - of your running WebLogic instance (you could run the instance via the IDE). |
49 | | - For details on configuring WebLogic for Arquillian, look |
50 | | - [here] (https://docs.jboss.org/author/display/ARQ/WLS+12.1+-+Remote). |
51 | | -* The build also automatically undeploys and deploys the application to the |
52 | | - running WebLogic instance using the WebLogic Maven plugin. Please configure |
53 | | - the plugin in the [Maven POM](actionbazaar/pom.xml) with the details |
54 | | - of your running WebLogic instance. |
| 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). |
55 | 32 | * If desired, you can deploy and run the application manually. We did this both |
56 | | - via NetBeans and by using the plain Maven generated war file in addition to |
57 | | - the automated build. |
58 | | -* You can hook up the build to a continuous integration server such as Hudson. |
59 | | - We tested such a setup. |
| 33 | + via NetBeans and by using the plain Maven generated war file. |
0 commit comments