MPGENAPP-6. Add struts, struts-jstl, web and web-jstl templates.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114759 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
evenisse
2004-02-27 06:22:27 +00:00
parent 45d6181651
commit aae1fe00ed
60 changed files with 1637 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
target
.classpath
.project
*.log
build.xml
build.properties

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
<preGoal name="java:compile">
<mkdir dir="target\xdoclet\webdoclet\WEB-INF" />
<attainGoal name="xdoclet:webdoclet" />
</preGoal>
</project>

View File

@@ -0,0 +1,20 @@
maven.xdoc.date=left
maven.eclipse.classpath.include=src/test-cactus,src/conf
maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet
maven.xdoclet.webdoclet.0=true
maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.0.mergeDir=src/merge
maven.xdoclet.webdoclet.strutsconfigxml.0=true
maven.xdoclet.webdoclet.strutsconfigxml.0.validateXML=true
maven.xdoclet.webdoclet.strutsconfigxml.0.Version=1.1
maven.xdoclet.webdoclet.strutsconfigxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.strutsconfigxml.0.mergeDir=src/merge
maven.xdoclet.webdoclet.strutsvalidationxml.0=true
maven.xdoclet.webdoclet.strutsvalidationxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.jbosswebxml.0=true
maven.xdoclet.webdoclet.jbosswebxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge
maven.xdoclet.webdoclet.fileset.0.include=**/*.java
maven.xdoclet.webdoclet.jsptaglib.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF/tld
cactus.src.mergewebxml = src/conf/cactus-web.xml

View File

@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- the version of maven's project object model -->
<pomVersion>3</pomVersion>
<!-- a unique name for this project -->
<id>@ID@</id>
<groupId>@ID@</groupId>
<!-- a short but descriptive name for the project -->
<name>@NAME@</name>
<!-- The version of the project under development, e.g.
1.1, 1.2, 2.0-SNAPSHOT -->
<currentVersion>1.0</currentVersion>
<!-- details about the organization that 'owns' the project -->
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<!-- the year the project started -->
<inceptionYear>2004</inceptionYear>
<package>@PACKAGE@</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>A collection of example projects showing how to use maven in different situations</description>
<!-- a short description of what the project does -->
<shortDescription>How to use maven in different situations</shortDescription>
<!-- the project home page -->
<url>http://maven.apache.org/reference/plugins/examples/</url>
<issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>
<distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
<!-- the version control repository and http url for online access
the connection element has the form:
scm:<system>:<system specific connection string> -->
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/examples</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>
</repository>
<!-- any mailing lists for the project -->
<mailingLists/>
<!-- who the developers are for the project -->
<developers>
</developers>
<!-- jar files the project is dependent on -->
<dependencies>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<id>jstl</id>
<version>1.0.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.0.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6dev-20040115</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- Struts dependencies -->
<dependency>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<version>1.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-bean</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-html</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-logic</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>strutstestcase</groupId>
<artifactId>strutstest</artifactId>
<version>2.1.0</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.5</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- XDoclet dependencies -->
<dependency>
<id>xdoclet</id>
<version>1.2</version>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-web-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-ejb-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-apache-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<version>1.0.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<!-- HttpUnit dependencies -->
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.5.4</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>4aug2000r7-dev</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
</dependencies>
<build>
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/NaughtyTest.java</exclude>
</excludes>
</unitTest>
<resources>
<resource>
<directory>src/conf</directory>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1 @@
title.page=The title @PACKAGE@

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

View File

@@ -0,0 +1,55 @@
package @PACKAGE@;
import java.io.IOException;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
/**
* This is a simple struts action that simply redirects the input back to itself. It
* also sets a bean value to the current date.
*
* @struts.action
* name="TestForm"
* path="/TestInput"
* @struts.action-forward
* name="success"
* path="/WEB-INF/jsp/input.jsp"
*
* @author <a href="mailto:trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: InputAction.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class InputAction extends Action {
/**
* Performs the simple action
*
* @param mapping
* the action mappings where you find the return value of the
* forward
* @param actionForm
* the action form used, in this example it will be an instance
* of the DynaActionForm class
* @param request
* the HTTP servlet request
* @param response
* the HTTP servlet response
*/
public ActionForward perform(ActionMapping mapping, ActionForm actionForm,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
if (actionForm != null) {
DynaActionForm form = (DynaActionForm) actionForm;
form.set("theDate", new Date());
}
return (mapping.findForward("success"));
}
}

