diff --git a/cactus/plugin.jelly b/cactus/plugin.jelly
index a8699a21..ebd9464a 100644
--- a/cactus/plugin.jelly
+++ b/cactus/plugin.jelly
@@ -94,10 +94,13 @@
========================================================================
-->
-
+
+
+
+
-
@@ -105,7 +108,7 @@
-
@@ -113,14 +116,14 @@
-
-
+
@@ -167,12 +170,20 @@
You need to provide a Cactus'ed web.xml to use.
-->
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
@@ -326,7 +337,10 @@
@@ -336,13 +350,13 @@
-
+
+
-
+
diff --git a/cactus/plugin.properties b/cactus/plugin.properties
index 70ef8b98..1fac28b9 100644
--- a/cactus/plugin.properties
+++ b/cactus/plugin.properties
@@ -61,7 +61,7 @@ maven.cactus.port = 8080
maven.cactus.junit.usefile = true
# Location of generated raw test reports
-maven.cactus.test.reportsDirectory = ${maven.cactus.build.dir}/test-reports
+maven.cactus.test.reportsDirectory = ${maven.build.dir}/test-reports
# Define what TestRunner to use. Default is the JUnit text test runner
# (the one used by the Ant task). Valid values are: text, swing
diff --git a/cactus/src/plugin-resources/sample/project.properties b/cactus/src/plugin-resources/sample/project.properties
index 30dd9cf2..432b1afd 100644
--- a/cactus/src/plugin-resources/sample/project.properties
+++ b/cactus/src/plugin-resources/sample/project.properties
@@ -1,4 +1,9 @@
+# Please specify your path to your container
-#maven.cactus.tomcat4x.home = C:/Apps/jakarta-tomcat-4.1.10
+maven.cactus.tomcat4x.home = C:/java/tomcat
#maven.cactus.resin2x.home = C:/Apps/resin-2.1.4
+# Plase specify what container you are testing with
+maven.cactus.container=tomcat-4x
+
+
diff --git a/cactus/src/plugin-resources/sample/project.xml b/cactus/src/plugin-resources/sample/project.xml
index 9dc20fa4..1e2d34ac 100644
--- a/cactus/src/plugin-resources/sample/project.xml
+++ b/cactus/src/plugin-resources/sample/project.xml
@@ -60,12 +60,12 @@
- src/java
+ src/java
src/test
- **/Test*.java
+ **/DummyTest.java
diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java
index b45fe1f3..51f946ea 100644
--- a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java
+++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleBodyTag.java
@@ -69,10 +69,9 @@ import javax.servlet.jsp.tagext.BodyTagSupport;
*
* @author Nicholas Lesiecki
*
- * @version $Id: SampleBodyTag.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
+ * @version $Id: SampleBodyTag.java,v 1.2 2003/02/03 14:08:02 dion Exp $
*/
-public class SampleBodyTag extends BodyTagSupport
-{
+public class SampleBodyTag extends BodyTagSupport {
/**
* The substring to be replaced in the body.
*/
@@ -88,26 +87,23 @@ public class SampleBodyTag extends BodyTagSupport
*
* @param theTarget the substring to be replaced in the body
*/
- public void setTarget(String theTarget)
- {
+ public void setTarget(String theTarget) {
this.target = theTarget;
}
/**
* Sets the substring that will replace the target in the body.
- *
+ *
* @param theReplacement the replacement string
*/
- public void setReplacement(String theReplacement)
- {
+ public void setReplacement(String theReplacement) {
this.replacement = theReplacement;
}
/**
* @see BodyTagSupport#doAfterBody()
*/
- public int doAfterBody() throws JspTagException
- {
+ public int doAfterBody() throws JspTagException {
String contentString = this.bodyContent.getString();
StringBuffer contentBuffer = new StringBuffer(contentString);
@@ -115,8 +111,7 @@ public class SampleBodyTag extends BodyTagSupport
int targetLength = this.target.length();
// while instances of target still exist
- while ((beginIndex = contentString.indexOf(this.target)) > -1)
- {
+ while ((beginIndex = contentString.indexOf(this.target)) > -1) {
int endIndex = beginIndex + targetLength;
contentBuffer.replace(beginIndex, endIndex, this.replacement);
@@ -127,12 +122,9 @@ public class SampleBodyTag extends BodyTagSupport
// write out the changed body
JspWriter pageWriter = this.bodyContent.getEnclosingWriter();
- try
- {
+ try {
pageWriter.write(contentString);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
throw new JspTagException(e.getMessage());
}
@@ -142,8 +134,7 @@ public class SampleBodyTag extends BodyTagSupport
/**
* @see BodyTagSupport#release()
*/
- public void release()
- {
+ public void release() {
this.target = null;
this.replacement = null;
}
diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java
index 03fe72d2..1a6a6f2c 100644
--- a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java
+++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleFilter.java
@@ -76,10 +76,9 @@ import org.apache.maven.cactus.sample.util.GenericResponseWrapper;
*
* @author Vincent Massol
*
- * @version $Id: SampleFilter.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
+ * @version $Id: SampleFilter.java,v 1.2 2003/02/03 14:08:02 dion Exp $
*/
-public class SampleFilter implements Filter
-{
+public class SampleFilter implements Filter {
/**
* We need to save the filter config as the Fitler API does not offer
* a means to get the filter config ... except in the init()
@@ -91,11 +90,10 @@ public class SampleFilter implements Filter
* cycle of the filter.
*
* @param theConfig the filter config
- *
+ *
* @exception ServletException on failure
*/
- public void init(FilterConfig theConfig) throws ServletException
- {
+ public void init(FilterConfig theConfig) throws ServletException {
this.config = theConfig;
}
@@ -107,14 +105,13 @@ public class SampleFilter implements Filter
* @param theResponse the returned HTTP response
* @param theChain the chain of filters extracted from the definition
* given in web.xml by the container.
- *
+ *
* @exception ServletException on failure
* @exception IOException on failure
*/
- public void doFilter(ServletRequest theRequest,
+ public void doFilter(ServletRequest theRequest,
ServletResponse theResponse, FilterChain theChain) throws IOException,
- ServletException
- {
+ ServletException {
OutputStream out = theResponse.getOutputStream();
addHeader(out);
@@ -123,7 +120,7 @@ public class SampleFilter implements Filter
// the response (add the footer). If we did not do this, we would
// get an error saying that the response has already been
// committed.
- GenericResponseWrapper wrapper =
+ GenericResponseWrapper wrapper =
new GenericResponseWrapper((HttpServletResponse) theResponse);
theChain.doFilter(theRequest, wrapper);
@@ -139,15 +136,13 @@ public class SampleFilter implements Filter
* web.xml). Don't write anything if no parameter is defined.
*
* @param theOutputStream the output stream
- *
+ *
* @exception IOException on failure
*/
- protected void addHeader(OutputStream theOutputStream) throws IOException
- {
+ protected void addHeader(OutputStream theOutputStream) throws IOException {
String header = this.config.getInitParameter("header");
- if (header != null)
- {
+ if (header != null) {
theOutputStream.write(header.getBytes());
}
}
@@ -158,15 +153,13 @@ public class SampleFilter implements Filter
* web.xml). Don't write anything if no parameter is defined.
*
* @param theOutputStream the output stream
- *
+ *
* @exception IOException on failure
*/
- protected void addFooter(OutputStream theOutputStream) throws IOException
- {
+ protected void addFooter(OutputStream theOutputStream) throws IOException {
String footer = this.config.getInitParameter("footer");
- if (footer != null)
- {
+ if (footer != null) {
theOutputStream.write(footer.getBytes());
}
}
@@ -175,7 +168,6 @@ public class SampleFilter implements Filter
* Filter un-initialisation. Called by the servlet engine during the life
* cycle of the filter.
*/
- public void destroy()
- {
+ public void destroy() {
}
}
\ No newline at end of file
diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java
index 1ad25086..c722d7a9 100644
--- a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java
+++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/SampleServlet.java
@@ -60,20 +60,37 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-public class SampleServlet extends HttpServlet
-{
- public boolean isAuthenticated(HttpServletRequest request)
- {
+/**
+ * Sample servlet that implements some very simple business logic. The goal is
+ * to provide some functional tests for Cactus and examples for Cactus users.
+ * This servlet simply checks is a user is authenticated
+ *
+ * @author Vincent Massol
+ * @author Eric Pugh
+ *
+ * @version $Id: SampleServlet.java,v 1.2 2003/02/03 14:08:02 dion Exp $
+ */
+
+public class SampleServlet extends HttpServlet {
+
+ /**
+ *Take a request object and return whether the user is authenticated o not.
+ *
+ * @param request the HttpServletRequest object
+ *
+ * @return boolean whether the request is by an authenticated user or not
+ *
+ */
+ public boolean isAuthenticated(HttpServletRequest request) {
HttpSession session = request.getSession(false);
-
- if (session == null)
- {
+
+ if (session == null) {
return false;
}
-
- String authenticationAttribute =
+
+ String authenticationAttribute =
(String) session.getAttribute("authenticated");
-
+
return new Boolean(authenticationAttribute).booleanValue();
}
}
diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java
index 56ef1530..dec1bf95 100644
--- a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java
+++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/FilterServletOutputStream.java
@@ -73,12 +73,11 @@ import javax.servlet.ServletOutputStream;
*
* @author Vincent Massol
*
- * @version $Id: FilterServletOutputStream.java,v 1.1 2003/01/24 03:44:47 jvanzyl Exp $
+ * @version $Id: FilterServletOutputStream.java,v 1.2 2003/02/03 14:08:02 dion Exp $
*
* @see GenericResponseWrapper
*/
-public class FilterServletOutputStream extends ServletOutputStream
-{
+public class FilterServletOutputStream extends ServletOutputStream {
/**
* The stream where all the data will get written to
*/
@@ -90,8 +89,7 @@ public class FilterServletOutputStream extends ServletOutputStream
* @param theOutput the output stream that we wrap in a
* DataOutputStream in order to hold the data
*/
- public FilterServletOutputStream(OutputStream theOutput)
- {
+ public FilterServletOutputStream(OutputStream theOutput) {
stream = new DataOutputStream(theOutput);
}
@@ -100,24 +98,21 @@ public class FilterServletOutputStream extends ServletOutputStream
/**
* @see ServletOutputStream#write(int)
*/
- public void write(int b) throws IOException
- {
+ public void write(int b) throws IOException {
stream.write(b);
}
/**
* @see ServletOutputStream#write(byte[])
*/
- public void write(byte[] b) throws IOException
- {
+ public void write(byte[] b) throws IOException {
stream.write(b);
}
/**
* @see ServletOutputStream#write(byte[], int, int)
*/
- public void write(byte[] b, int off, int len) throws IOException
- {
+ public void write(byte[] b, int off, int len) throws IOException {
stream.write(b, off, len);
}
}
\ No newline at end of file
diff --git a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java
index d0dd68d9..a2d4fe54 100644
--- a/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java
+++ b/cactus/src/plugin-resources/sample/src/java/org/apache/maven/cactus/sample/util/GenericResponseWrapper.java
@@ -77,12 +77,11 @@ import javax.servlet.http.HttpServletResponseWrapper;
*
* @author Vincent Massol
*
- * @version $Id: GenericResponseWrapper.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
+ * @version $Id: GenericResponseWrapper.java,v 1.2 2003/02/03 14:08:02 dion Exp $
*
* @see FilterServletOutputStream
*/
-public class GenericResponseWrapper extends HttpServletResponseWrapper
-{
+public class GenericResponseWrapper extends HttpServletResponseWrapper {
/**
* Holder for the output data
*/
@@ -109,8 +108,7 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper
/**
* @param theResponse the wrapped response object
*/
- public GenericResponseWrapper(HttpServletResponse theResponse)
- {
+ public GenericResponseWrapper(HttpServletResponse theResponse) {
super(theResponse);
this.output = new ByteArrayOutputStream();
}
@@ -120,8 +118,7 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper
/**
* @return the data sent to the output stream
*/
- public byte[] getData()
- {
+ public byte[] getData() {
return output.toByteArray();
}
@@ -130,16 +127,14 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper
/**
* @see HttpServletResponseWrapper#getOutputStream()
*/
- public ServletOutputStream getOutputStream()
- {
+ public ServletOutputStream getOutputStream() {
return new FilterServletOutputStream(this.output);
}
/**
* @see HttpServletResponseWrapper#setContentLength(int)
*/
- public void setContentLength(int theLength)
- {
+ public void setContentLength(int theLength) {
this.contentLength = theLength;
super.setContentLength(theLength);
}
@@ -147,16 +142,14 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper
/**
* @see HttpServletResponseWrapper#getContentLength()
*/
- public int getContentLength()
- {
+ public int getContentLength() {
return this.contentLength;
}
/**
* @see HttpServletResponseWrapper#setContentType(String)
*/
- public void setContentType(String theType)
- {
+ public void setContentType(String theType) {
this.contentType = theType;
super.setContentType(theType);
}
@@ -164,16 +157,14 @@ public class GenericResponseWrapper extends HttpServletResponseWrapper
/**
* @see HttpServletResponseWrapper#getContentType()
*/
- public String getContentType()
- {
+ public String getContentType() {
return this.contentType;
}
/**
* @see HttpServletResponseWrapper#getWriter()
*/
- public PrintWriter getWriter()
- {
+ public PrintWriter getWriter() {
return new PrintWriter(getOutputStream(), true);
}
}
\ No newline at end of file
diff --git a/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java
index 18c75b09..fb4154c7 100644
--- a/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java
+++ b/cactus/src/plugin-resources/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java
@@ -70,10 +70,9 @@ import org.apache.cactus.WebResponse;
*
* @author Nciholas Lesiecki
*
- * @version $Id: TestSampleBodyTag.java,v 1.1 2003/01/24 03:44:46 jvanzyl Exp $
+ * @version $Id: TestSampleBodyTag.java,v 1.2 2003/02/03 14:08:02 dion Exp $
*/
-public class TestSampleBodyTag extends JspTestCase
-{
+public class TestSampleBodyTag extends JspTestCase {
private SampleBodyTag tag;
private BodyContent tagContent;
@@ -92,8 +91,7 @@ public class TestSampleBodyTag extends JspTestCase
*
* @param theArgs the arguments. Not used
*/
- public static void main(String[] theArgs)
- {
+ public static void main(String[] theArgs) {
junit.swingui.TestRunner.main(
new String[] { TestSampleBodyTag.class.getName() });
}
@@ -102,8 +100,7 @@ public class TestSampleBodyTag extends JspTestCase
* @return a test suite (TestSuite) that includes all methods
* starting with "test"
*/
- public static Test suite()
- {
+ public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestSampleBodyTag.class);
}
@@ -112,8 +109,7 @@ public class TestSampleBodyTag extends JspTestCase
* In addition to creating the tag instance and adding the pageContext to
* it, this method creates a BodyContent object and passes it to the tag.
*/
- public void setUp()
- {
+ public void setUp() {
this.tag = new SampleBodyTag();
this.tag.setPageContext(this.pageContext);
@@ -161,10 +157,10 @@ public class TestSampleBodyTag extends JspTestCase
String content = theResponse.getText();
assertTrue("Response should have contained the ["
- + "replacement is now replacement] string",
+ + "replacement is now replacement] string",
content.indexOf("replacement is now replacement") > -1);
assertTrue("Response should have contained the ["
- + "replacement_replacement] string",
+ + "replacement_replacement] string",
content.indexOf("replacement") > -1);
}
}
\ No newline at end of file