jmitchell 2003/03/06 21:31:30
Modified: src/test/org/apache/struts/taglib SimpleBeanForTesting.java
src/test/org/apache/struts/taglib/bean TestParameterTag.java
src/test/org/apache/struts/taglib/html TestErrorsTag1.java
TestErrorsTag2.java
src/test/org/apache/struts/taglib/logic
TestGreaterEqualTag.java TestGreaterThanTag.java
TestLessEqualTag.java TestLessThanTag.java
TestPresentTag.java
web/test/test/org/apache/struts/taglib/bean
TestParameterTag.jsp
Log:
copyright and other needed additions for tests
Revision Changes Path
1.4 +52 -16
jakarta-struts/src/test/org/apache/struts/taglib/SimpleBeanForTesting.java
Index: SimpleBeanForTesting.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/SimpleBeanForTesting.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SimpleBeanForTesting.java 28 Feb 2003 01:11:32 -0000 1.3
+++ SimpleBeanForTesting.java 7 Mar 2003 05:31:30 -0000 1.4
@@ -60,39 +60,43 @@
import java.util.List;
import java.util.Map;
+import org.apache.struts.action.ActionForm;
+
/**
* Simple bean for unit tests.
*
* @author James Mitchell
*/
-public class SimpleBeanForTesting {
- public SimpleBeanForTesting(){
+public class SimpleBeanForTesting extends ActionForm {
+ public SimpleBeanForTesting() {
super();
}
- public SimpleBeanForTesting(List lst){
+ public SimpleBeanForTesting(List lst) {
this.lst = lst;
}
- public SimpleBeanForTesting(boolean checked){
+ public SimpleBeanForTesting(boolean checked) {
this.checked = checked;
}
- public SimpleBeanForTesting(Boolean checked){
+ public SimpleBeanForTesting(Boolean checked) {
this.checkedWrapper = checkedWrapper;
}
- public SimpleBeanForTesting(Map map){
+ public SimpleBeanForTesting(Map map) {
this.map = map;
}
- public SimpleBeanForTesting(String string){
+ public SimpleBeanForTesting(String string) {
this.string = string;
}
- public SimpleBeanForTesting(Integer integerValue){
+ public SimpleBeanForTesting(Integer integerValue) {
this.integerValue = integerValue;
}
- private String string;
+ private String string;
private Integer integerValue;
private Double doubleValue;
private List lst;
private Map map;
+ private String x;
+ private String y;
private Object nestedObject;
private Object[] array;
private Enumeration enumeration;
@@ -102,14 +106,14 @@
//Copied right from the FAQ
private String strAry[] =
- { "String 0", "String 1", "String 2", "String 3", "String 4" };
+ { "String 0", "String 1", "String 2", "String 3", "String 4" };
- public String getStringIndexed(int index) {
- return (strAry[index]);
- }
- public void setStringIndexed(int index, String value){
- strAry[index] = value;
- }
+ public String getStringIndexed(int index) {
+ return (strAry[index]);
+ }
+ public void setStringIndexed(int index, String value) {
+ strAry[index] = value;
+ }
/**
* Returns the lst.
@@ -301,6 +305,38 @@
*/
public void setCheckedWrapper(Boolean checkedWrapper) {
this.checkedWrapper = checkedWrapper;
+ }
+
+ /**
+ * Returns the x.
+ * @return String
+ */
+ public String getX() {
+ return x;
+ }
+
+ /**
+ * Returns the y.
+ * @return String
+ */
+ public String getY() {
+ return y;
+ }
+
+ /**
+ * Sets the x.
+ * @param x The x to set
+ */
+ public void setX(String x) {
+ this.x = x;
+ }
+
+ /**
+ * Sets the y.
+ * @param y The y to set
+ */
+ public void setY(String y) {
+ this.y = y;
}
}
1.4 +5 -1
jakarta-struts/src/test/org/apache/struts/taglib/bean/TestParameterTag.java
Index: TestParameterTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/bean/TestParameterTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestParameterTag.java 6 Mar 2003 02:42:17 -0000 1.3
+++ TestParameterTag.java 7 Mar 2003 05:31:30 -0000 1.4
@@ -61,6 +61,7 @@
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
+import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;
/**
@@ -111,12 +112,15 @@
assertEquals(compare, output);
}
+ public void beginParameterTag(WebRequest webRequest) {
+ webRequest.addParameter("testParam", "Test Value");
+ }
public void testParameterTag() throws IOException, ServletException{
request.setAttribute("runTest", "testParameterTag");
pageContext.forward("/test/org/apache/struts/taglib/bean/TestParameterTag.jsp");
}
public void endParameterTag(WebResponse response){
- formatAndTest(this.getClass().getName(), response.getText());
+ formatAndTest("Test Value", response.getText());
}
public void testParameterTagValue() throws IOException, ServletException{
1.3 +0 -8
jakarta-struts/src/test/org/apache/struts/taglib/html/TestErrorsTag1.java
Index: TestErrorsTag1.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestErrorsTag1.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestErrorsTag1.java 6 Mar 2003 02:41:11 -0000 1.2
+++ TestErrorsTag1.java 7 Mar 2003 05:31:30 -0000 1.3
@@ -113,14 +113,6 @@
}
}
- private void formatAndTest(String compare, String output) {
- //fix for introduced carriage return / line feeds
- output = output.replaceAll("\r","");
- output = output.replaceAll("\n","");
- output = output.trim();
- assertEquals(compare, output);
- }
-
/*
* Testing ErrorsTag.
*/
1.3 +0 -7
jakarta-struts/src/test/org/apache/struts/taglib/html/TestErrorsTag2.java
Index: TestErrorsTag2.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestErrorsTag2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestErrorsTag2.java 6 Mar 2003 02:41:11 -0000 1.2
+++ TestErrorsTag2.java 7 Mar 2003 05:31:30 -0000 1.3
@@ -113,13 +113,6 @@
}
}
- private void formatAndTest(String compare, String output) {
- //fix for introduced carriage return / line feeds
- output = output.replaceAll("\r","");
- output = output.replaceAll("\n","");
- output = output.trim();
- assertEquals(compare, output);
- }
/*
* Testing ErrorsTag.
1.2 +1 -1
jakarta-struts/src/test/org/apache/struts/taglib/logic/TestGreaterEqualTag.java
Index: TestGreaterEqualTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/logic/TestGreaterEqualTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestGreaterEqualTag.java 7 Feb 2003 00:32:06 -0000 1.1
+++ TestGreaterEqualTag.java 7 Mar 2003 05:31:30 -0000 1.2
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.4 +1 -1
jakarta-struts/src/test/org/apache/struts/taglib/logic/TestGreaterThanTag.java
Index: TestGreaterThanTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/logic/TestGreaterThanTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestGreaterThanTag.java 22 Feb 2003 03:25:16 -0000 1.3
+++ TestGreaterThanTag.java 7 Mar 2003 05:31:30 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1
jakarta-struts/src/test/org/apache/struts/taglib/logic/TestLessEqualTag.java
Index: TestLessEqualTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/logic/TestLessEqualTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestLessEqualTag.java 7 Feb 2003 00:32:06 -0000 1.1
+++ TestLessEqualTag.java 7 Mar 2003 05:31:30 -0000 1.2
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1
jakarta-struts/src/test/org/apache/struts/taglib/logic/TestLessThanTag.java
Index: TestLessThanTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/logic/TestLessThanTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestLessThanTag.java 7 Feb 2003 00:32:06 -0000 1.1
+++ TestLessThanTag.java 7 Mar 2003 05:31:30 -0000 1.2
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.14 +1 -1
jakarta-struts/src/test/org/apache/struts/taglib/logic/TestPresentTag.java
Index: TestPresentTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/logic/TestPresentTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TestPresentTag.java 6 Feb 2003 04:38:31 -0000 1.13
+++ TestPresentTag.java 7 Mar 2003 05:31:30 -0000 1.14
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -14
jakarta-struts/web/test/test/org/apache/struts/taglib/bean/TestParameterTag.jsp
Index: TestParameterTag.jsp
===================================================================
RCS file:
/home/cvs/jakarta-struts/web/test/test/org/apache/struts/taglib/bean/TestParameterTag.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestParameterTag.jsp 22 Feb 2003 02:57:36 -0000 1.1
+++ TestParameterTag.jsp 7 Mar 2003 05:31:30 -0000 1.2
@@ -2,21 +2,8 @@
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
-<%
- /* There's not really a clean way to test parameter with Cactus tests.
- * I went with what worked for me.
- * The URL used to call these tests have the following parameters:
- *
- * Cactus_TestMethod=testParameterTag
- * Cactus_TestClass=org.apache.struts.taglib.bean.TestParameterTag
- * Cactus_AutomaticSession=true
- * Cactus_Service=CALL_TEST
- **/
-%>
-
-
<logic:equal name="runTest" value="testParameterTag">
- <bean:parameter id="PAGE_KEY" name="Cactus_TestClass"/>
+ <bean:parameter id="PAGE_KEY" name="testParam"/>
</logic:equal>
<logic:equal name="runTest" value="testParameterTagValue">
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]