View File

@@ -0,0 +1,4 @@
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

View File

@@ -0,0 +1,9 @@
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

View File

@@ -0,0 +1,13 @@
<form-bean
name="TestForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="givenName"
type="java.lang.String" />
<form-property
name="familyName"
type="java.lang.String" />
<form-property
name="theDate"
type="java.util.Date" />
</form-bean>

View File

@@ -0,0 +1 @@
<message-resources parameter="ApplicationResources"/>

View File

@@ -0,0 +1,51 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebForm;
/**
* This tests the site using HttpUnit
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano </a>
* @version $Id: HttpUnitTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class HttpUnitTest extends ServletTestCase {
/**
* This is a helper method to create the URL string for the initial web
* conversation request
*
* @param relativeUrl
* the relative URL including the leading"/"
* @return the context url with the relative URL appended to it
*/
private String requestUrl(String relativeUrl) {
StringBuffer url = request.getRequestURL();
url.delete(url.lastIndexOf("/"), url.length());
url.append(relativeUrl);
return url.toString();
}
/**
* This tests if the sample struts form works properly
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testStrutsPages() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/TestInput.do"));
{
WebForm form = wc.getCurrentPage().getForms()[0];
form.setParameter("givenName", "Archie");
form.setParameter("familyName", "Trajano");
form.submit();
}
{
WebForm form = wc.getCurrentPage().getForms()[0];
assertEquals("Archie", form.getParameterValue("givenName"));
assertEquals("Trajano", form.getParameterValue("familyName"));
}
}
};

View File

@@ -0,0 +1,31 @@
package @PACKAGE@;
import servletunit.struts.CactusStrutsTestCase;
/**
* This tests the functionality of the StrutsTestCase
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano </a>
* @version $Id: StrutsTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class StrutsTest extends CactusStrutsTestCase {
/**
* Required constructor for CactusStrutsTestCase
*
* @param name
* name of the test
*/
public StrutsTest(String name) {
super(name);
}
public void testInputForm() throws Exception {
setRequestPathInfo("/TestInput.do");
addRequestParameter("givenName", "Archie");
addRequestParameter("familyName", "Trajano");
actionPerform();
verifyForward("success");
verifyNoActionErrors();
}
}

View File

@@ -0,0 +1,15 @@
package @PACKAGE@;
import junit.framework.TestCase;
/**
* This is a simple JUnit test case to ensure that the environment is okay.
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: SanityTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class SanityTest extends TestCase {
public void testSanity() {
assertEquals( "test", "test" );
}
}

View File

@@ -0,0 +1,26 @@
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean-1.1.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html-1.1.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic-1.1.tld" prefix="logic" %>
<html:html xhtml="true">
<head>
<html:base/>
<title><bean:message key="title.page"/></title>
</head>
<body>
<p>The name is <bean:write name="TestForm" property="familyName"/>, <bean:write name="TestForm" property="givenName"/> on <bean:write name="TestForm" property="theDate"/></p>
<html:form action="/TestInput">
<html:text property="givenName" size="16"/>
<html:text property="familyName" size="16"/>
<html:submit/>
</html:form>
</body>
</html:html>

View File

@@ -0,0 +1,4 @@
maven.genapp.repackage=java,test,test-cactus
maven.genapp.filter=project.xml,src/conf/cactus-web.xml,src/merge/**
maven.genapp.default.package=example.web

View File

@@ -0,0 +1,6 @@
target
.classpath
.project
*.log
build.xml
build.properties

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
<preGoal name="java:compile">
<mkdir dir="target\xdoclet\webdoclet\WEB-INF" />
<attainGoal name="xdoclet:webdoclet" />
</preGoal>
</project>

View File

@@ -0,0 +1,20 @@
maven.xdoc.date=left
maven.eclipse.classpath.include=src/test-cactus,src/conf
maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet
maven.xdoclet.webdoclet.0=true
maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.0.mergeDir=src/merge
maven.xdoclet.webdoclet.strutsconfigxml.0=true
maven.xdoclet.webdoclet.strutsconfigxml.0.validateXML=true
maven.xdoclet.webdoclet.strutsconfigxml.0.Version=1.1
maven.xdoclet.webdoclet.strutsconfigxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
#maven.xdoclet.webdoclet.strutsconfigxml.0.destDir=target
maven.xdoclet.webdoclet.strutsconfigxml.0.mergeDir=src/merge
maven.xdoclet.webdoclet.strutsvalidationxml.0=true
maven.xdoclet.webdoclet.strutsvalidationxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.jbosswebxml.0=true
maven.xdoclet.webdoclet.jbosswebxml.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge
maven.xdoclet.webdoclet.fileset.0.include=**/*.java
cactus.src.mergewebxml = src/conf/cactus-web.xml

