tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mindbri...@apache.org
Subject cvs commit: jakarta-tapestry/junit/mock-scripts TestTemplateEncoding.xml
Date Sun, 06 Jun 2004 08:50:50 GMT
mindbridge    2004/06/06 01:50:50

  Modified:    junit/context28/WEB-INF Charset_bg.html Charset.html
                        Charset.jwc
               junit/src/org/apache/tapestry/junit BasicTestSuite.java
               junit/mock-scripts TestTemplateEncoding.xml
  Added:       junit/context28/WEB-INF Charset_zh.properties
                        Charset_bg.properties Charset_de.properties
                        Charset_zh_TW.properties
               junit/src/org/apache/tapestry/junit BadQuoting1.properties
                        CyrillicProperties.properties
                        StandardProperties.properties
                        UTFProperties.properties
                        TestLocalizedProperties.java
                        StandardCyrillicProperties.properties
                        StandardUTFProperties.properties
                        BadQuoting2.properties
  Log:
  Unit tests for reading the property files using an appropriate character set
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-tapestry/junit/context28/WEB-INF/Charset_bg.html
  
  Index: Charset_bg.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context28/WEB-INF/Charset_bg.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Charset_bg.html	29 Jun 2003 18:23:26 -0000	1.1
  +++ Charset_bg.html	6 Jun 2004 08:50:50 -0000	1.2
  @@ -1 +1 @@
  -<span jwcid="@Insert" value=""/>
  \ No newline at end of file
  +<span jwcid="@Insert" value=""/> <span key="language"/>
  \ No newline at end of file
  
  
  
  1.2       +1 -1      jakarta-tapestry/junit/context28/WEB-INF/Charset.html
  
  Index: Charset.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context28/WEB-INF/Charset.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Charset.html	29 Jun 2003 18:23:26 -0000	1.1
  +++ Charset.html	6 Jun 2004 08:50:50 -0000	1.2
  @@ -1 +1 @@
  -Default
  \ No newline at end of file
  +Default <span key="language"/>
  \ No newline at end of file
  
  
  
  1.3       +5 -3      jakarta-tapestry/junit/context28/WEB-INF/Charset.jwc
  
  Index: Charset.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context28/WEB-INF/Charset.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Charset.jwc	29 Feb 2004 18:49:16 -0000	1.2
  +++ Charset.jwc	6 Jun 2004 08:50:50 -0000	1.3
  @@ -21,8 +21,6 @@
   
   <component-specification>
   
  -	<property name="org.apache.tapestry.template-encoding" value="ISO-8859-1"/>
  -
   	<property name="org.apache.tapestry.template-encoding_bg" value="ISO-8859-5"/>
   	<property name="org.apache.tapestry.template-encoding_bg_BG" value="UTF-8"/>
   
  @@ -31,4 +29,8 @@
   
   	<property name="org.apache.tapestry.template-encoding_es" value="UTF-16"/>
   
  +    
  +	<property name="org.apache.tapestry.messages-encoding_zh" value="UTF-8"/>
  +	<property name="org.apache.tapestry.messages-encoding_zh_TW" value="Big5"/>
  +    
   </component-specification>
  
  
  
  1.1                  jakarta-tapestry/junit/context28/WEB-INF/Charset_zh.properties
  
  	<<Binary file>>
  
  
  1.1                  jakarta-tapestry/junit/context28/WEB-INF/Charset_bg.properties
  
  Index: Charset_bg.properties
  ===================================================================
  language=
  
  
  1.1                  jakarta-tapestry/junit/context28/WEB-INF/Charset_de.properties
  
  Index: Charset_de.properties
  ===================================================================
  language=sprache
  
  
  1.1                  jakarta-tapestry/junit/context28/WEB-INF/Charset_zh_TW.properties
  
  Index: Charset_zh_TW.properties
  ===================================================================
  language=y
  
  
  1.14      +2 -1      jakarta-tapestry/junit/src/org/apache/tapestry/junit/BasicTestSuite.java
  
  Index: BasicTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/BasicTestSuite.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BasicTestSuite.java	30 Apr 2004 15:17:56 -0000	1.13
  +++ BasicTestSuite.java	6 Jun 2004 08:50:50 -0000	1.14
  @@ -83,6 +83,7 @@
           suite.addTestSuite(TestContentType.class);
           suite.addTestSuite(TestRequestCycleToString.class);
           suite.addTestSuite(TestDirection.class);
  +        suite.addTestSuite(TestLocalizedProperties.class);
   
           return suite;
       }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/BadQuoting1.properties
  
  Index: BadQuoting1.properties
  ===================================================================
  invalid\xescape = nop\u0GFE
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/CyrillicProperties.properties
  
  Index: CyrillicProperties.properties
  ===================================================================
  Tapestry = 
   : Tapestry
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/StandardProperties.properties
  
  Index: StandardProperties.properties
  ===================================================================
  first=property
                  
  # comment line
  ! different comment line
  
  another 	= one
     other	: one
  just another : one
  and another one
  yet\ another:one
  invalid\xescape = nop\u00D2e
  strange \: test
  weird \ : test  
  long\
  key test
  longvalue = value \
  			test   
  longer\
  # comment in the middle of a continuation
  single
  = empty key
  quoting test \
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/UTFProperties.properties
  
  	<<Binary file>>
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/TestLocalizedProperties.java
  
  Index: TestLocalizedProperties.java
  ===================================================================
  //Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry.junit;
  
  import java.io.InputStream;
  import java.util.Properties;
  
  import org.apache.tapestry.util.text.LocalizedProperties;
  
  /**
   * Tests to ensure that LocalizedProperties are fully backward compatible
   * with java.util.Properties and that non-latin characters are read correctly.
   * 
   * @author mb
   * @version $Id: TestLocalizedProperties.java,v 1.1 2004/06/06 08:50:50 mindbridge Exp $
   * @since 3.1
   */
  public class TestLocalizedProperties extends TapestryTestCase
  {
  	private void ensureEquivalence(String fileName)
  	{
  		ensureEquivalence(fileName, fileName, "ISO-8859-1");
  	}
  	
  	private void ensureEquivalence(String fileName1, String fileName2, String encoding)
  	{
  		InputStream standardIns = getClass().getResourceAsStream(fileName1);
  		Properties standard = new Properties();
  		Exception standardException = null;
  		try {
  			standard.load(standardIns);
  		} catch (Exception e) {
  			standardException = e;
  		}
  		
  		InputStream localizedIns = getClass().getResourceAsStream(fileName2);
  		Properties localized = new Properties();
  		LocalizedProperties localizedProperties = new LocalizedProperties(localized);
  		Exception localizedException = null;
  		try {
  			localizedProperties.load(localizedIns, encoding);
  		} catch (Exception e) {
  			localizedException = e;
  		}
  		
  		if (standardException == null && localizedException == null) 
  			assertEquals("The property content does not match", standard, localized);
  		else if (standardException == null && localizedException != null)
  			fail("Properties did not throw an exception, but LocalizedProperties did: " + localizedException);
  		else if (standardException != null && localizedException == null)
  			fail("LocalizedProperties did not throw an exception, but Properties did: " + localizedException);
  		// this test is disabled because in some cases Properties throws an incorrect exception
probably due to a bug
  		//else if (standardException != null && localizedException != null)
  		//	assertEquals("The exception types do not match", standardException.getClass(), localizedException.getClass());
  	}
  	
  	/**
  	 * Test for the equivalence between Properties and LocalizedProperties for latin properties
  	 */
  	public void testEquivalence()
  	{
  		ensureEquivalence("StandardProperties.properties");
  		ensureEquivalence("BadQuoting1.properties");
  		ensureEquivalence("BadQuoting2.properties");
  	}
  	
  	/**
  	 * Tests the reading of files using different encodings. Compare it with the reading of
  	 * files that have gone through native2ascii and read using Properties.
  	 */
  	public void testEncodings()
  	{
  		ensureEquivalence("StandardUTFProperties.properties", "UTFProperties.properties", "utf-8");
  		ensureEquivalence("StandardCyrillicProperties.properties", "CyrillicProperties.properties",
"ISO-8859-5");
  	}
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/StandardCyrillicProperties.properties
  
  Index: StandardCyrillicProperties.properties
  ===================================================================
  Tapestry = \u0413\u043e\u0431\u043b\u0435\u043d
  \u0413\u043e\u0431\u043b\u0435\u043d : Tapestry
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/StandardUTFProperties.properties
  
  Index: StandardUTFProperties.properties
  ===================================================================
  Tapestry = \u0413\u043e\u0431\u043b\u0435\u043d
  \u0413\u043e\u0431\u043b\u0435\u043d : \u30bf\u30da\u30b9\u30c8\u30ea\u30fc
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/BadQuoting2.properties
  
  Index: BadQuoting2.properties
  ===================================================================
  invalid\xescape = nop\u
  
  
  1.4       +120 -3    jakarta-tapestry/junit/mock-scripts/TestTemplateEncoding.xml
  
  Index: TestTemplateEncoding.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/mock-scripts/TestTemplateEncoding.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestTemplateEncoding.xml	9 Mar 2004 22:09:52 -0000	1.3
  +++ TestTemplateEncoding.xml	6 Jun 2004 08:50:50 -0000	1.4
  @@ -84,7 +84,13 @@
   
   		<assert-output name="Language Name">
   <![CDATA[
  -&#1057;&#1114;&#1099;&#1091;&#1088;&#8470;&#1105;&#1098;&#1096;
  +&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Word">
  +<![CDATA[
  +&#1045;&#1079;&#1080;&#1082;
   ]]>
   		</assert-output>
   	</request>
  @@ -105,10 +111,121 @@
   
   		<assert-output name="Language Name">
   <![CDATA[
  -&#1057;&#1114;&#1099;&#1091;&#1088;&#8470;&#1105;&#1098;&#1096;
  +&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Word">
  +<![CDATA[
  +&#1045;&#1079;&#1080;&#1082;
  +]]>
  +		</assert-output>
  +	</request>
  +	
  +	<request>
  +		<parameter name="service" value="direct/0/Home/$DirectLink"/>
  +	  	<parameter name="sp">
  +	  		<value>STwo</value>
  +	  		<value>Sde</value>
  +	  	</parameter>
  +
  +		<assert-output name="Page Title">
  +<![CDATA[
  +<title>Two</title>
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Name">
  +<![CDATA[
  +Default
  +]]>
  +		</assert-output>
  +        
  +		<assert-output name="Language Word">
  +<![CDATA[
  +sprache
   ]]>
   		</assert-output>
   	</request>
   	
  +	
  +	<request>
  +		<parameter name="service" value="direct/0/Home/$DirectLink"/>
  +	  	<parameter name="sp">
  +	  		<value>STwo</value>
  +	  		<value>Sde_DE</value>
  +	  	</parameter>
   
  +		<assert-output name="Page Title">
  +<![CDATA[
  +<title>Two</title>
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Name">
  +<![CDATA[
  +Default
  +]]>
  +		</assert-output>
  +        
  +		<assert-output name="Language Word">
  +<![CDATA[
  +sprache
  +]]>
  +		</assert-output>
  +	</request>
  +
  +	
  +	<request>
  +		<parameter name="service" value="direct/0/Home/$DirectLink"/>
  +	  	<parameter name="sp">
  +	  		<value>STwo</value>
  +	  		<value>Szh_TW</value>
  +	  	</parameter>
  +
  +		<assert-output name="Page Title">
  +<![CDATA[
  +<title>Two</title>
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Name">
  +<![CDATA[
  +Default
  +]]>
  +		</assert-output>
  +        
  +		<assert-output name="Language Word">
  +<![CDATA[
  +&#35486;&#35328;
  +]]>
  +		</assert-output>
  +	</request>
  +    
  +	<request>
  +		<parameter name="service" value="direct/0/Home/$DirectLink"/>
  +	  	<parameter name="sp">
  +	  		<value>STwo</value>
  +	  		<value>Szh</value>
  +	  	</parameter>
  +
  +		<assert-output name="Page Title">
  +<![CDATA[
  +<title>Two</title>
  +]]>
  +		</assert-output>
  +
  +		<assert-output name="Language Name">
  +<![CDATA[
  +Default
  +]]>
  +		</assert-output>
  +        
  +		<assert-output name="Language Word">
  +<![CDATA[
  +&#35821;&#35328;
  +]]>
  +		</assert-output>
  +	</request>
  +    
   </mock-test>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message