|
1 | | -Testing Java EE Applications Using Arquillian |
2 | | -========== |
| 1 | +Testing Java EE Applications on WebLogic 12.1.3 Using Arquillian |
| 2 | +================================================================ |
| 3 | +This application demonstrates how Java EE applications can be effectively |
| 4 | +tested using Arquillian on WebLogic 12.1.3. The application contains a |
| 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. |
3 | 9 |
|
4 | | -This application demonstrates how Java EE applications can be effectively tested using Arquillian. |
| 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. |
| 13 | + |
| 14 | +Setup |
| 15 | +----- |
| 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). |
| 39 | +* Please download this repository. You can use Git or just the simple zip |
| 40 | + download. |
| 41 | +* The demo is just a simple Maven project under the [actionbazaar](actionbazaar) |
| 42 | + directory. You should be able to open it up in any Maven capable IDE, we used |
| 43 | + 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. |
| 46 | + You will need to configure |
| 47 | + [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. |
| 55 | +* 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. |
0 commit comments