This repo attempts to demonstrate a simple integration test of portlets using Jetty and Pluto.
These are very simple portlet web applications. They contain basically the exact same portlet, but under two different classnames for easier identification.
App | Portlet class | Portlet name
------------------------------------------------------------------
test-portlet-1 | grimbo.portlet.test1.TestPortlet | TestPortlet1
test-portlet-2 | grimbo.portlet.test2.TestPortlet | TestPortlet2
This project is the parent pom for an integration test. It contains common dependencies, plugin config, etc.
The basic idea is that an integration test will have these steps:
-
Copy the Pluto webapp into "target". This will give us a copy to play with. I.e. change the
pluto-portal-driver-config.xmlfile. -
Copy a project-local copy of
pluto-portal-driver-config.xmlinto the copied Pluto webapp. This lets us create our own pages, and place the right portlets on them for the integration test. -
Use the
jetty-maven-pluginplugin to start Jetty in thepre-integration-testphase. -
Jetty will be pointed to a project-local copy of
jetty.xmlandrealm.properties, which will allow us to aggregate together the webapps that we need for the integration tests. So the copy of the Pluto webapp will be declared here, along with any other webapps that are required for the integration tests.realm.propertiesis required to define the "pluto" user/password, and also the "pluto" security realm that Pluto uses to authenticate requests. -
The Maven Jetty plugin will be started with the same Pluto server dependencies that are required in the Pluto-Tomcat bundle (Pluto download page). I.e. for Tomcat, these jars are located in
%PLUTO_HOME%\lib\. -
Use the
maven-failsafe-pluginplugin to run the integration tests. -
The provided integration test is called
grimbo.portlet.itest.PortletITCase. This adheres to the Failsafe integration test naming convention, whereby classes called xxxITCase are treated as integration tests. -
JWebUnit is used to code the integration tests.
-
Use the
jetty-maven-pluginplugin to stop Jetty in thepost-integration-testphase.
Current versions used by the project are:
<jetty.version>7.6.4.v20120524</jetty.version>
<pluto.version>2.0.3</pluto.version>
Provides a simple RewriteWebXml class to add PlutoInvoker servlet entries for each portlet defined in portlet.xml.
This project uses the pluto-jetty-test-parent pom and demonstrates a simple integration test.
Extra steps are:
-
Use the
maven-dependency-pluginto unpack the webapps required for testing into "target". -
Using the
org.codehaus.mojo.maven-exec-pluginplugin, run theRewriteWebXmlclass (provided by the dummy-pluto-plugin project). This will add the PlutoInvoker servlet entries into web.xml, which are required for integration with the Pluto portlet container.