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/12 01:31:01 UTC
cvs commit: jakarta-struts/src/test/org/apache/struts/taglib/html TestImgTag5.java TestImgTag5a.java TestImgTag6.java TestImgTag7.java TestImgTag7a.java TestImgTag8.java
jmitchell 2003/03/11 16:31:01
Added: src/test/org/apache/struts/taglib/html TestImgTag5.java
TestImgTag5a.java TestImgTag6.java TestImgTag7.java
TestImgTag7a.java TestImgTag8.java
Log:
New tests
Revision Changes Path
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag5.java
Index: TestImgTag5.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag5.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.HashMap;
import java.util.Locale;
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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag5 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag5(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[] {TestImgTag5.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(TestImgTag5.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/TestImgTag5.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcAlign1(){
runMyTest("testImgSrcAlign1", "");
}
public void testImgSrcAlign2(){
runMyTest("testImgSrcAlign2", "");
}
public void testImgSrcAlign3(){
runMyTest("testImgSrcAlign3", "");
}
public void testImgSrcAlign4(){
runMyTest("testImgSrcAlign4", "");
}
public void testImgSrcAlign5(){
runMyTest("testImgSrcAlign5", "");
}
public void testImgSrcAlign6(){
runMyTest("testImgSrcAlign6", "");
}
public void testImgSrcAlign7(){
runMyTest("testImgSrcAlign7", "");
}
public void testImgSrcAlign8(){
runMyTest("testImgSrcAlign8", "");
}
public void testImgSrcAlign9(){
runMyTest("testImgSrcAlign9", "");
}
public void testImgSrcAlign10(){
runMyTest("testImgSrcAlign10", "");
}
public void testImgSrcAlt(){
runMyTest("testImgSrcAlt", "");
}
public void testImgSrcAltKeyDefaultBundle(){
runMyTest("testImgSrcAltKeyDefaultBundle", "");
}
public void testImgSrcAltKeyAlternateBundle(){
runMyTest("testImgSrcAltKeyAlternateBundle", "");
}
public void testImgSrcAltKeyDefaultBundle_fr(){
runMyTest("testImgSrcAltKeyDefaultBundle_fr", "fr");
}
public void testImgSrcAltKeyAlternateBundle_fr(){
runMyTest("testImgSrcAltKeyAlternateBundle_fr", "fr");
}
public void testImgSrcBorder(){
runMyTest("testImgSrcBorder", "");
}
public void testImgSrcHeight1(){
runMyTest("testImgSrcHeight1", "");
}
public void testImgSrcHeight2(){
runMyTest("testImgSrcHeight2", "");
}
public void testImgSrcHspace(){
runMyTest("testImgSrcHspace", "");
}
public void testImgSrcImageName(){
runMyTest("testImgSrcImageName", "");
}
public void testImgSrcImageIsmap(){
runMyTest("testImgSrcImageIsmap", "");
}
public void testImgSrcLocale(){
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
runMyTest("testImgSrcLocale", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag5a.java
Index: TestImgTag5a.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag5a.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.HashMap;
import java.util.Locale;
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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag5a extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag5a(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[] {TestImgTag5a.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(TestImgTag5a.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/TestImgTag5a.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcNameNoScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapNoScope", map, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcNameNoScope", "");
}
public void testImgSrcNamePropertyNoScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapNoScope", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcNamePropertyNoScope", "");
}
public void testImgSrcNameApplicationScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapApplicationScope", map, PageContext.APPLICATION_SCOPE);
runMyTest("testImgSrcNameApplicationScope", "");
}
public void testImgSrcNamePropertyApplicationScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapApplicationScope", sbft, PageContext.APPLICATION_SCOPE);
runMyTest("testImgSrcNamePropertyApplicationScope", "");
}
public void testImgSrcNameSessionScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapSessionScope", map, PageContext.SESSION_SCOPE);
runMyTest("testImgSrcNameSessionScope", "");
}
public void testImgSrcNamePropertySessionScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapSessionScope", sbft, PageContext.SESSION_SCOPE);
runMyTest("testImgSrcNamePropertySessionScope", "");
}
public void testImgSrcNameRequestScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapRequestScope", map, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcNameRequestScope", "");
}
public void testImgSrcNamePropertyRequestScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapRequestScope", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcNamePropertyRequestScope", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag6.java
Index: TestImgTag6.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag6.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag6 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag6(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[] {TestImgTag6.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(TestImgTag6.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/TestImgTag6.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcOnclick(){
runMyTest("testImgSrcOnclick", "");
}
public void testImgSrcOndblclick(){
runMyTest("testImgSrcOndblclick", "");
}
public void testImgSrcOnkeydown(){
runMyTest("testImgSrcOnkeydown", "");
}
public void testImgSrcOnkeypress(){
runMyTest("testImgSrcOnkeypress", "");
}
public void testImgSrcOnkeyup(){
runMyTest("testImgSrcOnkeyup", "");
}
public void testImgSrcOnmousedown(){
runMyTest("testImgSrcOnmousedown", "");
}
public void testImgSrcOnmousemove(){
runMyTest("testImgSrcOnmousemove", "");
}
public void testImgSrcOnmouseout(){
runMyTest("testImgSrcOnmouseout", "");
}
public void testImgSrcOnmouseover(){
runMyTest("testImgSrcOnmouseover", "");
}
public void testImgSrcOnmouseup(){
runMyTest("testImgSrcOnmouseup", "");
}
public void testImgSrcStyle(){
runMyTest("testImgSrcStyle", "");
}
public void testImgSrcStyleClass(){
runMyTest("testImgSrcStyleClass", "");
}
public void testImgSrcStyleId(){
runMyTest("testImgSrcStyleId", "");
}
public void testImgSrcTitle(){
runMyTest("testImgSrcTitle", "");
}
public void testImgSrcTitleKeyDefaultBundle(){
runMyTest("testImgSrcTitleKeyDefaultBundle", "");
}
public void testImgSrcTitleKeyAlternateBundle(){
runMyTest("testImgSrcTitleKeyAlternateBundle", "");
}
public void testImgSrcTitleKeyDefaultBundle_fr(){
runMyTest("testImgSrcTitleKeyDefaultBundle_fr", "fr");
}
public void testImgSrcTitleKeyAlternateBundle_fr(){
runMyTest("testImgSrcTitleKeyAlternateBundle_fr", "fr");
}
public void testImgSrcUsemap(){
runMyTest("testImgSrcUsemap", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag7.java
Index: TestImgTag7.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag7.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.HashMap;
import java.util.Locale;
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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag7 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag7(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[] {TestImgTag7.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(TestImgTag7.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/TestImgTag7.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcKeyAlign1(){
runMyTest("testImgSrcKeyAlign1", "");
}
public void testImgSrcKeyAlign2(){
runMyTest("testImgSrcKeyAlign2", "");
}
public void testImgSrcKeyAlign3(){
runMyTest("testImgSrcKeyAlign3", "");
}
public void testImgSrcKeyAlign4(){
runMyTest("testImgSrcKeyAlign4", "");
}
public void testImgSrcKeyAlign5(){
runMyTest("testImgSrcKeyAlign5", "");
}
public void testImgSrcKeyAlign6(){
runMyTest("testImgSrcKeyAlign6", "");
}
public void testImgSrcKeyAlign7(){
runMyTest("testImgSrcKeyAlign7", "");
}
public void testImgSrcKeyAlign8(){
runMyTest("testImgSrcKeyAlign8", "");
}
public void testImgSrcKeyAlign9(){
runMyTest("testImgSrcKeyAlign9", "");
}
public void testImgSrcKeyAlign10(){
runMyTest("testImgSrcKeyAlign10", "");
}
public void testImgSrcKeyAlt(){
runMyTest("testImgSrcKeyAlt", "");
}
public void testImgSrcKeyAltKeyDefaultBundle(){
runMyTest("testImgSrcKeyAltKeyDefaultBundle", "");
}
public void testImgSrcKeyAltKeyAlternateBundle(){
runMyTest("testImgSrcKeyAltKeyAlternateBundle", "");
}
public void testImgSrcKeyAltKeyDefaultBundle_fr(){
runMyTest("testImgSrcKeyAltKeyDefaultBundle_fr", "fr");
}
public void testImgSrcKeyAltKeyAlternateBundle_fr(){
runMyTest("testImgSrcKeyAltKeyAlternateBundle_fr", "fr");
}
public void testImgSrcKeyBorder(){
runMyTest("testImgSrcKeyBorder", "");
}
public void testImgSrcKeyHeight1(){
runMyTest("testImgSrcKeyHeight1", "");
}
public void testImgSrcKeyHeight2(){
runMyTest("testImgSrcKeyHeight2", "");
}
public void testImgSrcKeyHspace(){
runMyTest("testImgSrcKeyHspace", "");
}
public void testImgSrcKeyImageName(){
runMyTest("testImgSrcKeyImageName", "");
}
public void testImgSrcKeyImageIsmap(){
runMyTest("testImgSrcKeyImageIsmap", "");
}
public void testImgSrcKeyLocale(){
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
runMyTest("testImgSrcKeyLocale", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag7a.java
Index: TestImgTag7a.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag7a.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.HashMap;
import java.util.Locale;
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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag7a extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag7a(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[] {TestImgTag7a.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(TestImgTag7a.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/TestImgTag7a.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcKeyNameNoScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapNoScope", map, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcKeyNameNoScope", "");
}
public void testImgSrcKeyNamePropertyNoScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapNoScope", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcKeyNamePropertyNoScope", "");
}
public void testImgSrcKeyNameApplicationScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapApplicationScope", map, PageContext.APPLICATION_SCOPE);
runMyTest("testImgSrcKeyNameApplicationScope", "");
}
public void testImgSrcKeyNamePropertyApplicationScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapApplicationScope", sbft, PageContext.APPLICATION_SCOPE);
runMyTest("testImgSrcKeyNamePropertyApplicationScope", "");
}
public void testImgSrcKeyNameSessionScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapSessionScope", map, PageContext.SESSION_SCOPE);
runMyTest("testImgSrcKeyNameSessionScope", "");
}
public void testImgSrcKeyNamePropertySessionScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapSessionScope", sbft, PageContext.SESSION_SCOPE);
runMyTest("testImgSrcKeyNamePropertySessionScope", "");
}
public void testImgSrcKeyNameRequestScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
pageContext.setAttribute("paramMapRequestScope", map, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcKeyNameRequestScope", "");
}
public void testImgSrcKeyNamePropertyRequestScope(){
HashMap map = new HashMap();
map.put("param1","value1");
map.put("param2","value2");
map.put("param3","value3");
map.put("param4","value4");
SimpleBeanForTesting sbft = new SimpleBeanForTesting(map);
pageContext.setAttribute("paramPropertyMapRequestScope", sbft, PageContext.REQUEST_SCOPE);
runMyTest("testImgSrcKeyNamePropertyRequestScope", "");
}
}
1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag8.java
Index: TestImgTag8.java
===================================================================
/*
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag8.java,v 1.1 2003/03/12 00:31:01 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2003/03/12 00:31:01 $
*
* ====================================================================
* 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.ImgTag</code> class.
*
* @author James Mitchell
*/
public class TestImgTag8 extends JspTestCase {
/**
* Defines the testcase name for JUnit.
*
* @param theName the testcase's name.
*/
public TestImgTag8(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[] {TestImgTag8.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(TestImgTag8.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/TestImgTag8.jsp");
}
catch (Exception e) {
e.printStackTrace();
fail("There is a problem that is preventing the tests to continue!");
}
}
/*
* Testing ImgTag.
*/
//--------Testing attributes using page------
public void testImgSrcKeyOnclick(){
runMyTest("testImgSrcKeyOnclick", "");
}
public void testImgSrcKeyOndblclick(){
runMyTest("testImgSrcKeyOndblclick", "");
}
public void testImgSrcKeyOnkeydown(){
runMyTest("testImgSrcKeyOnkeydown", "");
}
public void testImgSrcKeyOnkeypress(){
runMyTest("testImgSrcKeyOnkeypress", "");
}
public void testImgSrcKeyOnkeyup(){
runMyTest("testImgSrcKeyOnkeyup", "");
}
public void testImgSrcKeyOnmousedown(){
runMyTest("testImgSrcKeyOnmousedown", "");
}
public void testImgSrcKeyOnmousemove(){
runMyTest("testImgSrcKeyOnmousemove", "");
}
public void testImgSrcKeyOnmouseout(){
runMyTest("testImgSrcKeyOnmouseout", "");
}
public void testImgSrcKeyOnmouseover(){
runMyTest("testImgSrcKeyOnmouseover", "");
}
public void testImgSrcKeyOnmouseup(){
runMyTest("testImgSrcKeyOnmouseup", "");
}
public void testImgSrcKeyStyle(){
runMyTest("testImgSrcKeyStyle", "");
}
public void testImgSrcKeyStyleClass(){
runMyTest("testImgSrcKeyStyleClass", "");
}
public void testImgSrcKeyStyleId(){
runMyTest("testImgSrcKeyStyleId", "");
}
public void testImgSrcKeyTitle(){
runMyTest("testImgSrcKeyTitle", "");
}
public void testImgSrcKeyTitleKeyDefaultBundle(){
runMyTest("testImgSrcKeyTitleKeyDefaultBundle", "");
}
public void testImgSrcKeyTitleKeyAlternateBundle(){
runMyTest("testImgSrcKeyTitleKeyAlternateBundle", "");
}
public void testImgSrcKeyTitleKeyDefaultBundle_fr(){
runMyTest("testImgSrcKeyTitleKeyDefaultBundle_fr", "fr");
}
public void testImgSrcKeyTitleKeyAlternateBundle_fr(){
runMyTest("testImgSrcKeyTitleKeyAlternateBundle_fr", "fr");
}
public void testImgSrcKeyUsemap(){
runMyTest("testImgSrcKeyUsemap", "");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org