CVS Update: xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests

Aleksander Andrzej Slominski <[email protected]> Sun, 15 Jun 2003 11:35:09 -0500 (EST)
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       03/06/15 11:35:09

  Modified:    src/java/tests/org/xmlpull/v1/tests TestMisc.java
  Log:
  refactores to remove access for static constants on instance (ex.: pp.START_TAG --> XmlPullParser.START_TAG)
  
  Revision  Changes    Path
  1.19      +74 -73    xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java
  
  Index: TestMisc.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestMisc.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -t -w -r1.18 -r1.19
  --- TestMisc.java	15 Jun 2003 16:29:40 -0000	1.18
  +++ TestMisc.java	15 Jun 2003 16:35:09 -0000	1.19
  @@ -39,22 +39,22 @@
           XmlPullParser pp = factory.newPullParser();
           pp.setInput( new StringReader( INPUT_XML ) );
           pp.nextTag();
  -        pp.require( pp.START_TAG, null, "t");
  +        pp.require( XmlPullParser.START_TAG, null, "t");
           pp.nextTag();
  -        pp.require( pp.START_TAG, null, "test1");
  +        pp.require( XmlPullParser.START_TAG, null, "test1");
           assertEquals( "foo", pp.nextText() );
  -        pp.require( pp.END_TAG, null, "test1");
  +        pp.require( XmlPullParser.END_TAG, null, "test1");
   
           pp.nextTag();
  -        pp.require( pp.START_TAG, null, "test2");
  +        pp.require( XmlPullParser.START_TAG, null, "test2");
           pp.nextTag();
  -        pp.require( pp.END_TAG, null, "test2");
  +        pp.require( XmlPullParser.END_TAG, null, "test2");
   
   
           pp.nextTag();
  -        pp.require( pp.END_TAG, null, "t");
  +        pp.require( XmlPullParser.END_TAG, null, "t");
           pp.next();
  -        pp.require( pp.END_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.END_DOCUMENT, null, null);
   
       }
   
  @@ -76,42 +76,42 @@
           XmlPullParser pp = factory.newPullParser();
           pp.setInput( new StringReader( INPUT_XML ) );
           pp.next();
  -        pp.require( pp.START_TAG, null, "t");
  +        pp.require( XmlPullParser.START_TAG, null, "t");
           pp.next();
  -        pp.require( pp.START_TAG, null, "test1");
  +        pp.require( XmlPullParser.START_TAG, null, "test1");
           assertEquals( "foo", pp.nextText() );
  -        pp.require( pp.END_TAG, null, "test1");
  +        pp.require( XmlPullParser.END_TAG, null, "test1");
   
           pp.next();
  -        pp.require( pp.START_TAG, null, "test2");
  +        pp.require( XmlPullParser.START_TAG, null, "test2");
           assertEquals( "", pp.nextText() );
  -        pp.require( pp.END_TAG, null, "test2");
  +        pp.require( XmlPullParser.END_TAG, null, "test2");
   
           pp.next();
  -        pp.require( pp.START_TAG, null, "test3");
  +        pp.require( XmlPullParser.START_TAG, null, "test3");
           assertEquals( "", pp.nextText() );
  -        pp.require( pp.END_TAG, null, "test3");
  +        pp.require( XmlPullParser.END_TAG, null, "test3");
   
           pp.next();
  -        pp.require( pp.START_TAG, null, "test4");
  +        pp.require( XmlPullParser.START_TAG, null, "test4");
           //pp.next();
  -        //pp.require( pp.TEXT, null, null);
  +        //pp.require( XmlPullParser.TEXT, null, null);
           assertEquals( "bar", pp.nextText() );
  -        pp.require( pp.END_TAG, null, "test4");
  +        pp.require( XmlPullParser.END_TAG, null, "test4");
   
           pp.next();
  -        pp.require( pp.END_TAG, null, "t");
  +        pp.require( XmlPullParser.END_TAG, null, "t");
           pp.next();
  -        pp.require( pp.END_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.END_DOCUMENT, null, null);
   
           // now check for error conditions
           pp.setInput( new StringReader( INPUT_XML ) );
           pp.next();
  -        pp.require( pp.START_TAG, null, "t");
  +        pp.require( XmlPullParser.START_TAG, null, "t");
           pp.next();
  -        pp.require( pp.START_TAG, null, "test1");
  +        pp.require( XmlPullParser.START_TAG, null, "test1");
           pp.next();
  -        pp.require( pp.TEXT, null, null);
  +        pp.require( XmlPullParser.TEXT, null, null);
           try {
               pp.nextText();
               fail("if current tag is TEXT no next text content can be returned!");
  @@ -119,7 +119,7 @@
   
           pp.setInput( new StringReader( INPUT_XML ) );
           pp.next();
  -        pp.require( pp.START_TAG, null, "t");
  +        pp.require( XmlPullParser.START_TAG, null, "t");
           try {
               pp.nextText();
               fail("if next tag is START_TAG no text content can be returned!");
  @@ -127,12 +127,12 @@
   
           pp.setInput( new StringReader( INPUT_XML ) );
           pp.next();
  -        pp.require( pp.START_TAG, null, "t");
  +        pp.require( XmlPullParser.START_TAG, null, "t");
           pp.next();
  -        pp.require( pp.START_TAG, null, "test1");
  +        pp.require( XmlPullParser.START_TAG, null, "test1");
           pp.next();
           pp.next();
  -        pp.require( pp.END_TAG, null, "test1");
  +        pp.require( XmlPullParser.END_TAG, null, "test1");
           try {
               pp.nextText();
               fail("if current tag is END_TAG no text content can be returned!");
  @@ -145,41 +145,41 @@
           final String INPUT_XML = "<test><t>foo</t><m:s xmlns:m='URI'>\t</m:s></test>";
           XmlPullParser pp = factory.newPullParser();
           pp.setInput( new StringReader( INPUT_XML ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "test");
  -        pp.require( pp.START_TAG, "", null);
  -        pp.require( pp.START_TAG, "", "test");
  +        pp.require( XmlPullParser.START_TAG, null, "test");
  +        pp.require( XmlPullParser.START_TAG, "", null);
  +        pp.require( XmlPullParser.START_TAG, "", "test");
           pp.next();
  -        pp.require( pp.START_TAG, "", "t");
  +        pp.require( XmlPullParser.START_TAG, "", "t");
           pp.next();
  -        pp.require( pp.TEXT, null, null);
  +        pp.require( XmlPullParser.TEXT, null, null);
           pp.next();
  -        pp.require( pp.END_TAG, "", "t");
  +        pp.require( XmlPullParser.END_TAG, "", "t");
   
           pp.next();
  -        pp.require( pp.START_TAG, "URI", "s");
  +        pp.require( XmlPullParser.START_TAG, "URI", "s");
   
           pp.next();
  -        pp.require( pp.TEXT, null, null);
  +        pp.require( XmlPullParser.TEXT, null, null);
           assertEquals("\t", pp.getText());
           pp.next();
  -        pp.require( pp.END_TAG, "URI", "s");
  +        pp.require( XmlPullParser.END_TAG, "URI", "s");
   
           pp.next();
  -        pp.require( pp.END_TAG, "", "test");
  +        pp.require( XmlPullParser.END_TAG, "", "test");
           pp.next();
  -        pp.require( pp.END_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.END_DOCUMENT, null, null);
   
           //now check that require will NOT skip white space
           pp = factory.newPullParser();
           pp.setInput( new StringReader( "<m:s xmlns:m='URI'>\t</m:s>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, "URI", "s");
  +        pp.require( XmlPullParser.START_TAG, "URI", "s");
           pp.next();
           try {
  -            pp.require( pp.END_TAG, "URI", "s");
  +            pp.require( XmlPullParser.END_TAG, "URI", "s");
               fail("require() MUST NOT skip white spaces");
           } catch(XmlPullParserException ex){}
   
  @@ -189,29 +189,29 @@
           XmlPullParser pp = factory.newPullParser();
   
           pp.setInput( new StringReader( "<?xml version='1.0'?><foo/>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           pp.next();
  -        pp.require( pp.END_TAG, null, "foo");
  +        pp.require( XmlPullParser.END_TAG, null, "foo");
           pp.next();
  -        pp.require( pp.END_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.END_DOCUMENT, null, null);
   
           pp.setInput( new StringReader(
                           "<?xml  version=\"1.0\" \t encoding='UTF-8' \nstandalone='yes' ?><foo/>" ));
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
   
           pp.setInput( new StringReader(
                           "<?xml  version=\"1.0\" \t encoding='UTF-8' \nstandalone='yes' ?><foo/>" ));
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           assertNull(pp.getProperty(PROPERTY_XMLDECL_VERSION));
           assertNull(pp.getProperty(PROPERTY_XMLDECL_STANDALONE));
           assertNull(pp.getProperty(PROPERTY_XMLDECL_CONTENT));
   
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           String xmlDeclVersion = (String) pp.getProperty(PROPERTY_XMLDECL_VERSION);
           if(xmlDeclVersion != null) {
               assertEquals("XMLDecl version","1.0", xmlDeclVersion);
  @@ -232,7 +232,7 @@
   
           // XML decl without required verion
           pp.setInput( new StringReader( "<?xml test?><foo/>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
   
           // check that proerties are reset
           assertNull(pp.getProperty(PROPERTY_XMLDECL_VERSION));
  @@ -247,7 +247,7 @@
   
           pp.setInput( new StringReader(
                           "<?xml version=\"1.0\" standalone='yes' encoding=\"UTF-8\" ?>\n<foo/>" ));
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           try {
               pp.next();
               fail("expected exception for invalid XML declaration with standalone at wrong position");
  @@ -257,25 +257,25 @@
           pp.setInput( new StringReader(
                           "<?xml  version=\"1.0\" \t encoding='UTF-8' \nstandalone='yes' ?>"
                               +"<!--comment--><foo/>" ));
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           // make sure that XMLDecl is not reported
           pp.nextToken();
  -        pp.require( pp.COMMENT, null, null);
  +        pp.require( XmlPullParser.COMMENT, null, null);
           pp.nextToken();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           pp.next();
  -        pp.require( pp.END_TAG, null, "foo");
  +        pp.require( XmlPullParser.END_TAG, null, "foo");
           pp.next();
  -        pp.require( pp.END_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.END_DOCUMENT, null, null);
   
       }
   
       public void testComments() throws Exception {
           XmlPullParser pp = factory.newPullParser();
           pp.setInput( new StringReader( "<foo><!-- B+, B or B---></foo>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           try {
               pp.next();
               fail("expected eception for invalid comment ending with --->");
  @@ -291,15 +291,15 @@
           throws Exception {
           pp.setInput( new StringReader( xml ) );
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           if(expected != null) {
               pp.next();
  -            pp.require( pp.TEXT, null, null);
  +            pp.require( XmlPullParser.TEXT, null, null);
               assertEquals(printable(expected), printable(pp.getText()));
               assertEquals(expected, pp.getText());
           }
           pp.next();
  -        pp.require( pp.END_TAG, null, "foo");
  +        pp.require( XmlPullParser.END_TAG, null, "foo");
       }
   
       public void testComments2() throws Exception {
  @@ -358,30 +358,30 @@
           //System.out.println(getClass()+"-pp="+pp);
   
           pp.setInput( new StringReader( "<foo><?XmLsdsd test?></foo>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           pp.next();
  -        pp.require( pp.END_TAG, null, "foo");
  +        pp.require( XmlPullParser.END_TAG, null, "foo");
   
           pp.setInput( new StringReader( "<foo><?XmL test?></foo>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           try {
               pp.next();
               fail("expected exception for invalid PI starting with xml");
           } catch(XmlPullParserException ex){}
   
           pp.setInput( new StringReader( "<foo><?pi test?></foo>" ) );
  -        pp.require( pp.START_DOCUMENT, null, null);
  +        pp.require( XmlPullParser.START_DOCUMENT, null, null);
           pp.next();
  -        pp.require( pp.START_TAG, null, "foo");
  +        pp.require( XmlPullParser.START_TAG, null, "foo");
           pp.nextToken();
  -        pp.require( pp.PROCESSING_INSTRUCTION, null, null);
  +        pp.require( XmlPullParser.PROCESSING_INSTRUCTION, null, null);
           assertEquals("PI", "pi test", pp.getText());
           pp.next();
  -        pp.require( pp.END_TAG, null, "foo");
  +        pp.require( XmlPullParser.END_TAG, null, "foo");
   
           testContentMerging(pp, "<foo><? this is PI ?></foo>", null);
           testContentMerging(pp, "<foo>\n<? this is PI ?>\n</foo>", "\n\n");
  @@ -456,7 +456,8 @@
               // skip rest of test if parser does not support reporting
               return;
           }
  -        PackageTests.addNote("* optional feature  "+pp.FEATURE_REPORT_NAMESPACE_ATTRIBUTES+" is supported\n");
  +        PackageTests.addNote(
  +            "* optional feature  "+XmlPullParser.FEATURE_REPORT_NAMESPACE_ATTRIBUTES+" is supported\n");
           // see XML Namespaces spec for namespace URIs for 'xml' and 'xmlns'
           //   xml is bound to http://www.w3.org/XML/1998/namespace
           //   "(...) The prefix xmlns is used only for namespace bindings
  @@ -517,9 +518,9 @@
   
   
           pp.next();
  -        String attrValue = pp.getAttributeValue(pp.NO_NAMESPACE, "attr");
  +        String attrValue = pp.getAttributeValue(XmlPullParser.NO_NAMESPACE, "attr");
           assertEquals("baz & bar", attrValue);
  -        String attEolValue = pp.getAttributeValue(pp.NO_NAMESPACE, "attEol");
  +        String attEolValue = pp.getAttributeValue(XmlPullParser.NO_NAMESPACE, "attEol");
           assertEquals("a v  a   io n ica", attEolValue);
           if(roundtripSupported) {
               String text = pp.getText();
  
  
  


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Looking for the latest Free IT White Papers?
Visit SearchNetworking.com to access over 500 white papers.
Get instant access at SearchNetworking.com Today
http://us.click.yahoo.com/GgVXVB/OLNGAA/xitMAA/2U_rlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/