View File

@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- the version of maven's project object model -->
<pomVersion>3</pomVersion>
<!-- a unique name for this project -->
<id>@ID@</id>
<groupId>@ID@</groupId>
<!-- a short but descriptive name for the project -->
<name>@NAME@</name>
<!-- The version of the project under development, e.g.
1.1, 1.2, 2.0-SNAPSHOT -->
<currentVersion>1.0</currentVersion>
<!-- details about the organization that 'owns' the project -->
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<!-- the year the project started -->
<inceptionYear>2004</inceptionYear>
<package>@PACKAGE@</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>A collection of example projects showing how to use maven in different situations</description>
<!-- a short description of what the project does -->
<shortDescription>How to use maven in different situations</shortDescription>
<!-- the project home page -->
<url>http://maven.apache.org/reference/plugins/examples/</url>
<issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>
<distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
<!-- the version control repository and http url for online access
the connection element has the form:
scm:<system>:<system specific connection string> -->
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/examples</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>
</repository>
<!-- any mailing lists for the project -->
<mailingLists/>
<!-- who the developers are for the project -->
<developers>
</developers>
<!-- jar files the project is dependent on -->
<dependencies>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6dev-20040115</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- Struts dependencies -->
<dependency>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<version>1.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-bean</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-html</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-logic</artifactId>
<version>1.1</version>
<type>tld</type>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>strutstestcase</groupId>
<artifactId>strutstest</artifactId>
<version>2.1.0</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.6</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.5</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.0</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- XDoclet dependencies -->
<dependency>
<id>xdoclet</id>
<version>1.2</version>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-web-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-ejb-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-apache-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<version>1.0.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<!-- HttpUnit dependencies -->
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.5.4</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>4aug2000r7-dev</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
</dependencies>
<build>
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/NaughtyTest.java</exclude>
</excludes>
</unitTest>
<resources>
<resource>
<directory>src/conf</directory>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1 @@
title.page=The title @PACKAGE@

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

View File

@@ -0,0 +1,55 @@
package @PACKAGE@;
import java.io.IOException;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
/**
* This is a simple struts action that simply redirects the input back to itself. It
* also sets a bean value to the current date.
*
* @struts.action
* name="TestForm"
* path="/TestInput"
* @struts.action-forward
* name="success"
* path="/WEB-INF/jsp/input.jsp"
*
* @author <a href="mailto:trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: InputAction.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class InputAction extends Action {
/**
* Performs the simple action
*
* @param mapping
* the action mappings where you find the return value of the
* forward
* @param actionForm
* the action form used, in this example it will be an instance
* of the DynaActionForm class
* @param request
* the HTTP servlet request
* @param response
* the HTTP servlet response
*/
public ActionForward perform(ActionMapping mapping, ActionForm actionForm,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
if (actionForm != null) {
DynaActionForm form = (DynaActionForm) actionForm;
form.set("theDate", new Date());
}
return (mapping.findForward("success"));
}
}

View File

@@ -0,0 +1,4 @@
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

View File

@@ -0,0 +1,9 @@
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

View File

@@ -0,0 +1,13 @@
<form-bean
name="TestForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="givenName"
type="java.lang.String" />
<form-property
name="familyName"
type="java.lang.String" />
<form-property
name="theDate"
type="java.util.Date" />
</form-bean>

View File

@@ -0,0 +1 @@
<message-resources parameter="ApplicationResources"/>

View File

