You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by jm...@apache.org on 2003/03/07 06:41:28 UTC
cvs commit: jakarta-struts/web/test/test/org/apache/struts/taglib/html TestImageTag1.jsp TestImageTag2.jsp TestImageTag3.jsp TestImageTag4.jsp
jmitchell 2003/03/06 21:41:28
Added: src/test/org/apache/struts/taglib/html TestImageTag1.java
TestImageTag2.java TestImageTag3.java
TestImageTag4.java
web/test/test/org/apache/struts/taglib/html
TestImageTag1.jsp TestImageTag2.jsp
TestImageTag3.jsp TestImageTag4.jsp
Log:
Adding more tests
Revision Changes Path
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag1.java
Index: TestImageTag1.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", 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 apache@apache.org.
*
* 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
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.ImageTag</code> class.
*
* @author James Mitchell
*/
public class TestImageTag1 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImageTag1(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestImageTag1.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestImageTag1.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestImageTag1.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImageTag.
*/
//--------Testing attributes using page------
public void testImagePageAccesskey(){
runMyTest("testImagePageAccesskey", "");
}
public void testImagePageAlign(){
runMyTest("testImagePageAlign", "");
}
public void testImagePageAlt(){
runMyTest("testImagePageAlt", "");
}
public void testImagePageAltKeyDefaultBundle(){
runMyTest("testImagePageAltKeyDefaultBundle", "");
}
public void testImagePageAltKeyAlternateBundle(){
runMyTest("testImagePageAltKeyAlternateBundle", "");
}
public void testImagePageAltKeyDefaultBundle_fr(){
runMyTest("testImagePageAltKeyDefaultBundle_fr", "fr");
}
public void testImagePageAltKeyAlternateBundle_fr(){
runMyTest("testImagePageAltKeyAlternateBundle_fr", "fr");
}
public void testImagePageBorder(){
runMyTest("testImagePageBorder", "");
}
public void testImagePageLocale(){
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
runMyTest("testImagePageLocale", "");
}
public void testImagePageOnblur(){
runMyTest("testImagePageOnblur", "");
}
public void testImagePageOnchange(){
runMyTest("testImagePageOnchange", "");
}
public void testImagePageOnclick(){
runMyTest("testImagePageOnclick", "");
}
public void testImagePageOndblclick(){
runMyTest("testImagePageOndblclick", "");
}
public void testImagePageOnfocus(){
runMyTest("testImagePageOnfocus", "");
}
public void testImagePageOnkeydown(){
runMyTest("testImagePageOnkeydown", "");
}
public void testImagePageOnkeypress(){
runMyTest("testImagePageOnkeypress", "");
}
public void testImagePageOnkeyup(){
runMyTest("testImagePageOnkeyup", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag2.java
Index: TestImageTag2.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", 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 apache@apache.org.
*
* 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
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.ImageTag</code> class.
*
* @author James Mitchell
*/
public class TestImageTag2 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImageTag2(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestImageTag2.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestImageTag2.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestImageTag2.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImageTag.
*/
//--------Testing attributes using page------
public void testImagePageOnmousedown(){
runMyTest("testImagePageOnmousedown", "");
}
public void testImagePageOnmousemove(){
runMyTest("testImagePageOnmousemove", "");
}
public void testImagePageOnmouseout(){
runMyTest("testImagePageOnmouseout", "");
}
public void testImagePageOnmouseover(){
runMyTest("testImagePageOnmouseover", "");
}
public void testImagePageOnmouseup(){
runMyTest("testImagePageOnmouseup", "");
}
public void testImagePageProperty(){
runMyTest("testImagePageProperty", "");
}
public void testImagePageStyle(){
runMyTest("testImagePageStyle", "");
}
public void testImagePageStyleClass(){
runMyTest("testImagePageStyleClass", "");
}
public void testImagePageStyleId(){
runMyTest("testImagePageStyleId", "");
}
public void testImagePageTabindex(){
runMyTest("testImagePageTabindex", "");
}
public void testImagePageTitle(){
runMyTest("testImagePageTitle", "");
}
public void testImagePageTitleKeyDefaultBundle(){
runMyTest("testImagePageTitleKeyDefaultBundle", "");
}
public void testImagePageTitleKeyAlternateBundle(){
runMyTest("testImagePageTitleKeyAlternateBundle", "");
}
public void testImagePageTitleKeyDefaultBundle_fr(){
runMyTest("testImagePageTitleKeyDefaultBundle_fr", "fr");
}
public void testImagePageTitleKeyAlterateBundle_fr(){
runMyTest("testImagePageTitleKeyAlterateBundle_fr", "fr");
}
public void testImagePageIndexedArray(){
ArrayList lst = new ArrayList();
lst.add("Test Message");
pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedArray", "");
}
public void testImagePageIndexedArrayProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
ArrayList lst = new ArrayList();
lst.add("Test Message");
sbft.setList(lst);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedArrayProperty", "");
}
public void testImagePageIndexedMap(){
HashMap map = new HashMap();
map.put("tst1", "Test Message");
pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedMap", "");
}
public void testImagePageIndexedMapProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
HashMap map = new HashMap();
map.put("tst1", "Test Message");
sbft.setMap(map);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedMapProperty", "");
}
public void testImagePageIndexedEnumeration(){
StringTokenizer st = new StringTokenizer("Test Message");
pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedEnumeration", "");
}
public void testImagePageIndexedEnumerationProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
StringTokenizer st = new StringTokenizer("Test Message");
sbft.setEnumeration(st);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageIndexedEnumerationProperty", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag3.java
Index: TestImageTag3.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", 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 apache@apache.org.
*
* 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
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.ImageTag</code> class.
*
* @author James Mitchell
*/
public class TestImageTag3 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImageTag3(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestImageTag3.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestImageTag3.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestImageTag3.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImageTag.
*/
//--------Testing attributes using page------
public void testImagePageKeyAccesskey(){
runMyTest("testImagePageKeyAccesskey", "");
}
public void testImagePageKeyAlign(){
runMyTest("testImagePageKeyAlign", "");
}
public void testImagePageKeyAlt(){
runMyTest("testImagePageKeyAlt", "");
}
public void testImagePageKeyAltKeyDefaultBundle(){
runMyTest("testImagePageKeyAltKeyDefaultBundle", "");
}
public void testImagePageKeyAltKeyAlternateBundle(){
runMyTest("testImagePageKeyAltKeyAlternateBundle", "");
}
public void testImagePageKeyAltKeyDefaultBundle_fr(){
runMyTest("testImagePageKeyAltKeyDefaultBundle_fr", "fr");
}
public void testImagePageKeyAltKeyAlternateBundle_fr(){
runMyTest("testImagePageKeyAltKeyAlternateBundle_fr", "fr");
}
public void testImagePageKeyBorder(){
runMyTest("testImagePageKeyBorder", "");
}
public void testImagePageKeyLocaleDefaultBundle(){
runMyTest("testImagePageKeyLocaleDefaultBundle", "");
}
public void testImagePageKeyLocaleAlternateBundle(){
runMyTest("testImagePageKeyLocaleAlternateBundle", "");
}
public void testImagePageKeyLocaleDefaultBundle_fr(){
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
runMyTest("testImagePageKeyLocaleDefaultBundle_fr", "");
}
public void testImagePageKeyLocaleAlternateBundle_fr(){
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
runMyTest("testImagePageKeyLocaleAlternateBundle_fr", "");
}
public void testImagePageKeyOnblur(){
runMyTest("testImagePageKeyOnblur", "");
}
public void testImagePageKeyOnchange(){
runMyTest("testImagePageKeyOnchange", "");
}
public void testImagePageKeyOnclick(){
runMyTest("testImagePageKeyOnclick", "");
}
public void testImagePageKeyOndblclick(){
runMyTest("testImagePageKeyOndblclick", "");
}
public void testImagePageKeyOnfocus(){
runMyTest("testImagePageKeyOnfocus", "");
}
public void testImagePageKeyOnkeydown(){
runMyTest("testImagePageKeyOnkeydown", "");
}
public void testImagePageKeyOnkeypress(){
runMyTest("testImagePageKeyOnkeypress", "");
}
public void testImagePageKeyOnkeyup(){
runMyTest("testImagePageKeyOnkeyup", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag4.java
Index: TestImageTag4.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* 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 acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", 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 apache@apache.org.
*
* 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
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.taglib.html;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.servlet.jsp.PageContext;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.JspTestCase;
import org.apache.struts.Globals;
import org.apache.struts.taglib.SimpleBeanForTesting;
/**
* Suite of unit tests for the
* <code>org.apache.struts.taglib.bean.ImageTag</code> class.
*
* @author James Mitchell
*/
public class TestImageTag4 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImageTag4(String theName) {
super(theName);
}
/**
* Start the tests.
*
* @param theArgs the arguments. Not used
*/
public static void main(String[] theArgs) {
junit.awtui.TestRunner.main(new String[] {TestImageTag4.class.getName()});
}
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
public static Test suite() {
// All methods starting with "test" will be executed in the test suite.
return new TestSuite(TestImageTag4.class);
}
private void runMyTest(String whichTest, String locale){
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
request.setAttribute("runTest", whichTest);
try {
pageContext.forward("/test/org/apache/struts/taglib/html/TestImageTag4.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImageTag.
*/
//--------Testing attributes using page------
public void testImagePageKeyOnmousedown(){
runMyTest("testImagePageKeyOnmousedown", "");
}
public void testImagePageKeyOnmousemove(){
runMyTest("testImagePageKeyOnmousemove", "");
}
public void testImagePageKeyOnmouseout(){
runMyTest("testImagePageKeyOnmouseout", "");
}
public void testImagePageKeyOnmouseover(){
runMyTest("testImagePageKeyOnmouseover", "");
}
public void testImagePageKeyOnmouseup(){
runMyTest("testImagePageKeyOnmouseup", "");
}
public void testImagePageKeyProperty(){
runMyTest("testImagePageKeyProperty", "");
}
public void testImagePageKeyStyle(){
runMyTest("testImagePageKeyStyle", "");
}
public void testImagePageKeyStyleClass(){
runMyTest("testImagePageKeyStyleClass", "");
}
public void testImagePageKeyStyleId(){
runMyTest("testImagePageKeyStyleId", "");
}
public void testImagePageKeyTabindex(){
runMyTest("testImagePageKeyTabindex", "");
}
public void testImagePageKeyTitle(){
runMyTest("testImagePageKeyTitle", "");
}
public void testImagePageKeyTitleKeyDefaultBundle(){
runMyTest("testImagePageKeyTitleKeyDefaultBundle", "");
}
public void testImagePageKeyTitleKeyAlternateBundle(){
runMyTest("testImagePageKeyTitleKeyAlternateBundle", "");
}
public void testImagePageKeyTitleKeyDefaultBundle_fr(){
runMyTest("testImagePageKeyTitleKeyDefaultBundle_fr", "fr");
}
public void testImagePageKeyTitleKeyAlterateBundle_fr(){
runMyTest("testImagePageKeyTitleKeyAlterateBundle_fr", "fr");
}
public void testImagePageKeyIndexedArray(){
ArrayList lst = new ArrayList();
lst.add("Test Message");
pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedArray", "");
}
public void testImagePageKeyIndexedArrayProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
ArrayList lst = new ArrayList();
lst.add("Test Message");
sbft.setList(lst);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedArrayProperty", "");
}
public void testImagePageKeyIndexedMap(){
HashMap map = new HashMap();
map.put("tst1", "Test Message");
pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedMap", "");
}
public void testImagePageKeyIndexedMapProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
HashMap map = new HashMap();
map.put("tst1", "Test Message");
sbft.setMap(map);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedMapProperty", "");
}
public void testImagePageKeyIndexedEnumeration(){
StringTokenizer st = new StringTokenizer("Test Message");
pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedEnumeration", "");
}
public void testImagePageKeyIndexedEnumerationProperty(){
SimpleBeanForTesting sbft = new SimpleBeanForTesting();
StringTokenizer st = new StringTokenizer("Test Message");
sbft.setEnumeration(st);
pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImagePageKeyIndexedEnumerationProperty", "");
}
}
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestImageTag1.jsp
Index: TestImageTag1.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!-- --------Testing attributes using page------ -->
<logic:equal name="runTest" value="testImagePageAccesskey">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" accesskey="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" accesskey="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAlign">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" align="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" align="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAlt">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" alt="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAltKeyDefaultBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAltKeyAlternateBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAltKeyDefaultBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageAltKeyAlternateBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageBorder">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" border="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" border="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled1">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="true"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="true">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled2">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="True"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="True">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled3">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="TRUE"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="TRUE">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled4">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="false"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="false">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled5">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="False"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="False">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageDisabled6">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" disabled="FALSE"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" disabled="FALSE">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageLocale">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" locale="secret locale" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnblur">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onblur="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onblur="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnchange">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onchange="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onchange="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onclick="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onclick="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOndblclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" ondblclick="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" ondblclick="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnfocus">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onfocus="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onfocus="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnkeydown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onkeydown="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onkeydown="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnkeypress">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onkeypress="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onkeypress="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnkeyup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onkeyup="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onkeyup="XXX">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestImageTag2.jsp
Index: TestImageTag2.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!-- --------Testing attributes using page------ -->
<logic:equal name="runTest" value="testImagePageOnmousedown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onmousedown="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onmousedown="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnmousemove">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onmousemove="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onmousemove="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnmouseout">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onmouseout="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onmouseout="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnmouseover">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onmouseover="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onmouseover="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageOnmouseup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" onmouseup="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" onmouseup="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" property=""/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageStyle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" style="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" style="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageStyleClass">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" styleClass="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" class="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageStyleId">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" styleId="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" id="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTabindex">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" tabindex="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" tabindex="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTitle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" title="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" title="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTitleKeyDefaultBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" title="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTitleKeyAlternateBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" titleKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" title="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTitleKeyDefaultBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" title="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageTitleKeyAlterateBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" titleKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" title="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageValue">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image page="/some/image.gif" value="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/some/image.gif")%>" value="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedArray">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedArrayProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="list">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedMap">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedMapProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="map">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedEnumeration">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
<input type="image" name="[1]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageIndexedEnumerationProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="enumeration">
<html:image page="/some/image.gif" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/some/image.gif")%>">
<input type="image" name="[1]" src="<%=response.encodeURL("/test/some/image.gif")%>">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestImageTag3.jsp
Index: TestImageTag3.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!-- --------Testing attributes using page------ -->
<logic:equal name="runTest" value="testImagePageKeyAccesskey">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" accesskey="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" accesskey="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAlign">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" align="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" align="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAlt">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" alt="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" alt="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAltKeyDefaultBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAltKeyAlternateBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/alternate/myimage.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAltKeyDefaultBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/default/myimage.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyAltKeyAlternateBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/alternate/myimage.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyBorder">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" border="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" border="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled1">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="true"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="true">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled2">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="True"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="True">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled3">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="TRUE"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="TRUE">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled4">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="false"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="false">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled5">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="False"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="False">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyDisabled6">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" disabled="FALSE"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" disabled="FALSE">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyLocaleDefaultBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" locale="secret locale" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyLocaleAlternateBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" locale="secret locale" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/alternate/myimage.gif")%>" alt="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyLocaleDefaultBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" locale="secret locale" altKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/default/myimage.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyLocaleAlternateBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" locale="secret locale" altKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/alternate/myimage.gif")%>" alt="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnblur">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onblur="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onblur="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnchange">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onchange="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onchange="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onclick="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onclick="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOndblclick">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" ondblclick="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" ondblclick="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnfocus">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onfocus="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onfocus="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnkeydown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onkeydown="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onkeydown="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnkeypress">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onkeypress="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onkeypress="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnkeyup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onkeyup="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onkeyup="XXX">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
1.1 jakarta-struts/web/test/test/org/apache/struts/taglib/html/TestImageTag4.jsp
Index: TestImageTag4.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="junit.framework.Assert"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!-- --------Testing attributes using page------ -->
<logic:equal name="runTest" value="testImagePageKeyOnmousedown">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onmousedown="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onmousedown="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnmousemove">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onmousemove="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onmousemove="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnmouseout">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onmouseout="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onmouseout="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnmouseover">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onmouseover="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onmouseover="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyOnmouseup">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" onmouseup="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" onmouseup="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" property=""/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyStyle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" style="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" style="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyStyleClass">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" styleClass="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" class="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyStyleId">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" styleId="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" id="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTabindex">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" tabindex="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" tabindex="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTitle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" title="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" title="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTitleKeyDefaultBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" title="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTitleKeyAlternateBundle">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" titleKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/alternate/myimage.gif")%>" title="Testing Message">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTitleKeyDefaultBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" titleKey="default.bundle.message"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/default/myimage.gif")%>" title="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyTitleKeyAlterateBundle_fr">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="alternate.testing.image" titleKey="alternate.bundle.message" bundle="alternate"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/fr/alternate/myimage.gif")%>" title="Message D'Essai">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyValue">
<bean:define id="TEST_RESULTS" toScope="page">
<html:image pageKey="default.testing.image" value="XXX"/>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>" value="XXX">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedArray">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedArrayProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="list">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedMap">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedMapProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="map">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedEnumeration">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
<input type="image" name="[1]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<logic:equal name="runTest" value="testImagePageKeyIndexedEnumerationProperty">
<bean:define id="TEST_RESULTS" toScope="page">
<logic:iterate id="indivItem" name="lst" property="enumeration">
<html:image pageKey="default.testing.image" indexed="true"/>
</logic:iterate>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
<input type="image" name="[0]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
<input type="image" name="[1]" src="<%=response.encodeURL("/test/images/default/default/myimage.gif")%>">
</bean:define>
</logic:equal>
<%
String expected = "";
String compareTo = "";
if (pageContext.getAttribute("EXPECTED_RESULTS") == null){
throw new JspException("No tests on this page were called. Please verify that you've setup the tests correctly.");
}else{
expected=pageContext.getAttribute("TEST_RESULTS").toString();
}
if (pageContext.getAttribute("TEST_RESULTS") != null){
compareTo=pageContext.getAttribute("EXPECTED_RESULTS").toString();
}
Assert.assertEquals(compareTo, expected);
%>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org