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 TestFileTag2 extends JspTestCase { 39 40 45 public TestFileTag2(String theName) { 46 super(theName); 47 } 48 49 54 public static void main(String [] theArgs) { 55 junit.awtui.TestRunner.main(new String [] {TestFileTag2.class.getName()}); 56 } 57 58 62 public static Test suite() { 63 return new TestSuite(TestFileTag2.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 pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE); 70 request.setAttribute("runTest", whichTest); 71 pageContext.forward("/test/org/apache/struts/taglib/html/TestFileTag2.jsp"); 72 } 73 74 77 78 public void testFilePropertyStyle() throws Exception { 79 runMyTest("testFilePropertyStyle", ""); 80 } 81 82 public void testFilePropertyErrorStyle() throws Exception { 83 runMyTest("testFilePropertyErrorStyle", ""); 84 } 85 86 public void testFilePropertyStyleClass() throws Exception { 87 runMyTest("testFilePropertyStyleClass", ""); 88 } 89 90 public void testFilePropertyErrorStyleClass() throws Exception { 91 runMyTest("testFilePropertyErrorStyleClass", ""); 92 } 93 94 public void testFilePropertyStyleId() throws Exception { 95 runMyTest("testFilePropertyStyleId", ""); 96 } 97 98 public void testFilePropertyErrorStyleId() throws Exception { 99 runMyTest("testFilePropertyErrorStyleId", ""); 100 } 101 102 public void testFilePropertyTabindex() throws Exception { 103 runMyTest("testFilePropertyTabindex", ""); 104 } 105 106 public void testFilePropertyTitle() throws Exception { 107 runMyTest("testFilePropertyTitle", ""); 108 } 109 110 public void testFilePropertyTitleKey() throws Exception { 111 runMyTest("testFilePropertyTitleKey", ""); 112 } 113 114 public void testFilePropertyTitleKey_fr() throws Exception { 115 runMyTest("testFilePropertyTitleKey_fr", "fr"); 116 } 117 118 public void testFilePropertyValue() throws Exception { 119 runMyTest("testFilePropertyValue", ""); 120 } 121 122 public void testFilePropertyBodyContent() throws Exception { 123 runMyTest("testFilePropertyBodyContent", ""); 124 } 125 126 public void testFilePropertyBodyContentMessageKey() throws Exception { 127 runMyTest("testFilePropertyBodyContentMessageKey", ""); 128 } 129 130 public void testFilePropertyBodyContentMessageKey_fr() throws Exception { 131 runMyTest("testFilePropertyBodyContentMessageKey_fr", "fr"); 132 } 133 134 public void testFilePropertyIndexedArray() throws Exception { 135 ArrayList lst = new ArrayList (); 136 lst.add("Test Message"); 137 pageContext.setAttribute("lst", lst, PageContext.REQUEST_SCOPE); 138 runMyTest("testFilePropertyIndexedArray", ""); 139 } 140 141 public void testFilePropertyIndexedArrayProperty() throws Exception { 142 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 143 ArrayList lst = new ArrayList (); 144 lst.add("Test Message"); 145 sbft.setList(lst); 146 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 147 runMyTest("testFilePropertyIndexedArrayProperty", ""); 148 } 149 150 public void testFilePropertyIndexedMap() throws Exception { 151 HashMap map = new HashMap (); 152 map.put("tst1", "Test Message"); 153 pageContext.setAttribute("lst", map, PageContext.REQUEST_SCOPE); 154 runMyTest("testFilePropertyIndexedMap", ""); 155 } 156 157 public void testFilePropertyIndexedMapProperty() throws Exception { 158 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 159 HashMap map = new HashMap (); 160 map.put("tst1", "Test Message"); 161 sbft.setMap(map); 162 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 163 runMyTest("testFilePropertyIndexedMapProperty", ""); 164 } 165 166 public void testFilePropertyIndexedEnumeration() throws Exception { 167 StringTokenizer st = new StringTokenizer ("Test Message"); 168 pageContext.setAttribute("lst", st, PageContext.REQUEST_SCOPE); 169 runMyTest("testFilePropertyIndexedEnumeration", ""); 170 } 171 172 public void testFilePropertyIndexedEnumerationProperty() throws Exception { 173 SimpleBeanForTesting sbft = new SimpleBeanForTesting(); 174 StringTokenizer st = new StringTokenizer ("Test Message"); 175 sbft.setEnumeration(st); 176 pageContext.setAttribute("lst", sbft, PageContext.REQUEST_SCOPE); 177 runMyTest("testFilePropertyIndexedEnumerationProperty", ""); 178 } 179 180 181 182 } 183 | Popular Tags |