1 18 package org.apache.struts.taglib.bean; 19 20 import java.util.Locale ; 21 22 import javax.servlet.jsp.PageContext ; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 import org.apache.cactus.WebResponse; 28 import org.apache.struts.Globals; 29 import org.apache.struts.taglib.SimpleBeanForTesting; 30 import org.apache.struts.taglib.TaglibTestBase; 31 32 43 public class TestMessageTag_fr extends TaglibTestBase { 44 45 protected final static String TEST_KEY = "BeanKey"; 46 protected final static String TEST_VAL_FR = "Message D'Essai"; 47 48 public TestMessageTag_fr(String theName) { 49 super(theName); 50 } 51 52 57 public static void main(String [] theArgs) { 58 junit.awtui.TestRunner.main(new String [] {TestMessageTag_fr.class.getName()}); 59 } 60 61 65 public static Test suite() { 66 return new TestSuite(TestMessageTag_fr.class); 68 } 69 70 private void runMyTest(String whichTest, Locale locale) throws Exception { 71 pageContext.setAttribute(Globals.LOCALE_KEY, locale, PageContext.SESSION_SCOPE); 72 request.setAttribute("runTest", whichTest); 73 pageContext.forward("/test/org/apache/struts/taglib/bean/TestMessageTag.jsp"); 74 } 75 76 private void formatAndTest(String compare, String output) { 77 output = replace(output,"\r",""); 79 output = replace(output,"\n",""); 80 output = output.trim(); 81 assertEquals(compare, output); 83 } 84 85 94 public void testMessageTagNoArgKeyNoScopeDefaultBundle_fr() throws Exception { 95 runMyTest("testMessageTagNoArgKeyNoScopeDefaultBundle", new Locale ("fr","fr")); 96 } 97 public void endMessageTagNoArgKeyNoScopeDefaultBundle(WebResponse response){ 98 formatAndTest(TEST_VAL_FR, response.getText()); 99 } 100 101 public void testMessageTagNoArgKeyApplicationScopeDefaultBundle_fr() throws Exception { 102 runMyTest("testMessageTagNoArgKeyApplicationScopeDefaultBundle", new Locale ("fr","fr")); 103 } 104 public void endMessageTagNoArgKeyApplicationScopeDefaultBundle(WebResponse response){ 105 formatAndTest(TEST_VAL_FR, response.getText()); 106 } 107 108 public void testMessageTagNoArgKeySessionScopeDefaultBundle_fr() throws Exception { 109 runMyTest("testMessageTagNoArgKeySessionScopeDefaultBundle", new Locale ("fr","fr")); 110 } 111 public void endMessageTagNoArgKeySessionScopeDefaultBundle(WebResponse response){ 112 formatAndTest(TEST_VAL_FR, response.getText()); 113 } 114 115 public void testMessageTagNoArgKeyRequestScopeDefaultBundle_fr() throws Exception { 116 runMyTest("testMessageTagNoArgKeyRequestScopeDefaultBundle", new Locale ("fr","fr")); 117 } 118 public void endMessageTagNoArgKeyRequestScopeDefaultBundle(WebResponse response){ 119 formatAndTest(TEST_VAL_FR, response.getText()); 120 } 121 122 123 public void testMessageTagNoArgKeyNoScopeAlternateBundle_fr() throws Exception { 124 runMyTest("testMessageTagNoArgKeyNoScopeAlternateBundle", new Locale ("fr","fr")); 125 } 126 public void endMessageTagNoArgKeyNoScopeAlternateBundle(WebResponse response){ 127 formatAndTest(TEST_VAL_FR, response.getText()); 128 } 129 130 public void testMessageTagNoArgKeyApplicationScopeAlternateBundle_fr() throws Exception { 131 runMyTest("testMessageTagNoArgKeyApplicationScopeAlternateBundle", new Locale ("fr","fr")); 132 } 133 public void endMessageTagNoArgKeyApplicationScopeAlternateBundle(WebResponse response){ 134 formatAndTest(TEST_VAL_FR, response.getText()); 135 } 136 137 public void testMessageTagNoArgKeySessionScopeAlternateBundle_fr() throws Exception { 138 runMyTest("testMessageTagNoArgKeySessionScopeAlternateBundle", new Locale ("fr","fr")); 139 } 140 public void endMessageTagNoArgKeySessionScopeAlternateBundle(WebResponse response){ 141 formatAndTest(TEST_VAL_FR, response.getText()); 142 } 143 144 public void testMessageTagNoArgKeyRequestScopeAlternateBundle_fr() throws Exception { 145 runMyTest("testMessageTagNoArgKeyRequestScopeAlternateBundle", new Locale ("fr","fr")); 146 } 147 public void endMessageTagNoArgKeyRequestScopeAlternateBundle(WebResponse response){ 148 formatAndTest(TEST_VAL_FR, response.getText()); 149 } 150 151 152 153 public void testMessageTagNoArgNameNoScopeDefaultBundle_fr() throws Exception { 154 runMyTest("testMessageTagNoArgNameNoScopeDefaultBundle", new Locale ("fr","fr")); 155 } 156 public void endMessageTagNoArgNameNoScopeDefaultBundle(WebResponse response){ 157 formatAndTest(TEST_VAL_FR, response.getText()); 158 } 159 160 public void testMessageTagNoArgNameApplicationScopeDefaultBundle_fr() throws Exception { 161 runMyTest("testMessageTagNoArgNameApplicationScopeDefaultBundle", new Locale ("fr","fr")); 162 } 163 public void endMessageTagNoArgNameApplicationScopeDefaultBundle(WebResponse response){ 164 formatAndTest(TEST_VAL_FR, response.getText()); 165 } 166 167 public void testMessageTagNoArgNameSessionScopeDefaultBundle_fr() throws Exception { 168 runMyTest("testMessageTagNoArgNameSessionScopeDefaultBundle", new Locale ("fr","fr")); 169 } 170 public void endMessageTagNoArgNameSessionScopeDefaultBundle(WebResponse response){ 171 formatAndTest(TEST_VAL_FR, response.getText()); 172 } 173 174 public void testMessageTagNoArgNameRequestScopeDefaultBundle_fr() throws Exception { 175 runMyTest("testMessageTagNoArgNameRequestScopeDefaultBundle", new Locale ("fr","fr")); 176 } 177 public void endMessageTagNoArgNameRequestScopeDefaultBundle(WebResponse response){ 178 formatAndTest(TEST_VAL_FR, response.getText()); 179 } 180 181 182 public void testMessageTagNoArgNameNoScopeAlternateBundle_fr() throws Exception { 183 runMyTest("testMessageTagNoArgNameNoScopeAlternateBundle", new Locale ("fr","fr")); 184 } 185 public void endMessageTagNoArgNameNoScopeAlternateBundle(WebResponse response){ 186 formatAndTest(TEST_VAL_FR, response.getText()); 187 } 188 189 public void testMessageTagNoArgNameApplicationScopeAlternateBundle_fr() throws Exception { 190 runMyTest("testMessageTagNoArgNameApplicationScopeAlternateBundle", new Locale ("fr","fr")); 191 } 192 public void endMessageTagNoArgNameApplicationScopeAlternateBundle(WebResponse response){ 193 formatAndTest(TEST_VAL_FR, response.getText()); 194 } 195 196 public void testMessageTagNoArgNameSessionScopeAlternateBundle_fr() throws Exception { 197 runMyTest("testMessageTagNoArgNameSessionScopeAlternateBundle", new Locale ("fr","fr")); 198 } 199 public void endMessageTagNoArgNameSessionScopeAlternateBundle(WebResponse response){ 200 formatAndTest(TEST_VAL_FR, response.getText()); 201 } 202 203 public void testMessageTagNoArgNameRequestScopeAlternateBundle_fr() throws Exception { 204 runMyTest("testMessageTagNoArgNameRequestScopeAlternateBundle", new Locale ("fr","fr")); 205 } 206 public void endMessageTagNoArgNameRequestScopeAlternateBundle(WebResponse response){ 207 formatAndTest(TEST_VAL_FR, response.getText()); 208 } 209 210 211 212 213 public void testMessageTagNoArgNamePropertyNoScopeDefaultBundle_fr() throws Exception { 214 pageContext.setAttribute("key", new SimpleBeanForTesting("default.bundle.message"), PageContext.REQUEST_SCOPE); 215 runMyTest("testMessageTagNoArgNamePropertyNoScopeDefaultBundle", new Locale ("fr","fr")); 216 } 217 public void endMessageTagNoArgNamePropertyNoScopeDefaultBundle(WebResponse response){ 218 formatAndTest(TEST_VAL_FR, response.getText()); 219 } 220 221 public void testMessageTagNoArgNamePropertyApplicationScopeDefaultBundle_fr() throws Exception { 222 pageContext.setAttribute("key", new SimpleBeanForTesting("default.bundle.message"), PageContext.APPLICATION_SCOPE); 223 runMyTest("testMessageTagNoArgNamePropertyApplicationScopeDefaultBundle", new Locale ("fr","fr")); 224 } 225 public void endMessageTagNoArgNamePropertyApplicationScopeDefaultBundle(WebResponse response){ 226 formatAndTest(TEST_VAL_FR, response.getText()); 227 } 228 229 public void testMessageTagNoArgNamePropertySessionScopeDefaultBundle_fr() throws Exception { 230 pageContext.setAttribute("key", new SimpleBeanForTesting("default.bundle.message"), PageContext.SESSION_SCOPE); 231 runMyTest("testMessageTagNoArgNamePropertySessionScopeDefaultBundle", new Locale ("fr","fr")); 232 } 233 public void endMessageTagNoArgNamePropertySessionScopeDefaultBundle(WebResponse response){ 234 formatAndTest(TEST_VAL_FR, response.getText()); 235 } 236 237 public void testMessageTagNoArgNamePropertyRequestScopeDefaultBundle_fr() throws Exception { 238 pageContext.setAttribute("key", new SimpleBeanForTesting("default.bundle.message"), PageContext.REQUEST_SCOPE); 239 runMyTest("testMessageTagNoArgNamePropertyRequestScopeDefaultBundle", new Locale ("fr","fr")); 240 } 241 public void endMessageTagNoArgNamePropertyRequestScopeDefaultBundle(WebResponse response){ 242 formatAndTest(TEST_VAL_FR, response.getText()); 243 } 244 245 246 public void testMessageTagNoArgNamePropertyNoScopeAlternateBundle_fr() throws Exception { 247 pageContext.setAttribute("key", new SimpleBeanForTesting("alternate.bundle.message"), PageContext.REQUEST_SCOPE); 248 runMyTest("testMessageTagNoArgNamePropertyNoScopeAlternateBundle", new Locale ("fr","fr")); 249 } 250 public void endMessageTagNoArgNamePropertyNoScopeAlternateBundle(WebResponse response){ 251 formatAndTest(TEST_VAL_FR, response.getText()); 252 } 253 254 public void testMessageTagNoArgNamePropertyApplicationScopeAlternateBundle_fr() throws Exception { 255 pageContext.setAttribute("key", new SimpleBeanForTesting("alternate.bundle.message"), PageContext.APPLICATION_SCOPE); 256 runMyTest("testMessageTagNoArgNamePropertyApplicationScopeAlternateBundle", new Locale ("fr","fr")); 257 } 258 public void endMessageTagNoArgNamePropertyApplicationScopeAlternateBundle(WebResponse response){ 259 formatAndTest(TEST_VAL_FR, response.getText()); 260 } 261 262 public void testMessageTagNoArgNamePropertySessionScopeAlternateBundle_fr() throws Exception { 263 pageContext.setAttribute("key", new SimpleBeanForTesting("alternate.bundle.message"), PageContext.SESSION_SCOPE); 264 runMyTest("testMessageTagNoArgNamePropertySessionScopeAlternateBundle", new Locale ("fr","fr")); 265 } 266 public void endMessageTagNoArgNamePropertySessionScopeAlternateBundle(WebResponse response){ 267 formatAndTest(TEST_VAL_FR, response.getText()); 268 } 269 270 public void testMessageTagNoArgNamePropertyRequestScopeAlternateBundle_fr() throws Exception { 271 pageContext.setAttribute("key", new SimpleBeanForTesting("alternate.bundle.message"), PageContext.REQUEST_SCOPE); 272 runMyTest("testMessageTagNoArgNamePropertyRequestScopeAlternateBundle", new Locale ("fr","fr")); 273 } 274 public void endMessageTagNoArgNamePropertyRequestScopeAlternateBundle(WebResponse response){ 275 formatAndTest(TEST_VAL_FR, response.getText()); 276 } 277 278 279 280 281 282 283 284 285 } 286 | Popular Tags |