@@ -0,0 +1,51 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebForm;
/**
* This tests the site using HttpUnit
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano </a>
* @version $Id: HttpUnitTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class HttpUnitTest extends ServletTestCase {
/**
* This is a helper method to create the URL string for the initial web
* conversation request
*
* @param relativeUrl
* the relative URL including the leading"/"
* @return the context url with the relative URL appended to it
*/
private String requestUrl(String relativeUrl) {
StringBuffer url = request.getRequestURL();
url.delete(url.lastIndexOf("/"), url.length());
url.append(relativeUrl);
return url.toString();
}
/**
* This tests if the sample struts form works properly
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testStrutsPages() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/TestInput.do"));
{
WebForm form = wc.getCurrentPage().getForms()[0];
form.setParameter("givenName", "Archie");
form.setParameter("familyName", "Trajano");
form.submit();
}
{
WebForm form = wc.getCurrentPage().getForms()[0];
assertEquals("Archie", form.getParameterValue("givenName"));
assertEquals("Trajano", form.getParameterValue("familyName"));
}
}
};

View File

@@ -0,0 +1,31 @@
package @PACKAGE@;
import servletunit.struts.CactusStrutsTestCase;
/**
* This tests the functionality of the StrutsTestCase
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano </a>
* @version $Id: StrutsTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class StrutsTest extends CactusStrutsTestCase {
/**
* Required constructor for CactusStrutsTestCase
*
* @param name
* name of the test
*/
public StrutsTest(String name) {
super(name);
}
public void testInputForm() throws Exception {
setRequestPathInfo("/TestInput.do");
addRequestParameter("givenName", "Archie");
addRequestParameter("familyName", "Trajano");
actionPerform();
verifyForward("success");
verifyNoActionErrors();
}
}

View File

@@ -0,0 +1,15 @@
package @PACKAGE@;
import junit.framework.TestCase;
/**
* This is a simple JUnit test case to ensure that the environment is okay.
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: SanityTest.java,v 1.1 2004/02/27 06:22:26 evenisse Exp $
*/
public class SanityTest extends TestCase {
public void testSanity() {
assertEquals( "test", "test" );
}
}

View File

@@ -0,0 +1,21 @@
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean-1.1.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html-1.1.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic-1.1.tld" prefix="logic" %>
<html:html xhtml="true">
<head>
<html:base/>
<title><bean:message key="title.page"/></title>
</head>
<body>
<p>The name is <bean:write name="TestForm" property="familyName"/>, <bean:write name="TestForm" property="givenName"/> on <bean:write name="TestForm" property="theDate"/></p>
<html:form action="/TestInput">
<html:text property="givenName" size="16"/>
<html:text property="familyName" size="16"/>
<html:submit/>
</html:form>
</body>
</html:html>

View File

