1 18 package org.apache.struts.taglib.html; 19 20 import java.util.ArrayList ; 21 import java.util.HashMap ; 22 import java.util.Locale ; 23 import java.util.StringTokenizer ; 24 25 import javax.servlet.jsp.PageContext ; 26 import junit.framework.Test; 27 import junit.framework.TestSuite; 28 29 import org.apache.cactus.JspTestCase; 30 import org.apache.struts.Globals; 31 import org.apache.struts.taglib.SimpleBeanForTesting; 32 33 38 public class TestSubmitTag2 extends JspTestCase { 39 40 45 public TestSubmitTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestSubmitTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestSubmitTag2.class); 65 } 66 67 private void runMyTest(String whichTest, String locale) throws Exception { 68 pageContext.setAttribute(Globals.LOCALE_KEY, new Locale (locale, locale), PageContext.SESSION_SCOPE); 69 request.setAttribute("runTest", whichTest); 70 pageContext.forward("/test/org/apache/struts/taglib/html/TestSubmitTag2.jsp"); 71 } 72 73 76 77 public void testSubmitPropertyStyle() throws Exception { 78 runMyTest("testSubmitPropertyStyle", ""); 79 } 80 public void testSubmitPropertyStyleClass() throws Exception { 81 runMyTest("testSubmitPropertyStyleClass", ""); 82 } 83 public void testSubmitPropertyStyleId() throws Exception { 84 runMyTest("testSubmitPropertyStyleId", ""); 85 } 86 public void testSubmitPropertyTabindex() throws Exception { 87 runMyTest("testSubmitPropertyTabindex", ""); 88 } 89 public void testSubmitPropertyTitle() throws Exception { 90 runMyTest("testSubmitPropertyTitle", ""); 91 } 92 public void testSubmitPropertyTitleKey() throws Exception { 93 runMyTest("testSubmitPropertyTitleKey", ""); 94 } 95 public void testSubmitPropertyTitleKey_fr() throws Exception { 96 runMyTest("testSubmitPropertyTitleKey_fr", "fr"); 97 } 98 public void testSubmitPropertyValue() throws Exception { 99 runMyTest("testSubmitPropertyValue", ""); 100 } 101 public void testSubmitPropertyBodyContent() throws Exception { 102 runMyTest("testSubmitPropertyBodyContent", ""); 103 } 104 public void testSubmitPropertyBodyContentMessageKey() throws Exception { 105 runMyTest("testSubmitPropertyBodyContentMessageKey", ""); 106 } 107 public void testSubmitPropertyBodyContentMessageKey_fr() throws Exception { 108 runMyTest("testSubmitPropertyBodyContentMessageKey_fr", "fr"); 109 } 110 public void testSubmitPropertyIndexedArray() throws Exception { 111 ArrayList lst = new ArrayList (); 112 lst.add("Test Message"); 113 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 114 runMyTest("testSubmitPropertyIndexedArray", ""); 115 } 116 public void testSubmitPropertyIndexedArrayProperty() throws Exception { 117 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 118 ArrayList lst = new ArrayList (); 119 lst.add("Test Message"); 120 sbft.setList(lst); 121 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 122 runMyTest("testSubmitPropertyIndexedArrayProperty", ""); 123 } 124 public void testSubmitPropertyIndexedMap() throws Exception { 125 HashMap map = new HashMap (); 126 map.put("tst1", "Test Message"); 127 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 128 runMyTest("testSubmitPropertyIndexedMap", ""); 129 } 130 public void testSubmitPropertyIndexedMapProperty() throws Exception { 131 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 132 HashMap map = new HashMap (); 133 map.put("tst1", "Test Message"); 134 sbft.setMap(map); 135 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 136 runMyTest("testSubmitPropertyIndexedMapProperty", ""); 137 } 138 public void testSubmitPropertyIndexedEnumeration() throws Exception { 139 StringTokenizer st = new StringTokenizer ("Test Message"); 140 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 141 runMyTest("testSubmitPropertyIndexedEnumeration", ""); 142 } 143 public void testSubmitPropertyIndexedEnumerationProperty() throws Exception { 144 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 145 StringTokenizer st = new StringTokenizer ("Test Message"); 146 sbft.setEnumeration(st); 147 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 148 runMyTest("testSubmitPropertyIndexedEnumerationProperty", ""); 149 } 150 151 } 152 | Popular Tags |