jmitchell    2003/03/11 16:29:44

  Added:       src/test/org/apache/struts/taglib/html TestImgTag1.java
                        TestImgTag1a.java TestImgTag2.java TestImgTag3.java
                        TestImgTag3a.java TestImgTag4.java
  Log:
  New tests
  
  Revision  Changes    Path
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag1.java
  
  Index: TestImgTag1.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag1.java,v 1.1 
2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.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 TestImgTag1 extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag1(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[] {TestImgTag1.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(TestImgTag1.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/TestImgTag1.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 testImgPageAlign1(){
          runMyTest("testImgPageAlign1", "");
      }
  
      public void testImgPageAlign2(){
          runMyTest("testImgPageAlign2", "");
      }
  
      public void testImgPageAlign3(){
          runMyTest("testImgPageAlign3", "");
      }
  
      public void testImgPageAlign4(){
          runMyTest("testImgPageAlign4", "");
      }
  
      public void testImgPageAlign5(){
          runMyTest("testImgPageAlign5", "");
      }
  
      public void testImgPageAlign6(){
          runMyTest("testImgPageAlign6", "");
      }
  
      public void testImgPageAlign7(){
          runMyTest("testImgPageAlign7", "");
      }
  
      public void testImgPageAlign8(){
          runMyTest("testImgPageAlign8", "");
      }
  
      public void testImgPageAlign9(){
          runMyTest("testImgPageAlign9", "");
      }
  
      public void testImgPageAlign10(){
          runMyTest("testImgPageAlign10", "");
      }
  
      public void testImgPageAlt(){
          runMyTest("testImgPageAlt", "");
      }
  
      public void testImgPageAltKeyDefaultBundle(){
          runMyTest("testImgPageAltKeyDefaultBundle", "");
      }
  
      public void testImgPageAltKeyAlternateBundle(){
          runMyTest("testImgPageAltKeyAlternateBundle", "");
      }
  
      public void testImgPageAltKeyDefaultBundle_fr(){
          runMyTest("testImgPageAltKeyDefaultBundle_fr", "fr");
      }
  
      public void testImgPageAltKeyAlternateBundle_fr(){
          runMyTest("testImgPageAltKeyAlternateBundle_fr", "fr");
      }
  
      public void testImgPageBorder(){
          runMyTest("testImgPageBorder", "");
      }
  
      public void testImgPageHeight1(){
          runMyTest("testImgPageHeight1", "");
      }
  
      public void testImgPageHeight2(){
          runMyTest("testImgPageHeight2", "");
      }
  
      public void testImgPageHspace(){
          runMyTest("testImgPageHspace", "");
      }
  
      public void testImgPageImageName(){
          runMyTest("testImgPageImageName", "");
      }
  
      public void testImgPageImageIsmap(){
          runMyTest("testImgPageImageIsmap", "");
      }
  
      public void testImgPageLocale(){
        pageContext.setAttribute("secret locale", new Locale("fr", "fr"), 
PageContext.SESSION_SCOPE);
          runMyTest("testImgPageLocale", "");
      }
  
  }
  
  
  
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag1a.java
  
  Index: TestImgTag1a.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag1a.java,v 
1.1 2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.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 TestImgTag1a extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag1a(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[] {TestImgTag1a.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(TestImgTag1a.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/TestImgTag1a.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 testImgPageNameNoScope(){
                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("testImgPageNameNoScope", "");
      }
  
      public void testImgPageNamePropertyNoScope(){
                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("testImgPageNamePropertyNoScope", "");
      }
  
      public void testImgPageNameApplicationScope(){
                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("testImgPageNameApplicationScope", "");
      }
  
      public void testImgPageNamePropertyApplicationScope(){
                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("testImgPageNamePropertyApplicationScope", "");
      }
  
      public void testImgPageNameSessionScope(){
                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("testImgPageNameSessionScope", "");
      }
  
      public void testImgPageNamePropertySessionScope(){
                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("testImgPageNamePropertySessionScope", "");
      }
  
      public void testImgPageNameRequestScope(){
                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("testImgPageNameRequestScope", "");
      }
  
      public void testImgPageNamePropertyRequestScope(){
                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("testImgPageNamePropertyRequestScope", "");
      }
  
  
  
  }
  
  
  
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag2.java
  
  Index: TestImgTag2.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag2.java,v 1.1 
2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.ImgTag</code> class.
   *
   * @author James Mitchell
   */
  public class TestImgTag2 extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag2(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[] {TestImgTag2.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(TestImgTag2.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/TestImgTag2.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 testImgPageOnclick(){
          runMyTest("testImgPageOnclick", "");
      }
  
      public void testImgPageOndblclick(){
          runMyTest("testImgPageOndblclick", "");
      }
  
      public void testImgPageOnkeydown(){
          runMyTest("testImgPageOnkeydown", "");
      }
  
      public void testImgPageOnkeypress(){
          runMyTest("testImgPageOnkeypress", "");
      }
  
      public void testImgPageOnkeyup(){
          runMyTest("testImgPageOnkeyup", "");
      }
  
      public void testImgPageOnmousedown(){
          runMyTest("testImgPageOnmousedown", "");
      }
  
      public void testImgPageOnmousemove(){
          runMyTest("testImgPageOnmousemove", "");
      }
  
      public void testImgPageOnmouseout(){
          runMyTest("testImgPageOnmouseout", "");
      }
  
      public void testImgPageOnmouseover(){
          runMyTest("testImgPageOnmouseover", "");
      }
  
      public void testImgPageOnmouseup(){
          runMyTest("testImgPageOnmouseup", "");
      }
  
      public void testImgPageStyle(){
          runMyTest("testImgPageStyle", "");
      }
  
      public void testImgPageStyleClass(){
          runMyTest("testImgPageStyleClass", "");
      }
  
      public void testImgPageStyleId(){
          runMyTest("testImgPageStyleId", "");
      }
  
      public void testImgPageTitle(){
          runMyTest("testImgPageTitle", "");
      }
  
      public void testImgPageTitleKeyDefaultBundle(){
          runMyTest("testImgPageTitleKeyDefaultBundle", "");
      }
  
      public void testImgPageTitleKeyAlternateBundle(){
          runMyTest("testImgPageTitleKeyAlternateBundle", "");
      }
  
      public void testImgPageTitleKeyDefaultBundle_fr(){
          runMyTest("testImgPageTitleKeyDefaultBundle_fr", "fr");
      }
  
      public void testImgPageTitleKeyAlternateBundle_fr(){
          runMyTest("testImgPageTitleKeyAlternateBundle_fr", "fr");
      }
  
      public void testImgPageUsemap(){
          runMyTest("testImgPageUsemap", "");
      }
  
  }
  
  
  
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag3.java
  
  Index: TestImgTag3.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag3.java,v 1.1 
2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.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 TestImgTag3 extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag3(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[] {TestImgTag3.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(TestImgTag3.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/TestImgTag3.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 testImgPageKeyAlign1(){
          runMyTest("testImgPageKeyAlign1", "");
      }
  
      public void testImgPageKeyAlign2(){
          runMyTest("testImgPageKeyAlign2", "");
      }
  
      public void testImgPageKeyAlign3(){
          runMyTest("testImgPageKeyAlign3", "");
      }
  
      public void testImgPageKeyAlign4(){
          runMyTest("testImgPageKeyAlign4", "");
      }
  
      public void testImgPageKeyAlign5(){
          runMyTest("testImgPageKeyAlign5", "");
      }
  
      public void testImgPageKeyAlign6(){
          runMyTest("testImgPageKeyAlign6", "");
      }
  
      public void testImgPageKeyAlign7(){
          runMyTest("testImgPageKeyAlign7", "");
      }
  
      public void testImgPageKeyAlign8(){
          runMyTest("testImgPageKeyAlign8", "");
      }
  
      public void testImgPageKeyAlign9(){
          runMyTest("testImgPageKeyAlign9", "");
      }
  
      public void testImgPageKeyAlign10(){
          runMyTest("testImgPageKeyAlign10", "");
      }
  
      public void testImgPageKeyAlt(){
          runMyTest("testImgPageKeyAlt", "");
      }
  
      public void testImgPageKeyAltKeyDefaultBundle(){
          runMyTest("testImgPageKeyAltKeyDefaultBundle", "");
      }
  
      public void testImgPageKeyAltKeyAlternateBundle(){
          runMyTest("testImgPageKeyAltKeyAlternateBundle", "");
      }
  
      public void testImgPageKeyAltKeyDefaultBundle_fr(){
          runMyTest("testImgPageKeyAltKeyDefaultBundle_fr", "fr");
      }
  
      public void testImgPageKeyAltKeyAlternateBundle_fr(){
          runMyTest("testImgPageKeyAltKeyAlternateBundle_fr", "fr");
      }
  
      public void testImgPageKeyBorder(){
          runMyTest("testImgPageKeyBorder", "");
      }
  
      public void testImgPageKeyHeight1(){
          runMyTest("testImgPageKeyHeight1", "");
      }
  
      public void testImgPageKeyHeight2(){
          runMyTest("testImgPageKeyHeight2", "");
      }
  
      public void testImgPageKeyHspace(){
          runMyTest("testImgPageKeyHspace", "");
      }
  
      public void testImgPageKeyImageName(){
          runMyTest("testImgPageKeyImageName", "");
      }
  
      public void testImgPageKeyImageIsmap(){
          runMyTest("testImgPageKeyImageIsmap", "");
      }
  
      public void testImgPageKeyLocale(){
        pageContext.setAttribute("secret locale", new Locale("fr", "fr"), 
PageContext.SESSION_SCOPE);
          runMyTest("testImgPageKeyLocale", "");
      }
  
  }
  
  
  
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag3a.java
  
  Index: TestImgTag3a.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag3a.java,v 
1.1 2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.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 TestImgTag3a extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag3a(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[] {TestImgTag3a.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(TestImgTag3a.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/TestImgTag3a.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 testImgPageKeyNameNoScope(){
                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("testImgPageKeyNameNoScope", "");
      }
  
      public void testImgPageKeyNamePropertyNoScope(){
                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("testImgPageKeyNamePropertyNoScope", "");
      }
  
      public void testImgPageKeyNameApplicationScope(){
                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("testImgPageKeyNameApplicationScope", "");
      }
  
      public void testImgPageKeyNamePropertyApplicationScope(){
                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("testImgPageKeyNamePropertyApplicationScope", "");
      }
  
      public void testImgPageKeyNameSessionScope(){
                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("testImgPageKeyNameSessionScope", "");
      }
  
      public void testImgPageKeyNamePropertySessionScope(){
                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("testImgPageKeyNamePropertySessionScope", "");
      }
  
      public void testImgPageKeyNameRequestScope(){
                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("testImgPageKeyNameRequestScope", "");
      }
  
      public void testImgPageKeyNamePropertyRequestScope(){
                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("testImgPageKeyNamePropertyRequestScope", "");
      }
  
  
  
  }
  
  
  
  1.1                  
jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag4.java
  
  Index: TestImgTag4.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImgTag4.java,v 1.1 
2003/03/12 00:29:44 jmitchell Exp $
   * $Revision: 1.1 $
   * $Date: 2003/03/12 00:29:44 $
   * 
   * ====================================================================
   * 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.ImgTag</code> class.
   *
   * @author James Mitchell
   */
  public class TestImgTag4 extends JspTestCase {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param theName the testcase's name.
       */
      public TestImgTag4(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[] {TestImgTag4.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(TestImgTag4.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/TestImgTag4.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 testImgPageKeyOnclick(){
          runMyTest("testImgPageKeyOnclick", "");
      }
  
      public void testImgPageKeyOndblclick(){
          runMyTest("testImgPageKeyOndblclick", "");
      }
  
      public void testImgPageKeyOnkeydown(){
          runMyTest("testImgPageKeyOnkeydown", "");
      }
  
      public void testImgPageKeyOnkeypress(){
          runMyTest("testImgPageKeyOnkeypress", "");
      }
  
      public void testImgPageKeyOnkeyup(){
          runMyTest("testImgPageKeyOnkeyup", "");
      }
  
      public void testImgPageKeyOnmousedown(){
          runMyTest("testImgPageKeyOnmousedown", "");
      }
  
      public void testImgPageKeyOnmousemove(){
          runMyTest("testImgPageKeyOnmousemove", "");
      }
  
      public void testImgPageKeyOnmouseout(){
          runMyTest("testImgPageKeyOnmouseout", "");
      }
  
      public void testImgPageKeyOnmouseover(){
          runMyTest("testImgPageKeyOnmouseover", "");
      }
  
      public void testImgPageKeyOnmouseup(){
          runMyTest("testImgPageKeyOnmouseup", "");
      }
  
      public void testImgPageKeyStyle(){
          runMyTest("testImgPageKeyStyle", "");
      }
  
      public void testImgPageKeyStyleClass(){
          runMyTest("testImgPageKeyStyleClass", "");
      }
  
      public void testImgPageKeyStyleId(){
          runMyTest("testImgPageKeyStyleId", "");
      }
  
      public void testImgPageKeyTitle(){
          runMyTest("testImgPageKeyTitle", "");
      }
  
      public void testImgPageKeyTitleKeyDefaultBundle(){
          runMyTest("testImgPageKeyTitleKeyDefaultBundle", "");
      }
  
      public void testImgPageKeyTitleKeyAlternateBundle(){
          runMyTest("testImgPageKeyTitleKeyAlternateBundle", "");
      }
  
      public void testImgPageKeyTitleKeyDefaultBundle_fr(){
          runMyTest("testImgPageKeyTitleKeyDefaultBundle_fr", "fr");
      }
  
      public void testImgPageKeyTitleKeyAlternateBundle_fr(){
          runMyTest("testImgPageKeyTitleKeyAlternateBundle_fr", "fr");
      }
  
      public void testImgPageKeyUsemap(){
          runMyTest("testImgPageKeyUsemap", "");
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to