jmitchell    2003/02/26 16:02:05

  Modified:    src/test/org/apache/struts/taglib/bean TestWriteTag.java
               web/test/test/org/apache/struts/taglib/bean TestWriteTag.jsp
  Log:
  Fix tests where users locale is "fr".
  
  Revision  Changes    Path
  1.2       +36 -38    
jakarta-struts/src/test/org/apache/struts/taglib/bean/TestWriteTag.java
  
  Index: TestWriteTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/bean/TestWriteTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestWriteTag.java 22 Feb 2003 02:48:09 -0000      1.1
  +++ TestWriteTag.java 27 Feb 2003 00:02:04 -0000      1.2
  @@ -122,124 +122,122 @@
            assertEquals(compare, output);
        }
   
  +    private void runMyTest(String whichTest, String locale){
  +     pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), 
PageContext.SESSION_SCOPE);
  +             request.setAttribute("runTest", whichTest);
  +        try {
  +                     
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             }
  +             catch (Exception e) {
  +                     e.printStackTrace();
  +                     fail("There is a problem that is preventing the tests to 
continue!");
  +             }
  +    }
  +
        // Name
  -    public void testWriteTagName() throws IOException, ServletException{
  -             request.setAttribute("runTest", "testWriteTagName");
  +    public void testWriteTagName(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_STRING_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagName", "");
        }
        public void endWriteTagName(WebResponse response){
                formatAndTest(TEST_STRING_VAL, response.getText());
        }
        
        // Property
  -    public void testWriteTagNameProperty() throws IOException, ServletException{
  +    public void testWriteTagNameProperty() {
        SimpleBeanForTesting sbft = new SimpleBeanForTesting(TEST_STRING_VAL);
  -             request.setAttribute("runTest", "testWriteTagNameProperty");
                pageContext.setAttribute(REQUEST_KEY, sbft,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameProperty", "");
        }
        public void endWriteTagNameProperty(WebResponse response){
                formatAndTest(TEST_STRING_VAL, response.getText());
        }
        
        // Name and Format
  -    public void testWriteTagNameFormat() throws IOException, ServletException{
  -             request.setAttribute("runTest", "testWriteTagNameFormat");
  +    public void testWriteTagNameFormat(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_INTEGER_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormat", "");
        }
        public void endWriteTagNameFormat(WebResponse response){
                formatAndTest("1,234" , response.getText());
        }
        
        // Name, Format, and FormatKey (default bundle)
  -    public void testWriteTagNameFormatKeyDefaultBundle() throws IOException, 
ServletException{
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyDefaultBundle");
  +    public void testWriteTagNameFormatKeyDefaultBundle(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_INTEGER_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyDefaultBundle", "");
        }
        public void endWriteTagNameFormatKeyDefaultBundle(WebResponse response){
                formatAndTest("$1,234" , response.getText());
        }
        
        // Name, Format, and FormatKey (alternate bundle)
  -    public void testWriteTagNameFormatKeyAlternateBundle() throws IOException, 
ServletException{
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyAlternateBundle");
  +    public void testWriteTagNameFormatKeyAlternateBundle(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_INTEGER_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyAlternateBundle", "");
        }
        public void endWriteTagNameFormatKeyAlternateBundle(WebResponse response){
                formatAndTest("$1,234" , response.getText());
        }
        
        // Name, Format, and FormatKey (default bundle) (Double)
  -    public void testWriteTagNameFormatKeyDefaultBundleDouble() throws IOException, 
ServletException{
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyDefaultBundle");
  +    public void testWriteTagNameFormatKeyDefaultBundleDouble(){
                pageContext.setAttribute(REQUEST_KEY, 
TEST_DOUBLE_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyDefaultBundleDouble", "");
        }
        public void endWriteTagNameFormatKeyDefaultBundleDouble(WebResponse response){
                formatAndTest("$1,235" , response.getText());
        }
        
        // Name, Format, and FormatKey (alternate bundle) (Double)
  -    public void testWriteTagNameFormatKeyAlternateBundleDouble() throws 
IOException, ServletException{
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyAlternateBundle");
  +    public void testWriteTagNameFormatKeyAlternateBundleDouble(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_DOUBLE_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyAlternateBundleDouble", "");
        }
        public void endWriteTagNameFormatKeyAlternateBundleDouble(WebResponse 
response){
                formatAndTest("$1,234.6" , response.getText());
        }
        
        // Name, Format, and FormatKey (default bundle)
  -    public void testWriteTagNameFormatKeyDefaultBundle_fr() throws IOException, 
ServletException{
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyDefaultBundle");
  -     pageContext.setAttribute(Globals.LOCALE_KEY, new Locale("fr","fr"), 
PageContext.SESSION_SCOPE);
  +    public void testWriteTagNameFormatKeyDefaultBundle_fr(){
                pageContext.setAttribute(REQUEST_KEY, 
TEST_DOUBLE_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyDefaultBundle", "fr");
        }
        public void endWriteTagNameFormatKeyDefaultBundle_fr(WebResponse response){
                formatAndTest("$1234,5961.", response.getText());
        }
        
        // Name, Format, and FormatKey (alternate bundle)
  -    public void testWriteTagNameFormatKeyAlternateBundle_fr() throws IOException, 
ServletException{
  -     pageContext.setAttribute(Globals.LOCALE_KEY, new Locale("fr","fr"), 
PageContext.SESSION_SCOPE);
  -             request.setAttribute("runTest", 
"testWriteTagNameFormatKeyAlternateBundle");
  +    public void testWriteTagNameFormatKeyAlternateBundle_fr(){
                
pageContext.setAttribute(REQUEST_KEY,TEST_DOUBLE_VAL,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFormatKeyAlternateBundle", "fr");
        }
        public void endWriteTagNameFormatKeyAlternateBundle_fr(WebResponse response){
                formatAndTest("$1234,5961." , response.getText());
        }
        
        // Name, Property, and Format
  -    public void testWriteTagNamePropertyFormat() throws IOException, 
ServletException{
  +    public void testWriteTagNamePropertyFormat(){
        SimpleBeanForTesting sbft = new SimpleBeanForTesting(TEST_INTEGER_VAL);
  -             request.setAttribute("runTest", "testWriteTagNamePropertyFormat");
                pageContext.setAttribute(REQUEST_KEY, sbft,PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNamePropertyFormat", "");
        }
        public void endWriteTagNamePropertyFormat(WebResponse response){
                formatAndTest("1,234", response.getText());
        }
   
        // Name and ignore
  -    public void testWriteTagNameIgnore() throws IOException, ServletException{
  -             request.setAttribute("runTest", "testWriteTagNameIgnore");
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +    public void testWriteTagNameIgnore(){
  +             runMyTest("testWriteTagNameIgnore", "");
        }
        public void endWriteTagNameIgnore(WebResponse response){
                formatAndTest("", response.getText());
        }
        
        // Name and filter
  -    public void testWriteTagNameFilter() throws IOException, ServletException{
  -             request.setAttribute("runTest", "testWriteTagNameFilter");
  +    public void testWriteTagNameFilter(){
                
pageContext.setAttribute(REQUEST_KEY,"<testing&'\">",PageContext.REQUEST_SCOPE);
  -             
pageContext.forward("/test/org/apache/struts/taglib/bean/TestWriteTag.jsp");
  +             runMyTest("testWriteTagNameFilter", "");
        }
        public void endWriteTagNameFilter(WebResponse response){
                formatAndTest(ResponseUtils.filter("<testing&'\">"), 
response.getText());
  
  
  
  1.2       +8 -1      
jakarta-struts/web/test/test/org/apache/struts/taglib/bean/TestWriteTag.jsp
  
  Index: TestWriteTag.jsp
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/web/test/test/org/apache/struts/taglib/bean/TestWriteTag.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestWriteTag.jsp  22 Feb 2003 02:57:36 -0000      1.1
  +++ TestWriteTag.jsp  27 Feb 2003 00:02:05 -0000      1.2
  @@ -18,10 +18,18 @@
        <bean:write name="REQUEST_KEY" formatKey="default.format"/>
   </logic:equal>
   
  +<logic:equal name="runTest" value="testWriteTagNameFormatKeyDefaultBundleDouble">
  +     <bean:write name="REQUEST_KEY" formatKey="default.format"/>
  +</logic:equal>
  +
   <logic:equal name="runTest" value="testWriteTagNameFormatKeyAlternateBundle">
        <bean:write name="REQUEST_KEY" formatKey="alternate.format" 
bundle="alternate"/>
   </logic:equal>
   
  +<logic:equal name="runTest" value="testWriteTagNameFormatKeyAlternateBundleDouble">
  +     <bean:write name="REQUEST_KEY" formatKey="alternate.format" 
bundle="alternate"/>
  +</logic:equal>
  +
   <logic:equal name="runTest" value="testWriteTagNamePropertyFormat">
        <bean:write name="REQUEST_KEY" property="integerValue" format="###,###"/>
   </logic:equal>
  @@ -33,5 +41,4 @@
   <logic:equal name="runTest" value="testWriteTagNameFilter">
        <bean:write name="REQUEST_KEY" filter="true"/>
   </logic:equal>
  -
   
  
  
  

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

Reply via email to