vmassol 2003/10/29 09:55:14
Modified: integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample
TestSampleBodyTag.java TestHttpUnitIntegration.java
TestSampleServlet.java TestSampleFilter.java
Log:
Applied Cactus coding style
Revision Changes Path
1.2 +26 -46
jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java
Index: TestSampleBodyTag.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleBodyTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSampleBodyTag.java 29 Oct 2003 17:35:11 -0000 1.1
+++ TestSampleBodyTag.java 29 Oct 2003 17:55:14 -0000 1.2
@@ -1,9 +1,9 @@
-package org.apache.maven.cactus.sample;
-
-/* ====================================================================
+/*
+ * ====================================================================
+ *
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
+ * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
+ * Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -53,15 +53,12 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * ====================================================================
*/
+package org.apache.maven.cactus.sample;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTag;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.cactus.JspTestCase;
import org.apache.cactus.WebResponse;
@@ -74,39 +71,15 @@
*/
public class TestSampleBodyTag extends JspTestCase
{
- private SampleBodyTag tag;
- private BodyContent tagContent;
-
/**
- * Defines the testcase name for JUnit.
- *
- * @param theName the testcase's name.
+ * Tag to test.
*/
- public TestSampleBodyTag(String theName)
- {
- super(theName);
- }
-
- /**
- * Start the tests.
- *
- * @param theArgs the arguments. Not used
- */
- public static void main(String[] theArgs)
- {
- junit.swingui.TestRunner.main(
- new String[] { TestSampleBodyTag.class.getName() });
- }
+ private SampleBodyTag tag;
/**
- * @return a test suite (<code>TestSuite</code>) that includes all methods
- * starting with "test"
+ * Tag body content for the test.
*/
- public static Test suite()
- {
- // All methods starting with "test" will be executed in the test suite.
- return new TestSuite(TestSampleBodyTag.class);
- }
+ private BodyContent tagContent;
/**
* In addition to creating the tag instance and adding the pageContext to
@@ -127,6 +100,8 @@
/**
* Sets the replacement target and replacement String on the tag, then calls
* doAfterBody(). Most of the assertion work is done in endReplacement().
+ *
+ * @exception Exception on error
*/
public void testReplacement() throws Exception
{
@@ -146,6 +121,9 @@
assertEquals(BodyTag.SKIP_BODY, result);
}
+ /**
+ * @see TestCase#tearDown()
+ */
public void tearDown()
{
//necessary for tag to output anything on most servlet engines.
@@ -155,6 +133,8 @@
/**
* Verifies that the target String has indeed been replaced in the tag's
* body.
+ *
+ * @param theResponse the response from the server side.
*/
public void endReplacement(WebResponse theResponse)
{
1.2 +15 -15
jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestHttpUnitIntegration.java
Index: TestHttpUnitIntegration.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestHttpUnitIntegration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestHttpUnitIntegration.java 29 Oct 2003 17:35:11 -0000 1.1
+++ TestHttpUnitIntegration.java 29 Oct 2003 17:55:14 -0000 1.2
@@ -1,9 +1,9 @@
-package org.apache.maven.cactus.sample;
-
-/* ====================================================================
+/*
+ * ====================================================================
+ *
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
+ * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
+ * Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -53,8 +53,8 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * ====================================================================
*/
+package org.apache.maven.cactus.sample;
import java.io.IOException;
import java.io.PrintWriter;
1.2 +41 -22
jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleServlet.java
Index: TestSampleServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSampleServlet.java 29 Oct 2003 17:35:11 -0000 1.1
+++ TestSampleServlet.java 29 Oct 2003 17:55:14 -0000 1.2
@@ -1,9 +1,9 @@
-package org.apache.maven.cactus.sample;
-
-/* ====================================================================
+/*
+ * ====================================================================
+ *
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
+ * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
+ * Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -53,19 +53,25 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * ====================================================================
*/
+package org.apache.maven.cactus.sample;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
+/**
+ * Tests of the <code>SampleServlet</code> Servlet class.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
+ *
+ * @version $Id$
+ */
public class TestSampleServlet extends ServletTestCase
{
- public TestSampleServlet(String testName)
- {
- super(testName);
- }
-
+ /**
+ * Verify that <code>isAuthenticated</code> works when the user is
+ * authenticated.
+ */
public void testIsAuthenticatedAuthenticated()
{
SampleServlet servlet = new SampleServlet();
@@ -75,6 +81,10 @@
assertTrue(servlet.isAuthenticated(request));
}
+ /**
+ * Verify that <code>isAuthenticated</code> works when the user is
+ * not authenticated.
+ */
public void testIsAuthenticatedNotAuthenticated()
{
SampleServlet servlet = new SampleServlet();
@@ -82,16 +92,25 @@
assertTrue(!servlet.isAuthenticated(request));
}
- public void beginIsAuthenticatedNoSession(WebRequest request)
+ /**
+ * Verify that <code>isAuthenticated</code> works when there is no
+ * HTTP Session.
+ *
+ * @param theRequest the Cactus request object
+ */
+ public void beginIsAuthenticatedNoSession(WebRequest theRequest)
{
- request.setAutomaticSession(false);
+ theRequest.setAutomaticSession(false);
}
+ /**
+ * Verify that <code>isAuthenticated</code> works when there is no
+ * HTTP Session.
+ */
public void testIsAuthenticatedNoSession()
{
SampleServlet servlet = new SampleServlet();
assertTrue(!servlet.isAuthenticated(request));
}
-
}
1.2 +16 -16
jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleFilter.java
Index: TestSampleFilter.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/maven/sample/src/test-cactus/org/apache/maven/cactus/sample/TestSampleFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestSampleFilter.java 29 Oct 2003 17:35:11 -0000 1.1
+++ TestSampleFilter.java 29 Oct 2003 17:55:14 -0000 1.2
@@ -1,9 +1,9 @@
-package org.apache.maven.cactus.sample;
-
-/* ====================================================================
+/*
+ * ====================================================================
+ *
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
+ * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
+ * Foundation" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -53,8 +53,8 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * ====================================================================
*/
+package org.apache.maven.cactus.sample;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -99,7 +99,7 @@
public static void main(String[] theArgs)
{
junit.swingui.TestRunner.main(
- new String[] { TestSampleFilter.class.getName() });
+ new String[] {TestSampleFilter.class.getName()});
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]