@@ -0,0 +1,4 @@
maven.genapp.repackage=java,test,test-cactus
maven.genapp.filter=project.xml,src/conf/cactus-web.xml,src/merge/**
maven.genapp.default.package=example.web

View File

@@ -0,0 +1,6 @@
target
.classpath
.project
*.log
build.xml
build.properties

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
<preGoal name="java:compile">
<mkdir dir="target\xdoclet\webdoclet\WEB-INF" />
<attainGoal name="xdoclet:webdoclet" />
</preGoal>
</project>

View File

@@ -0,0 +1,10 @@
maven.xdoc.date=left
maven.eclipse.classpath.include=src/test-cactus
maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet
maven.xdoclet.webdoclet.0=true
maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.0.mergeDir=src/merge
maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge
maven.xdoclet.webdoclet.jsptaglib.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF/tld
cactus.src.mergewebxml = src/conf/cactus-web.xml

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- the version of maven's project object model -->
<pomVersion>3</pomVersion>
<!-- a unique name for this project -->
<id>@ID@</id>
<groupId>@ID@</groupId>
<!-- a short but descriptive name for the project -->
<name>@NAME@</name>
<!-- The version of the project under development, e.g.
1.1, 1.2, 2.0-SNAPSHOT -->
<currentVersion>1.0</currentVersion>
<!-- details about the organization that 'owns' the project -->
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<!-- the year the project started -->
<inceptionYear>2004</inceptionYear>
<package>@PACKAGE@</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>A collection of example projects showing how to use maven in different situations</description>
<!-- a short description of what the project does -->
<shortDescription>How to use maven in different situations</shortDescription>
<!-- the project home page -->
<url>http://maven.apache.org/reference/plugins/examples/</url>
<issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>
<distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
<!-- the version control repository and http url for online access
the connection element has the form:
scm:<system>:<system specific connection string> -->
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/examples</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>
</repository>
<!-- any mailing lists for the project -->
<mailingLists/>
<!-- who the developers are for the project -->
<developers>
</developers>
<!-- jar files the project is dependent on -->
<dependencies>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<id>jstl</id>
<version>1.0.2</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.0.4</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6dev-20040115</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- XDoclet dependencies -->
<dependency>
<id>xdoclet</id>
<version>1.2</version>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-web-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-ejb-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<version>1.0.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<!-- HttpUnit dependencies -->
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.5.4</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>4aug2000r7-dev</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
</dependencies>
<build>
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/NaughtyTest.java</exclude>
</excludes>
</unitTest>
<resources>
<resource>
<directory>src/conf</directory>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,2 @@
# Sample app properties.
foo=bar

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

View File

@@ -0,0 +1,35 @@
package @PACKAGE@;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This is a sample servlet, typically you would not use this, but it is useful
* for testing the sanity of your web application configuration.
*
* @web.servlet name="HelloWorld"
* @web.servlet-mapping url-pattern="/HelloWorld"
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HelloWorldServlet.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HelloWorldServlet extends HttpServlet {
/**
* This prints out the standard "Hello world" message with a date stamp.
*
* @param request
* the HTTP request object
* @param response
* the HTTP response object
* @throws IOException
* thrown when there is a problem getting the writer
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException {
response.getWriter().println("Hello world on " + new Date());
}
}

View File

@@ -0,0 +1,24 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebResponse;
import @PACKAGE@.HelloWorldServlet;
/**
* This tests that the HelloWorld servlet is functioning
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HelloWorldServletTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HelloWorldServletTest extends ServletTestCase {
public void testHelloWorld() throws Exception {
HelloWorldServlet servlet = new HelloWorldServlet();
servlet.doGet(request,response);
}
public void endHelloWorld(WebResponse response) {
assertTrue(response.getText().startsWith("Hello world on"));
}
}

View File

@@ -0,0 +1,52 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import com.meterware.httpunit.WebConversation;
/**
* This tests the system using the HttpUnit
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HttpUnitTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HttpUnitTest extends ServletTestCase {
/**
* This tests if the Hello World servlet provides the correct output
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testHelloWorldServlet() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/HelloWorld"));
assertTrue(wc.getCurrentPage().getText().startsWith("Hello world on"));
}
/**
* This tests if the Hello World JSP provides the correct output
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testHelloWorldJsp() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/sample.jsp"));
assertTrue(wc.getCurrentPage().getText().indexOf("Hello world JSP on") != -1);
}
/**
* This is a helper method to create the URL string for the initial web
* conversation request
*
* @param relativeUrl
* the relative URL including the leading"/"
* @return the context url with the relative URL appended to it
*/
private String requestUrl(String relativeUrl) {
StringBuffer url = request.getRequestURL();
url.delete(url.lastIndexOf("/"), url.length());
url.append(relativeUrl);
return url.toString();
}
}

View File

