harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r693711 - in /harmony/enhanced/classlib/trunk/modules/beans/src/test: java/org/apache/harmony/beans/tests/java/beans/ resources/xml/
Date Wed, 10 Sep 2008 06:09:32 GMT
Author: qiuxx
Date: Tue Sep  9 23:09:32 2008
New Revision: 693711

URL: http://svn.apache.org/viewvc?rev=693711&view=rev
Log:
Apply for HARMONY-5974, ([classlib] [beans] XMLEncoderTest.assertCodedXML(Object obj, String
xmlFile,ByteArrayOutputStream temp, XMLEncoder enc) should be modified)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_BornFriendChange.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges_2.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_NoChange.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwner.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField_Original.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test6.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test7.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/bad_int.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/int.xml
    harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/null.xml

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
Tue Sep  9 23:09:32 2008
@@ -24,12 +24,14 @@
 import java.beans.PersistenceDelegate;
 import java.beans.Statement;
 import java.beans.XMLEncoder;
+import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
+import java.io.StringReader;
 
 import junit.framework.TestCase;
 
@@ -372,13 +374,13 @@
 
         InputStream refIn;
         InputStreamReader xml;
-        InputStreamReader refXml;
 
         XMLReader xmlReader;
         XMLReader refXmlReader;
         TestEventHandler handler = new TestEventHandler();
         TestEventHandler refHandler = new TestEventHandler();
         String saxParserClassName = System.getProperty("org.xml.sax.driver");
