]> source.dussan.org Git - archiva.git/commitdiff
Fixes for tests under windows.
authorJoakim Erdfelt <joakime@apache.org>
Thu, 26 Apr 2007 14:57:16 +0000 (14:57 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Thu, 26 Apr 2007 14:57:16 +0000 (14:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@532767 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java
archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/LatinEntitiesTest.java
archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java

index 6985ef06ad6e1ddeb4ac04dc553835e19b95fb62..900b7e7c9c14d286689cffd7108e4f9ecb6e25a4 100644 (file)
@@ -102,7 +102,7 @@ public class XMLReader
         try
         {
             InputStream in = url.openStream();
-            InputStreamReader inReader = new InputStreamReader( in );
+            InputStreamReader inReader = new InputStreamReader( in, "UTF-8" );
             LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader );
             this.document = reader.read( latinReader );
         }
index c2424f368e5a4e12b8da6352289c787573156c4f..396d4b95238f834f1344817003b72619f1f86270 100644 (file)
@@ -33,9 +33,9 @@ public class LatinEntitiesTest
     public void testResolveEntity()
     {
         // Good Entities.
-        assertEquals( "©", LatinEntities.resolveEntity( "&copy;" ) );
-        assertEquals( "", LatinEntities.resolveEntity( "&infin;" ) );
-        assertEquals( "ø", LatinEntities.resolveEntity( "&oslash;" ) );
+        assertEquals( "\u00a9", LatinEntities.resolveEntity( "&copy;" ) );
+        assertEquals( "\u221e", LatinEntities.resolveEntity( "&infin;" ) );
+        assertEquals( "\u00f8", LatinEntities.resolveEntity( "&oslash;" ) );
 
         // Bad Entities.
         assertEquals( "", LatinEntities.resolveEntity( "" ) );
index b02daeca30a0a92f9f75c5ea2092d23d48408a21..7cf8853f7b9834a5c10e51b703c1ed8d856b9dc8 100644 (file)
@@ -35,6 +35,11 @@ import java.util.List;
 public class XMLReaderTest
     extends AbstractArchivaXmlTestCase
 {
+    private static final String OSLASH = "\u00f8";
+    private static final String TRYGVIS = "Trygve Laugst" + OSLASH + "l";
+    private static final String INFIN = "\u221e";
+    private static final String INFINITE_ARCHIVA = "The " + INFIN + " Archiva";
+    
     private void assertElementTexts( List elementList, String[] expectedTexts )
     {
         assertEquals( "Element List Size", expectedTexts.length, elementList.size() );
@@ -70,7 +75,7 @@ public class XMLReaderTest
         XMLReader reader = new XMLReader( "basic", xmlFile );
 
         List names = reader.getElementList( "//basic/names/name" );
-        assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } );
+        assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
     }
 
     public void testNoPrologUtf8Read()
@@ -80,7 +85,7 @@ public class XMLReaderTest
         XMLReader reader = new XMLReader( "basic", xmlFile );
 
         List names = reader.getElementList( "//basic/names/name" );
-        assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } );
+        assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
     }
 
     public void testPrologUtf8Read()
@@ -90,7 +95,7 @@ public class XMLReaderTest
         XMLReader reader = new XMLReader( "basic", xmlFile );
 
         List names = reader.getElementList( "//basic/names/name" );
-        assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } );
+        assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
     }
 
 }