CVS Update: xmlpull-api-v1/src/xml/tests

Aleksander Andrzej Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       02/08/27 23:32:57

  Modified:    .        build.xml
               doc      README_DOWNLOAD.html changes.html
               src/java/api/org/xmlpull/v1 XmlSerializer.java
               src/java/tests/org/xmlpull/v1/tests TestSerialize.java
                        TestSerializeWithNs.java
               src/xml/tests simple.xml
  Log:
  first release of development version of XmlPull 1.1.x version
  
  Revision  Changes    Path
  1.20      +14 -1     xmlpull-api-v1/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/build.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -t -w -r1.19 -r1.20
  --- build.xml	2002/08/23 21:29:49	1.19
  +++ build.xml	2002/08/28 04:32:56	1.20
  @@ -11,7 +11,7 @@
   
     <property name="name" value="XMLPULL"/>
     <property name="year" value="2002"/>
  -  <property name="version" value="1_1_1_DEV1"/>
  +  <property name="version" value="1_1_1"/>
     <property name="xmlpull_version" value="xmlpull_${version}"/>
     <property name="xmlpull_tag" value="XMLPULL_${version}"/>
     <property name="copyright"
  @@ -247,6 +247,11 @@
           <include name="tests/**"/>
         </fileset>
       </copy>
  +    <copy todir="${dist}">
  +      <fileset dir="${build}/lib">
  +        <include name="${xmlpull_version}*.jar"/>
  +      </fileset>
  +    </copy>
   
       <!-- sources should be copied after build to make it newer -->
       <mkdir dir="${dist}/src"/>
  @@ -262,6 +267,14 @@
       <mkdir dir="${dist}/${src_tests}"/>
       <copy todir="${dist}/${src_tests}">
         <fileset dir="${src_tests}">
  +        <!--include name="**"/-->
  +        <!--exclude name="**/stuff/**"/-->
  +      </fileset>
  +    </copy>
  +
  +    <mkdir dir="${dist}/${src_tests_xml}"/>
  +    <copy todir="${dist}/${src_tests_xml}">
  +      <fileset dir="${src_tests_xml}">
           <!--include name="**"/-->
           <!--exclude name="**/stuff/**"/-->
         </fileset>
  
  
  
  1.5       +7 -5      xmlpull-api-v1/doc/README_DOWNLOAD.html
  
  Index: README_DOWNLOAD.html
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/doc/README_DOWNLOAD.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -t -w -r1.4 -r1.5
  --- README_DOWNLOAD.html	2002/04/03 02:49:23	1.4
  +++ README_DOWNLOAD.html	2002/08/28 04:32:56	1.5
  @@ -7,15 +7,16 @@
   </HEAD>
   <BODY BGCOLOR="white">
   
  -<H1>XMLPULL downloads</H2>
  +<H1>XmlPull downloads</H2>
   <p>There are following file available for <a href="http://www.xmlpull.org/">
  -XMLPULL V1 API</a> that contains XMLPULL V1 API source, samples, JUnit tests, 
  +XmlPull V1 API</a> that contains XMLPULL V1 API source, samples, JUnit tests, 
   documentation and required build scripts to rebuild API and TESTS jar and rerun 
   tests.</p>
   <ul>
     <li><b>unpacked/</b> contains directory with unpacked current distribution 
     tarball (<b>xmlpull_VERSION_all.tgz) </b>so you 
  -  can browse its content before downloading</li>
  +  can browse its content before downloading (typically it is development branch, 
  +  see ddescription of versions below)</li>
     <li><b>xmlpull-tests_VERSION.jar</b>: pre-compiled .JAR files with JUnit API 
     tests that can verify that XMLPULL implementation is conforming to API defined 
     in <b>VERSION</b> of XMLPULL</li>
  @@ -29,13 +30,14 @@
     contains only API source, documentation and build scripts - it is necessary to 
     download ANT to build source and JUnit to execute conformance tests</li>
   </ul>
  -<p>&nbsp;</p>
  +<p><b>NOTE:</b> version <b>1.0.x</b> (1_0_x) is current <b>stable</b> version of 
  +API and <b>1.1.x</b> (1_1_x) is current <b>development</b> version</p>
   
   <p><b>NOTE:</b> tarball and ZIP download contains everything but actual XMLPULL 
   parser implementation that must be <a href="http://www.xmlpull.org/impls.shtml">
   downloaded separately</a>.</p>
   
  -<p>For more information about XMLPULL V1 API please visit
  +<p>For more information about XmlPull V1 API please visit
   <a href="http://www.xmlpull.org/">http://www.xmlpull.org/</a>. </p>
   
   <HR>
  
  
  
  1.34      +4 -5      xmlpull-api-v1/doc/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/doc/changes.html,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -b -t -w -r1.33 -r1.34
  --- changes.html	2002/08/02 16:25:53	1.33
  +++ changes.html	2002/08/28 04:32:56	1.34
  @@ -9,14 +9,13 @@
   
   <H1>Changes to XMLPULL V1 API</H1><P>
   
  -<h3>IN PROGRESS: <a name="XMLPULL_1_0_9"></a>2002-08 (XMLPULL_1_1_1)</h3>
  +<h3>IN PROGRESS: <a name="XMLPULL_1_2_1"></a>2002-08 (XMLPULL_1_2_1)</h3>
   <ul>
  -<li>this will be next official stable release (based on last of 1.0.x) to 
  +<li>this will be next official stable release (based on last of 1.1.x) to 
   incorporate all changes especially XmlSerializer</ul>
   
  -<h3>&nbsp;</h3>
  -
  -<h3>IN PROGRESS INTERIM RELEASE: <a name="XMLPULL_1_0_9"></a>2002-08 (XMLPULL_1_0_9)</h3>
  +<h3>IN PROGRESS INTERIM RELEASE: <a name="XMLPULL_1_1_1"></a>2002-08-07 
  +(XMLPULL_1_1_1)</h3>
   <ul>
   <li><strong>NEW! XmlSerializer API</strong> that is now required part of
   XMLPULL API on J2SE (on J2ME typically factory is not used and only implementation of
  
  
  
  1.9       +1 -1      xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlSerializer.java
  
  Index: XmlSerializer.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlSerializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -t -w -r1.8 -r1.9
  --- XmlSerializer.java	2002/08/22 17:37:01	1.8
  +++ XmlSerializer.java	2002/08/28 04:32:56	1.9
  @@ -43,7 +43,7 @@
        * If feature is not recocgnized or can not be set
        * then IllegalStateException MUST be thrown.
        *
  -     * @exception XmlPullParserException If the feature is not supported or can not be set
  +     * @exception IllegalStateException If the feature is not supported or can not be set
        */
       public void setFeature(String name,
                              boolean state)
  
  
  
  1.3       +12 -17    xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerialize.java
  
  Index: TestSerialize.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerialize.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -t -w -r1.2 -r1.3
  --- TestSerialize.java	2002/07/31 21:32:05	1.2
  +++ TestSerialize.java	2002/08/28 04:32:57	1.3
  @@ -26,6 +26,11 @@
       private XmlPullParserFactory factory;
       private XmlPullParser xpp;
   
  +
  +    public static void main (String[] args) {
  +        junit.textui.TestRunner.run (new TestSuite(TestSerialize.class));
  +    }
  +
       public TestSerialize(String name) {
           super(name);
       }
  @@ -47,7 +52,7 @@
   
           //assert there is error if trying to write
           try {
  -            ser.startTag("", "foo");
  +            ser.startTag(null, "foo");
               fail("exception was expected of serializer if no input was set on parser");
           } catch(Exception ex) {}
   
  @@ -55,7 +60,7 @@
   
           //assert there is error if trying to write
           try {
  -            ser.startTag("", "foo");
  +            ser.startTag(null, "foo");
               fail("exception was expected of serializer if no input was set on parser");
           } catch(Exception ex) {}
   
  @@ -75,19 +80,13 @@
           //assertEquals(null, ser.getOutputEncoding());
   
           ser.startDocument("ISO-8859-1", Boolean.TRUE);
  -        ser.startTag("", "foo");
  +        ser.startTag(null, "foo");
   
  -        //TODO: check that startTag(null, ...) is not allowed
  -
  -        ser.endTag("", "foo");
  +        ser.endTag(null, "foo");
           ser.endDocument();
   
  -
  -
           // now validate that can be deserialzied
   
  -
  -
           //xpp.setInput(new StringReader("<foo></foo>"));
           String serialized = sw.toString();
           xpp.setInput(new StringReader(serialized));
  @@ -141,13 +140,13 @@
           StringWriter sw = new StringWriter();
           ser.setOutput(sw);
           ser.startDocument(null, null);
  -        ser.startTag("", "foo");
  -        ser.attribute("", "attrName", "attrVal");
  +        ser.startTag(null, "foo");
  +        ser.attribute(null, "attrName", "attrVal");
           ser.text("bar");
           ser.startTag("", "p:t");
           ser.text("\n\t ");
           ser.endTag("", "p:t");
  -        ser.endTag("", "foo");
  +        ser.endTag(null, "foo");
           ser.endDocument();
   
           //xpp.setInput(new StringReader("<foo attrName='attrVal'>bar<p:t>\r\n\t </p:t></foo>"));
  @@ -173,10 +172,6 @@
           checkParserState(xpp, 0, xpp.END_DOCUMENT, null, null, false, -1);
   
   
  -    }
  -
  -    public static void main (String[] args) {
  -        junit.textui.TestRunner.run (new TestSuite(TestSerialize.class));
       }
   
   }
  
  
  
  1.3       +205 -176  xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java
  
  Index: TestSerializeWithNs.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerializeWithNs.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -t -w -r1.2 -r1.3
  --- TestSerializeWithNs.java	2002/07/31 21:32:05	1.2
  +++ TestSerializeWithNs.java	2002/08/28 04:32:57	1.3
  @@ -26,6 +26,10 @@
       private XmlPullParserFactory factory;
       private XmlPullParser xpp;
   
  +    public static void main (String[] args) {
  +        junit.textui.TestRunner.run (new TestSuite(TestSerializeWithNs.class));
  +    }
  +
       public TestSerializeWithNs(String name) {
           super(name);
       }
  @@ -41,6 +45,21 @@
       protected void tearDown() {
       }
   
  +
  +    private void checkSimpleWriterResult(String textContent) throws Exception {
  +        checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);
  +        xpp.next();
  +        checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "foo", null, xpp.isEmptyElementTag() /*empty*/, 0);
  +        if(textContent != null) {
  +            xpp.next();
  +            checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, "test", false, -1);
  +        }
  +        xpp.next();
  +        checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "foo", null, false, -1);
  +        xpp.next();
  +        checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
  +    }
  +
       public void testSimpleWriter() throws Exception {
           XmlSerializer ser = factory.newSerializer();
   
  @@ -49,7 +68,7 @@
           //assert there is error if trying to write
           try {
               ser.startTag("", "foo");
  -            fail("exception was expected of serializer if no input was set on parser");
  +            fail("exception was expected of serializer if no input was set");
           } catch(Exception ex) {}
   
           ser.setOutput(null);
  @@ -57,7 +76,7 @@
           //assert there is error if trying to write
           try {
               ser.startTag("", "foo");
  -            fail("exception was expected of serializer if no input was set on parser");
  +            fail("exception was expected of serializer if no input was set");
           } catch(Exception ex) {}
   
           StringWriter sw = new StringWriter();
  @@ -78,7 +97,7 @@
           ser.startDocument("ISO-8859-1", Boolean.TRUE);
           ser.startTag("", "foo");
   
  -        //TODO: check that startTag(null, ...) is not allowed
  +        //TODO: check that startTag(null, ...) is allowed
   
           ser.endTag("", "foo");
           ser.endDocument();
  @@ -89,13 +108,7 @@
           xpp.setInput(new StringReader(serialized));
   
           assertEquals(null, xpp.getInputEncoding());
  -        checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);
  -        xpp.next();
  -        checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "foo", null, xpp.isEmptyElementTag() /*empty*/, 0);
  -        xpp.next();
  -        checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "foo", null, false, -1);
  -        xpp.next();
  -        checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
  +        checkSimpleWriterResult(null);
       }
   
   
  @@ -120,17 +133,8 @@
           assertEquals("UTF-8", xpp.getInputEncoding());
   
           //xpp.setInput(new StringReader( "<foo/>" ) );
  -        checkParserStateNs(xpp, 0, xpp.START_DOCUMENT, null, 0, null, null, null, false, -1);
  -        xpp.next();
  -        checkParserStateNs(xpp, 1, xpp.START_TAG, null, 0, "", "foo", null, false, 0);
  -        xpp.next();
  -        checkParserStateNs(xpp, 1, xpp.TEXT, null, 0, null, null, "test", false, -1);
  -        xpp.next();
  -        checkParserStateNs(xpp, 1, xpp.END_TAG, null, 0, "", "foo", null, false, -1);
  -        xpp.next();
  -        checkParserStateNs(xpp, 0, xpp.END_DOCUMENT, null, 0, null, null, null, false, -1);
  -
   
  +        checkSimpleWriterResult("test");
   
       }
   
  @@ -159,6 +163,34 @@
           xpp.setInput(new StringReader(serialized));
       }
   
  +    public void testMisc() throws Exception {
  +        // all comemnts etc
  +    }
  +
  +    public void testIndneting() throws Exception {
  +        // generate SOAP envelope
  +        // try to use indentation
  +
  +        //check automtic namespace prefix declaration
  +        //test auto-generation of prefixes
  +
  +        //check escaping & < > " '
  +
  +        // close all unclosed tag;
  +        XmlSerializer ser = factory.newSerializer();
  +
  +        StringWriter sw = new StringWriter();
  +        ser.setOutput(sw);
  +        ser.endDocument();
  +    }
  +
  +    public void testSetPrefix() throws Exception {
  +        //setPrefix check that prefix is not duplicated ...
  +
  +    }
  +
  +    //TODO      redeclaring defult namespace
  +
           public void testMultipleOverlappingNamespaces() throws Exception {
               XmlSerializer ser = factory.newSerializer();
   
  @@ -306,9 +338,6 @@
   
           }
   
  -        public static void main (String[] args) {
  -            junit.textui.TestRunner.run (new TestSuite(TestSerializeWithNs.class));
  -        }
   
       }
   
  
  
  
  1.3       +15 -0     xmlpull-api-v1/src/xml/tests/simple.xml
  
  Index: simple.xml
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/xml/tests/simple.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -t -w -r1.2 -r1.3
  --- simple.xml	2002/08/16 19:11:50	1.2
  +++ simple.xml	2002/08/28 04:32:57	1.3
  @@ -7,6 +7,21 @@
     <next-text text="bar"/>
     <next/><expect type="END_DOCUMENT"/>
    </test-parser>
  +
  + <!-- test case derived from possible bug reported by Manoj to xmlpull-user -->
  + <test-parser name="simple test with text content">
  +  <create-parser/> <input-inline>&lt;?xml version="1.0" encoding="utf-8" ?><![CDATA[
  +   <string xmlns="http://whappdev1/bscwebservices/"> &lt;Table&gt;
  +        &lt;ClientID&gt; BS &lt;/ClientID&gt;&gt;/Table&gt;</string> ]]></input-inline>
  +  <set-feature>http://xmlpull.org/v1/doc/features.html#process-namespaces</set-feature>
  +  <expect type="START_DOCUMENT"/>
  +  <next-tag/><expect type="START_TAG" namespace="http://whappdev1/bscwebservices/"
  +                      name="string" empty="false"/>
  +  <next-text text=" &lt;Table>&#10;        &lt;ClientID> BS &lt;/ClientID>>/Table>"/>
  +  <expect type="END_TAG" namespace="http://whappdev1/bscwebservices/" name="string"/>
  +  <next/><expect type="END_DOCUMENT"/>
  + </test-parser>
  +
   </tests>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.