+        String version = System.getProperty("java.version");
 
         if (enc == null || temp == null) {
             temp = new ByteArrayOutputStream();
@@ -387,15 +389,24 @@
         enc.writeObject(obj);
         enc.close();
         byte bytes[] = temp.toByteArray();
-
+        xml = new InputStreamReader(new ByteArrayInputStream(bytes), "UTF-8");
         refIn = XMLEncoderTest.class.getResourceAsStream(xmlFile);
         if (refIn == null) {
             throw new Error("resource " + xmlFile + " not exist in "
                     + XMLEncoderTest.class.getPackage());
         }
-        xml = new InputStreamReader(new ByteArrayInputStream(bytes), "UTF-8");
-        refXml = new InputStreamReader(refIn, "UTF-8");
-
+        BufferedReader br = new BufferedReader(new InputStreamReader(refIn, "UTF-8"));
+        StringBuilder sb = new StringBuilder();
+        String line = null;
+        while((line = br.readLine()) != null){
+        	sb.append(line + "\n");
+        }
+        refIn.close();
+        String refString = sb.toString();
+        refString = refString.replace("${version}", version);
+        if(obj != null){
+        	refString = refString.replace("${classname}", obj.getClass().getName());
+        }
         if (saxParserClassName == null) {
             saxParserClassName = "org.apache.xerces.parsers.SAXParser";
         }
@@ -408,7 +419,7 @@
         refXmlReader = XMLReaderFactory.createXMLReader(saxParserClassName);
         refXmlReader.setContentHandler(refHandler);
         refXmlReader.setErrorHandler(refHandler);
-        refXmlReader.parse(new InputSource(refXml));
+        refXmlReader.parse(new InputSource(new StringReader(refString)));
 
         assertEquals("Generated XML differs from the sample,", refHandler.root,
                 handler.root);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_BornFriendChange.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_BornFriendChange.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_BornFriendChange.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_BornFriendChange.xml
Tue Sep  9 23:09:32 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
- <object class="org.apache.harmony.beans.tests.java.beans.mock.MockBean4Codec"> 
+<java version="${version}" class="java.beans.XMLDecoder"> 
+    <object class="${classname}"> 
   <void id="MockBean4CodecPrimitives0" property="bornFriend"> 
    <void property="zarr"> 
     <void index="0"> 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges.xml
Tue Sep  9 23:09:32 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
- <object id="MockBean4Codec0" class="org.apache.harmony.beans.tests.java.beans.mock.MockBean4Codec">

+<java version="${version}" class="java.beans.XMLDecoder">
+    <object id="MockBean4Codec0" class="${classname}">
   <void property="b"> 
    <byte>127</byte> 
   </void> 
@@ -48,9 +48,9 @@
    <float>12.34</float> 
   </void> 
   <void property="friend"> 
-   <object class="tests.api.java.beans.mock.MockBean4Codec"> 
+    <object class="${classname}">
     <void property="clazz"> 
-     <class>tests.api.java.beans.mock.MockBean4Codec</class> 
+    <class>${classname}</class>
     </void> 
    </object> 
   </void> 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges_2.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges_2.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges_2.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_ManyChanges_2.xml
Tue Sep  9 23:09:32 2008
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2 subset" class="java.beans.XMLDecoder">
+<java version="${version}" class="java.beans.XMLDecoder">
  <object class="org.apache.harmony.beans.tests.java.beans.mock.MockBean4Codec">
   <void property="bornFriend">
    <void property="clazz">

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_NoChange.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_NoChange.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_NoChange.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Codec_NoChange.xml
Tue Sep  9 23:09:32 2008
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
- <object class="org.apache.harmony.beans.tests.java.beans.mock.MockBean4Codec"/> 
+<java version="${version}" class="java.beans.XMLDecoder"> 
+ <object class="${classname}"/> 
 </java> 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwner.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwner.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwner.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwner.xml
Tue Sep  9 23:09:32 2008
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2 subset" class="java.beans.XMLDecoder">
+<java version="${version}" class="java.beans.XMLDecoder">
  <void id="MockBean4Owner_Owner0" property="owner"/>
- <object class="org.apache.harmony.beans.tests.java.beans.MockBean4Owner_Target">
+ <object class="${classname}">
   <void property="v">
    <object idref="MockBean4Owner_Owner0"/>
   </void>

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml
Tue Sep  9 23:09:32 2008
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2 subset" class="java.beans.XMLDecoder">
+<java version="${version}" class="java.beans.XMLDecoder">
  <void id="MockBean4Owner_Owner0" property="owner">
   <void method="loading"/>
  </void>
- <object class="org.apache.harmony.beans.tests.java.beans.MockBean4Owner_Target">
+ <object class="${classname}">
   <void property="v">
    <object idref="MockBean4Owner_Owner0"/>
   </void>

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField.xml
Tue Sep  9 23:09:32 2008
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2 subset" class="java.beans.XMLDecoder">
- <object class="org.apache.harmony.beans.tests.java.beans.MockBean4StaticField" field="inst"/>
+<java version="${version}" class="java.beans.XMLDecoder">
+    <object class="${classname}" field="inst"/>
 </java>

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField_Original.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField_Original.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField_Original.xml
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/MockBean4StaticField_Original.xml
Tue Sep  9 23:09:32 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2 subset" class="java.beans.XMLDecoder">
- <void class="org.apache.harmony.beans.tests.java.beans.MockBean4StaticField" method="getField">
+<java version="${version}" class="java.beans.XMLDecoder">
+ <void class="${classname}">
   <string>inst</string>
   <void id="A0" method="get">
    <null/>

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test6.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test6.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test6.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test6.xml Tue Sep
 9 23:09:32 2008
@@ -20,12 +20,12 @@
 Author:  Maxim V. Berkultsev
 Version: $Revision: 1.1.6.3 $
 -->
-<java version="1.4.2_04" class="java.beans.XMLDecoder">
- <object id="SampleBean0" class="org.apache.harmony.tests.java.beans.auxiliary.SampleBean">
+<java version="${version}" class="java.beans.XMLDecoder">
+ <object id="SampleBean0" class="${classname}">
   <void property="object">
-   <object id="SampleBean1" class="org.apache.harmony.tests.java.beans.auxiliary.SampleBean">
+   <object id="SampleBean1" class="${classname}">
     <void property="object">
-     <object id="SampleBean2" class="org.apache.harmony.tests.java.beans.auxiliary.SampleBean">
+     <object id="SampleBean2" class="${classname}">
       <void property="object">
        <object idref="SampleBean0"/>
       </void>

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test7.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test7.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test7.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/Test7.xml Tue Sep
 9 23:09:32 2008
@@ -20,7 +20,7 @@
 Author:  Maxim V. Berkultsev
 Version: $Revision: 1.1.6.3 $
 -->
-<java version="1.4.2_04" class="java.beans.XMLDecoder">
+<java version="${version}" class="java.beans.XMLDecoder">
 
  <array class="java.lang.String" length="2">
   <void index="0">

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/bad_int.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/bad_int.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/bad_int.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/bad_int.xml Tue Sep
 9 23:09:32 2008
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
+<java version="${version}" class="java.beans.XMLDecoder"> 
  <int>3</inta> 
 </java> 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/int.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/int.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/int.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/int.xml Tue Sep 
9 23:09:32 2008
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
+<java version="${version}" class="java.beans.XMLDecoder"> 
  <int>3</int> 
 </java> 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/null.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/null.xml?rev=693711&r1=693710&r2=693711&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/null.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/xml/null.xml Tue Sep
 9 23:09:32 2008
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?> 
-<java version="1.4.2_07" class="java.beans.XMLDecoder"> 
+<java version="${version}" class="java.beans.XMLDecoder"> 
  <null/> 
 </java> 



Mime
View raw message