@@ -0,0 +1,15 @@
package @PACKAGE@;
import junit.framework.TestCase;
/**
* This is a simple JUnit test case to ensure that the environment is okay.
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: SanityTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class SanityTest extends TestCase {
public void testSanity() {
assertEquals( "test", "test" );
}
}

View File

@@ -0,0 +1,10 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<jsp:useBean id="now" class="java.util.Date" />
<html>
<body>
Hello world JSP on<fmt:formatDate value="${now}" dateStyle="full" />
</body>
</html>

View File

@@ -0,0 +1,4 @@
maven.genapp.repackage=java,test,test-cactus
maven.genapp.filter=project.xml,src/conf/cactus-web.xml
maven.genapp.default.package=example.web

View File

@@ -0,0 +1,6 @@
target
.classpath
.project
*.log
build.xml
build.properties

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
<preGoal name="java:compile">
<mkdir dir="target\xdoclet\webdoclet\WEB-INF" />
<attainGoal name="xdoclet:webdoclet" />
</preGoal>
</project>

View File

@@ -0,0 +1,9 @@
maven.xdoc.date=left
maven.eclipse.classpath.include=src/test-cactus
maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet
maven.xdoclet.webdoclet.0=true
maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.0.mergeDir=src/merge
maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge
cactus.src.mergewebxml = src/conf/cactus-web.xml

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- the version of maven's project object model -->
<pomVersion>3</pomVersion>
<!-- a unique name for this project -->
<id>@ID@</id>
<groupId>@ID@</groupId>
<!-- a short but descriptive name for the project -->
<name>@NAME@</name>
<!-- The version of the project under development, e.g.
1.1, 1.2, 2.0-SNAPSHOT -->
<currentVersion>1.0</currentVersion>
<!-- details about the organization that 'owns' the project -->
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<!-- the year the project started -->
<inceptionYear>2004</inceptionYear>
<package>@PACKAGE@</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>A collection of example projects showing how to use maven in different situations</description>
<!-- a short description of what the project does -->
<shortDescription>How to use maven in different situations</shortDescription>
<!-- the project home page -->
<url>http://maven.apache.org/reference/plugins/examples/</url>
<issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>
<distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
<!-- the version control repository and http url for online access
the connection element has the form:
scm:<system>:<system specific connection string> -->
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/examples</connection>
<url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>
</repository>
<!-- any mailing lists for the project -->
<mailingLists/>
<!-- who the developers are for the project -->
<developers>
</developers>
<!-- jar files the project is dependent on -->
<dependencies>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6dev-20040115</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- XDoclet dependencies -->
<dependency>
<id>xdoclet</id>
<version>1.2</version>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-web-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-ejb-module</artifactId>
<version>1.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<version>1.0.2</version>
<url>http://xdoclet.sf.net/</url>
</dependency>
<!-- HttpUnit dependencies -->
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.5.4</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
<dependency>
<groupId>jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>4aug2000r7-dev</version>
<properties>
<cactus.bundle>true</cactus.bundle>
</properties>
</dependency>
</dependencies>
<build>
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/NaughtyTest.java</exclude>
</excludes>
</unitTest>
<resources>
<resource>
<directory>src/conf</directory>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,2 @@
# Sample app properties.
foo=bar

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>

View File

@@ -0,0 +1,35 @@
package @PACKAGE@;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This is a sample servlet, typically you would not use this, but it is useful
* for testing the sanity of your web application configuration.
*
* @web.servlet name="HelloWorld"
* @web.servlet-mapping url-pattern="/HelloWorld"
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HelloWorldServlet.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HelloWorldServlet extends HttpServlet {
/**
* This prints out the standard "Hello world" message with a date stamp.
*
* @param request
* the HTTP request object
* @param response
* the HTTP response object
* @throws IOException
* thrown when there is a problem getting the writer
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException {
response.getWriter().println("Hello world on " + new Date());
}
}

View File

@@ -0,0 +1,24 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebResponse;
import @PACKAGE@.HelloWorldServlet;
/**
* This tests that the HelloWorld servlet is functioning
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HelloWorldServletTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HelloWorldServletTest extends ServletTestCase {
public void testHelloWorld() throws Exception {
HelloWorldServlet servlet = new HelloWorldServlet();
servlet.doGet(request,response);
}
public void endHelloWorld(WebResponse response) {
assertTrue(response.getText().startsWith("Hello world on"));
}
}

View File

@@ -0,0 +1,52 @@
package @PACKAGE@;
import org.apache.cactus.ServletTestCase;
import com.meterware.httpunit.WebConversation;
/**
* This tests the system using the HttpUnit
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: HttpUnitTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class HttpUnitTest extends ServletTestCase {
/**
* This tests if the Hello World servlet provides the correct output
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testHelloWorldServlet() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/HelloWorld"));
assertTrue(wc.getCurrentPage().getText().startsWith("Hello world on"));
}
/**
* This tests if the Hello World JSP provides the correct output
*
* @throws Exception
* thrown when there is a problem with the test
*/
public void testHelloWorldJsp() throws Exception {
WebConversation wc = new WebConversation();
wc.getResponse(requestUrl("/sample.jsp"));
assertTrue(wc.getCurrentPage().getText().startsWith("Hello world JSP on"));
}
/**
* This is a helper method to create the URL string for the initial web
* conversation request
*
* @param relativeUrl
* the relative URL including the leading"/"
* @return the context url with the relative URL appended to it
*/
private String requestUrl(String relativeUrl) {
StringBuffer url = request.getRequestURL();
url.delete(url.lastIndexOf("/"), url.length());
url.append(relativeUrl);
return url.toString();
}
}

View File

@@ -0,0 +1,15 @@
package @PACKAGE@;
import junit.framework.TestCase;
/**
* This is a simple JUnit test case to ensure that the environment is okay.
*
* @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
* @version $Id: SanityTest.java,v 1.1 2004/02/27 06:22:27 evenisse Exp $
*/
public class SanityTest extends TestCase {
public void testSanity() {
assertEquals( "test", "test" );
}
}

View File

@@ -0,0 +1 @@
Hello world JSP on <%= new java.util.Date() %>

View File

@@ -0,0 +1,4 @@
maven.genapp.repackage=java,test,test-cactus
maven.genapp.filter=project.xml,src/conf/cactus-web.xml
maven.genapp.default.package=example.web