jmitchell 2003/03/11 16:20:48 Added: src/test/org/apache/struts/taglib/html TestImageTag5.java TestImageTag6.java TestImageTag7.java TestImageTag8.java Log: New tests Revision Changes Path 1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag5.java Index: TestImageTag5.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag5.java,v 1.1 2003/03/12 00:20:48 jmitchell Exp $ * $Revision: 1.1 $ * $Date: 2003/03/12 00:20:48 $ * * ==================================================================== * 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 [EMAIL PROTECTED] * * 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 TestImageTag5 extends JspTestCase { /** * Defines the testcase name for JUnit. * * @param theName the testcase's name. */ public TestImageTag5(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[] {TestImageTag5.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(TestImageTag5.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/TestImageTag5.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 testImageSrcAccesskey(){ runMyTest("testImageSrcAccesskey", ""); } public void testImageSrcAlign(){ runMyTest("testImageSrcAlign", ""); } public void testImageSrcAlt(){ runMyTest("testImageSrcAlt", ""); } public void testImageSrcAltKeyDefaultBundle(){ runMyTest("testImageSrcAltKeyDefaultBundle", ""); } public void testImageSrcAltKeyAlternateBundle(){ runMyTest("testImageSrcAltKeyAlternateBundle", ""); } public void testImageSrcAltKeyDefaultBundle_fr(){ runMyTest("testImageSrcAltKeyDefaultBundle_fr", "fr"); } public void testImageSrcAltKeyAlternateBundle_fr(){ runMyTest("testImageSrcAltKeyAlternateBundle_fr", "fr"); } public void testImageSrcBorder(){ runMyTest("testImageSrcBorder", ""); } public void testImageSrcDisabled1(){ runMyTest("testImageSrcDisabled1", ""); } public void testImageSrcDisabled2(){ runMyTest("testImageSrcDisabled2", ""); } public void testImageSrcDisabled3(){ runMyTest("testImageSrcDisabled3", ""); } public void testImageSrcDisabled4(){ runMyTest("testImageSrcDisabled4", ""); } public void testImageSrcDisabled5(){ runMyTest("testImageSrcDisabled5", ""); } public void testImageSrcDisabled6(){ runMyTest("testImageSrcDisabled6", ""); } public void testImageSrcLocale(){ pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE); runMyTest("testImageSrcLocale", ""); } public void testImageSrcOnblur(){ runMyTest("testImageSrcOnblur", ""); } public void testImageSrcOnchange(){ runMyTest("testImageSrcOnchange", ""); } public void testImageSrcOnclick(){ runMyTest("testImageSrcOnclick", ""); } public void testImageSrcOndblclick(){ runMyTest("testImageSrcOndblclick", ""); } public void testImageSrcOnfocus(){ runMyTest("testImageSrcOnfocus", ""); } public void testImageSrcOnkeydown(){ runMyTest("testImageSrcOnkeydown", ""); } public void testImageSrcOnkeypress(){ runMyTest("testImageSrcOnkeypress", ""); } public void testImageSrcOnkeyup(){ runMyTest("testImageSrcOnkeyup", ""); } } 1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag6.java Index: TestImageTag6.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag6.java,v 1.1 2003/03/12 00:20:48 jmitchell Exp $ * $Revision: 1.1 $ * $Date: 2003/03/12 00:20:48 $ * * ==================================================================== * 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 [EMAIL PROTECTED] * * 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 TestImageTag6 extends JspTestCase { /** * Defines the testcase name for JUnit. * * @param theName the testcase's name. */ public TestImageTag6(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[] {TestImageTag6.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(TestImageTag6.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/TestImageTag6.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 testImageSrcOnmousedown(){ runMyTest("testImageSrcOnmousedown", ""); } public void testImageSrcOnmousemove(){ runMyTest("testImageSrcOnmousemove", ""); } public void testImageSrcOnmouseout(){ runMyTest("testImageSrcOnmouseout", ""); } public void testImageSrcOnmouseover(){ runMyTest("testImageSrcOnmouseover", ""); } public void testImageSrcOnmouseup(){ runMyTest("testImageSrcOnmouseup", ""); } public void testImageSrcProperty(){ runMyTest("testImageSrcProperty", ""); } public void testImageSrcStyle(){ runMyTest("testImageSrcStyle", ""); } public void testImageSrcStyleClass(){ runMyTest("testImageSrcStyleClass", ""); } public void testImageSrcStyleId(){ runMyTest("testImageSrcStyleId", ""); } public void testImageSrcTabindex(){ runMyTest("testImageSrcTabindex", ""); } public void testImageSrcTitle(){ runMyTest("testImageSrcTitle", ""); } public void testImageSrcTitleKeyDefaultBundle(){ runMyTest("testImageSrcTitleKeyDefaultBundle", ""); } public void testImageSrcTitleKeyAlternateBundle(){ runMyTest("testImageSrcTitleKeyAlternateBundle", ""); } public void testImageSrcTitleKeyDefaultBundle_fr(){ runMyTest("testImageSrcTitleKeyDefaultBundle_fr", "fr"); } public void testImageSrcTitleKeyAlternateBundle_fr(){ runMyTest("testImageSrcTitleKeyAlternateBundle_fr", "fr"); } public void testImageSrcIndexedArray(){ ArrayList lst = new ArrayList(); lst.add("Test Message"); pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedArray", ""); } public void testImageSrcIndexedArrayProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); ArrayList lst = new ArrayList(); lst.add("Test Message"); sbft.setList(lst); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedArrayProperty", ""); } public void testImageSrcIndexedMap(){ HashMap map = new HashMap(); map.put("tst1", "Test Message"); pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedMap", ""); } public void testImageSrcIndexedMapProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); HashMap map = new HashMap(); map.put("tst1", "Test Message"); sbft.setMap(map); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedMapProperty", ""); } public void testImageSrcIndexedEnumeration(){ StringTokenizer st = new StringTokenizer("Test Message"); pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedEnumeration", ""); } public void testImageSrcIndexedEnumerationProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); StringTokenizer st = new StringTokenizer("Test Message"); sbft.setEnumeration(st); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcIndexedEnumerationProperty", ""); } } 1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag7.java Index: TestImageTag7.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag7.java,v 1.1 2003/03/12 00:20:48 jmitchell Exp $ * $Revision: 1.1 $ * $Date: 2003/03/12 00:20:48 $ * * ==================================================================== * 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 [EMAIL PROTECTED] * * 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 TestImageTag7 extends JspTestCase { /** * Defines the testcase name for JUnit. * * @param theName the testcase's name. */ public TestImageTag7(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[] {TestImageTag7.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(TestImageTag7.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/TestImageTag7.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 testImageSrcKeyAccesskey(){ runMyTest("testImageSrcKeyAccesskey", ""); } public void testImageSrcKeyAlign(){ runMyTest("testImageSrcKeyAlign", ""); } public void testImageSrcKeyAlt(){ runMyTest("testImageSrcKeyAlt", ""); } public void testImageSrcKeyAltKeyDefaultBundle(){ runMyTest("testImageSrcKeyAltKeyDefaultBundle", ""); } public void testImageSrcKeyAltKeyAlternateBundle(){ runMyTest("testImageSrcKeyAltKeyAlternateBundle", ""); } public void testImageSrcKeyAltKeyDefaultBundle_fr(){ runMyTest("testImageSrcKeyAltKeyDefaultBundle_fr", "fr"); } public void testImageSrcKeyAltKeyAlternateBundle_fr(){ runMyTest("testImageSrcKeyAltKeyAlternateBundle_fr", "fr"); } public void testImageSrcKeyBorder(){ runMyTest("testImageSrcKeyBorder", ""); } public void testImageSrcKeyDisabled1(){ runMyTest("testImageSrcKeyDisabled1", ""); } public void testImageSrcKeyDisabled2(){ runMyTest("testImageSrcKeyDisabled2", ""); } public void testImageSrcKeyDisabled3(){ runMyTest("testImageSrcKeyDisabled3", ""); } public void testImageSrcKeyDisabled4(){ runMyTest("testImageSrcKeyDisabled4", ""); } public void testImageSrcKeyDisabled5(){ runMyTest("testImageSrcKeyDisabled5", ""); } public void testImageSrcKeyDisabled6(){ runMyTest("testImageSrcKeyDisabled6", ""); } public void testImageSrcKeyLocaleDefaultBundle(){ runMyTest("testImageSrcKeyLocaleDefaultBundle", ""); } public void testImageSrcKeyLocaleAlternateBundle(){ runMyTest("testImageSrcKeyLocaleAlternateBundle", ""); } public void testImageSrcKeyLocaleDefaultBundle_fr(){ pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE); runMyTest("testImageSrcKeyLocaleDefaultBundle_fr", ""); } public void testImageSrcKeyLocaleAlternateBundle_fr(){ pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE); runMyTest("testImageSrcKeyLocaleAlternateBundle_fr", ""); } public void testImageSrcKeyOnblur(){ runMyTest("testImageSrcKeyOnblur", ""); } public void testImageSrcKeyOnchange(){ runMyTest("testImageSrcKeyOnchange", ""); } public void testImageSrcKeyOnclick(){ runMyTest("testImageSrcKeyOnclick", ""); } public void testImageSrcKeyOndblclick(){ runMyTest("testImageSrcKeyOndblclick", ""); } public void testImageSrcKeyOnfocus(){ runMyTest("testImageSrcKeyOnfocus", ""); } public void testImageSrcKeyOnkeydown(){ runMyTest("testImageSrcKeyOnkeydown", ""); } public void testImageSrcKeyOnkeypress(){ runMyTest("testImageSrcKeyOnkeypress", ""); } public void testImageSrcKeyOnkeyup(){ runMyTest("testImageSrcKeyOnkeyup", ""); } } 1.1 jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag8.java Index: TestImageTag8.java =================================================================== /* * $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag8.java,v 1.1 2003/03/12 00:20:48 jmitchell Exp $ * $Revision: 1.1 $ * $Date: 2003/03/12 00:20:48 $ * * ==================================================================== * 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 [EMAIL PROTECTED] * * 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 TestImageTag8 extends JspTestCase { /** * Defines the testcase name for JUnit. * * @param theName the testcase's name. */ public TestImageTag8(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[] {TestImageTag8.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(TestImageTag8.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/TestImageTag8.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 testImageSrcKeyOnmousedown(){ runMyTest("testImageSrcKeyOnmousedown", ""); } public void testImageSrcKeyOnmousemove(){ runMyTest("testImageSrcKeyOnmousemove", ""); } public void testImageSrcKeyOnmouseout(){ runMyTest("testImageSrcKeyOnmouseout", ""); } public void testImageSrcKeyOnmouseover(){ runMyTest("testImageSrcKeyOnmouseover", ""); } public void testImageSrcKeyOnmouseup(){ runMyTest("testImageSrcKeyOnmouseup", ""); } public void testImageSrcKeyProperty(){ runMyTest("testImageSrcKeyProperty", ""); } public void testImageSrcKeyStyle(){ runMyTest("testImageSrcKeyStyle", ""); } public void testImageSrcKeyStyleClass(){ runMyTest("testImageSrcKeyStyleClass", ""); } public void testImageSrcKeyStyleId(){ runMyTest("testImageSrcKeyStyleId", ""); } public void testImageSrcKeyTabindex(){ runMyTest("testImageSrcKeyTabindex", ""); } public void testImageSrcKeyTitle(){ runMyTest("testImageSrcKeyTitle", ""); } public void testImageSrcKeyTitleKeyDefaultBundle(){ runMyTest("testImageSrcKeyTitleKeyDefaultBundle", ""); } public void testImageSrcKeyTitleKeyAlternateBundle(){ runMyTest("testImageSrcKeyTitleKeyAlternateBundle", ""); } public void testImageSrcKeyTitleKeyDefaultBundle_fr(){ runMyTest("testImageSrcKeyTitleKeyDefaultBundle_fr", "fr"); } public void testImageSrcKeyTitleKeyAlternateBundle_fr(){ runMyTest("testImageSrcKeyTitleKeyAlternateBundle_fr", "fr"); } public void testImageSrcKeyIndexedArray(){ ArrayList lst = new ArrayList(); lst.add("Test Message"); pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedArray", ""); } public void testImageSrcKeyIndexedArrayProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); ArrayList lst = new ArrayList(); lst.add("Test Message"); sbft.setList(lst); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedArrayProperty", ""); } public void testImageSrcKeyIndexedMap(){ HashMap map = new HashMap(); map.put("tst1", "Test Message"); pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedMap", ""); } public void testImageSrcKeyIndexedMapProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); HashMap map = new HashMap(); map.put("tst1", "Test Message"); sbft.setMap(map); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedMapProperty", ""); } public void testImageSrcKeyIndexedEnumeration(){ StringTokenizer st = new StringTokenizer("Test Message"); pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedEnumeration", ""); } public void testImageSrcKeyIndexedEnumerationProperty(){ SimpleBeanForTesting sbft = new SimpleBeanForTesting(); StringTokenizer st = new StringTokenizer("Test Message"); sbft.setEnumeration(st); pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); runMyTest("testImageSrcKeyIndexedEnumerationProperty", ""); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]