You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bl...@apache.org on 2001/10/11 14:29:23 UTC

cvs commit: xml-axis/java/test/utils TestXMLUtils.java

bloritsch    01/10/11 05:29:23

  Modified:    java/test/utils TestXMLUtils.java
  Log:
  Change missed init() function.
  
  Revision  Changes    Path
  1.7       +46 -46    xml-axis/java/test/utils/TestXMLUtils.java
  
  Index: TestXMLUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/utils/TestXMLUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestXMLUtils.java	2001/08/17 20:44:01	1.6
  +++ TestXMLUtils.java	2001/10/11 12:29:23	1.7
  @@ -20,10 +20,10 @@
   
       public void setup() {
       }
  -    
  +
       public void testInit()
       {
  -        DocumentBuilderFactory dbf = XMLUtils.init();
  +        DocumentBuilderFactory dbf = XMLUtils.initDOMFactory();
           assertTrue(dbf instanceof DocumentBuilderFactory);
       }
   
  @@ -32,7 +32,7 @@
           Document doc = XMLUtils.newDocument();
           assertTrue(doc instanceof org.w3c.dom.Document);
       }
  -    
  +
       public void testNewDocumentInputSource()
       {
           Reader reader = (Reader)this.getTestXml("reader");
  @@ -48,7 +48,7 @@
           Document doc = XMLUtils.newDocument(inputsrc);
           assertTrue(doc instanceof org.w3c.dom.Document);
       }
  -   
  +
       /* This test will fail unless you are connected to the Web, so just skip
       * it unless you really want to test it.  When not connected to the Web you
       * will get an UnknownHostException.
  @@ -67,12 +67,12 @@
           Reader reader = (Reader)this.getTestXml("reader");
           InputSource inputsrc = new InputSource(reader);
           Document doc = XMLUtils.newDocument(inputsrc);
  -        
  +
           String xmlString = (String)this.getTestXml("string");
           String result = XMLUtils.DocumentToString(doc);
           assertEquals(xmlString, result);
       }
  -    
  +
       /**
       * This test method is somewhat complex, but it solves a problem people have
       * asked me about, which is how to unit test a method that has void return
  @@ -81,23 +81,23 @@
       */
       public void testElementToWriter() throws IOException
       {
  -        /* Get the Document and one of its elements. */ 
  +        /* Get the Document and one of its elements. */
           Reader xmlReader = (Reader)this.getTestXml("reader");
           InputSource inputsrc = new InputSource(xmlReader);
           Document doc = XMLUtils.newDocument(inputsrc);
           NodeList nl = doc.getElementsByTagName("display-name");
           Element elem = (Element)nl.item(0);
           String expected = "<display-name>Apache-Axis</display-name>";
  -       
  +
           /*
  -        * Create a PipedOutputStream to get the output from the tested method. 
  -        * Pass the PipedOutputStream to the ConsumerPipe's constructor, which 
  +        * Create a PipedOutputStream to get the output from the tested method.
  +        * Pass the PipedOutputStream to the ConsumerPipe's constructor, which
           * will create a PipedInputStream in a separate thread.
           */
           PipedOutputStream out = new PipedOutputStream();
           OutputStreamWriter writer = new OutputStreamWriter(out);
           ConsumerPipe cpipe = new ConsumerPipe(out);
  -        
  +
           /*
           * Call the method under test, passing the PipedOutStream to trap the
           * results.
  @@ -113,28 +113,28 @@
           String result = cpipe.getResult();
           //don't forget to close this end of the pipe (ConsumerPipe closes the other end).
           out.close();
  -        
  +
           assertEquals(expected, result);
       }
  -    
  +
       /**
       * For explanation of the methodology used to test this method, see notes in
       * previous test method.
  -    */ 
  +    */
       public void testDocumentToStream() throws IOException
       {
           Reader reader = (Reader)this.getTestXml("reader");
           InputSource inputsrc = new InputSource(reader);
           Document doc = XMLUtils.newDocument(inputsrc);
  -        
  +
           PipedOutputStream out = new PipedOutputStream();
           ConsumerPipe cpipe = new ConsumerPipe(out);
  -       
  +
           XMLUtils.DocumentToStream(doc, out);
           out.flush();
           String result = cpipe.getResult();
           out.close();
  -        
  +
           String expected = (String)this.getTestXml("string");
           assertEquals(expected, result);
       }
  @@ -144,7 +144,7 @@
           Reader reader = (Reader)this.getTestXml("reader");
           InputSource inputsrc = new InputSource(reader);
           Document doc = XMLUtils.newDocument(inputsrc);
  -        
  +
           NodeList nl = doc.getElementsByTagName("display-name");
           Element elem = (Element)nl.item(0);
           String expected = "<display-name>Apache-Axis</display-name>";
  @@ -152,29 +152,29 @@
           assertEquals("display-name", elem.getTagName());
           assertEquals(expected, result);
       }
  -    
  +
       public void testGetInnerXMLString()
       {
           Reader reader = (Reader)this.getTestXml("reader");
           InputSource inputsrc = new InputSource(reader);
           Document doc = XMLUtils.newDocument(inputsrc);
  -        
  +
           NodeList nl = doc.getElementsByTagName("display-name");
           Element elem = (Element)nl.item(0);
           String expected = "Apache-Axis";
           String result = XMLUtils.getInnerXMLString(elem);
           assertEquals(expected, result);
       }
  -        
  +
       public void testGetPrefix()
       {
           Document doc = XMLUtils.newDocument();
  -       
  -        Element elem = doc.createElement("svg"); 
  -        elem.setAttribute("xmlns:svg", "\"http://www.w3.org/2000/svg\""); 
  -        elem.setAttribute("xmlns:xlink", "\"http://www.w3.org/1999/xlink\""); 
  -        elem.setAttribute("xmlns:xhtml", "\"http://www.w3.org/1999/xhtml\""); 
  -        
  +
  +        Element elem = doc.createElement("svg");
  +        elem.setAttribute("xmlns:svg", "\"http://www.w3.org/2000/svg\"");
  +        elem.setAttribute("xmlns:xlink", "\"http://www.w3.org/1999/xlink\"");
  +        elem.setAttribute("xmlns:xhtml", "\"http://www.w3.org/1999/xhtml\"");
  +
           String expected = "svg";
           String result = XMLUtils.getPrefix("\"http://www.w3.org/2000/svg\"", elem);
           assertEquals(expected, result);
  @@ -185,14 +185,14 @@
           result = XMLUtils.getPrefix("\"http://www.w3.org/1999/xhtml\"", elem);
           assertEquals(expected, result);
       }
  -    
  +
       public void testGetNamespace()
       {
  -        String testDoc = "<svg xmlns:svg=\"http://www.w3.org/2000/svg\"/>"; 
  +        String testDoc = "<svg xmlns:svg=\"http://www.w3.org/2000/svg\"/>";
           InputSource inputsrc = new InputSource(new StringReader(testDoc));
           Document doc = XMLUtils.newDocument(inputsrc);
           assertNotNull(doc);
  -        
  +
           NodeList nl = doc.getElementsByTagName("svg");
           Element elem = (Element)nl.item(0);
   
  @@ -200,7 +200,7 @@
           String result = XMLUtils.getNamespace("svg", elem);
           assertEquals(expected, result);
       }
  -    
  +
       /**
       * This is a utility method for creating XML document input sources for this
       * JUnit test class.  The returned Object should be cast to the type you
  @@ -219,29 +219,29 @@
             //.append("<!DOCTYPE web-app PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN\"" + lineSep)
             //.append("\"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd\">" + lineSep)
             .append("<web-app>" + lineSep)
  -          .append("<display-name>Apache-Axis</display-name>" + lineSep) 
  -          .append("<servlet>" + lineSep) 
  -          .append("<servlet-name>AxisServlet</servlet-name>" + lineSep) 
  -          .append("<display-name>Apache-Axis Servlet</display-name>" + lineSep) 
  -          .append("<servlet-class>" + lineSep) 
  -          .append("org.apache.axis.transport.http.AxisServlet" + lineSep) 
  -          .append("</servlet-class>" + lineSep) 
  -          .append("</servlet>" + lineSep) 
  -          .append("<servlet-mapping>" + lineSep) 
  -          .append("<servlet-name>AxisServlet</servlet-name>" + lineSep) 
  -          .append("<url-pattern>servlet/AxisServlet</url-pattern>" + lineSep) 
  -          .append("<url-pattern>*.jws</url-pattern>" + lineSep) 
  -          .append("</servlet-mapping>" + lineSep) 
  +          .append("<display-name>Apache-Axis</display-name>" + lineSep)
  +          .append("<servlet>" + lineSep)
  +          .append("<servlet-name>AxisServlet</servlet-name>" + lineSep)
  +          .append("<display-name>Apache-Axis Servlet</display-name>" + lineSep)
  +          .append("<servlet-class>" + lineSep)
  +          .append("org.apache.axis.transport.http.AxisServlet" + lineSep)
  +          .append("</servlet-class>" + lineSep)
  +          .append("</servlet>" + lineSep)
  +          .append("<servlet-mapping>" + lineSep)
  +          .append("<servlet-name>AxisServlet</servlet-name>" + lineSep)
  +          .append("<url-pattern>servlet/AxisServlet</url-pattern>" + lineSep)
  +          .append("<url-pattern>*.jws</url-pattern>" + lineSep)
  +          .append("</servlet-mapping>" + lineSep)
             .append("</web-app>");
   
           String xmlString = sb.toString();
  -        
  +
           if (gimme.equals("string"))
           {
               return xmlString;
           }
           else if (gimme.equals("reader"))
  -        { 
  +        {
               StringReader strReader = new StringReader(xmlString);
               return strReader;
           }
  
  
  

Re: cvs commit: xml-axis/java/test/utils TestXMLUtils.java

Posted by Berin Loritsch <bl...@apache.org>.
Davanum Srinivas wrote:
> 
> Berin,
> Is your IDE running on *UNIX/Linux? I see a lot of whitespace changes...

I am trying to figure this one out.  I am running Cygwin, however the CVS
client (which IDEA uses) seems to have changed the default to Unix line feeds.
This is a bit frustrating to me, as I truly apreciate how IDEA lets me work.
It is natural, and it lets me focus on the details of what I am doing more
than any other IDE.  I need to remove the entry from my .cvsrc file so that
my diffs show whitespace changes.  I hid them so that when I post diffs,
the diffs had the meat of the change.  No that I have committer access, I
need to see what is going on in my environment.

AARRRGGGHHH!

I really don't want to have to go back to JBuilder if I can help it.  JBuilder
has neat things for GUI development and things like that--but it doesn't have
the true creature features that I need.

Those of you who use IDEA, can you help me set up my environment correctly
(Off the list)?

Again, I appologize, and I am trying to fix the problem.

Re: cvs commit: xml-axis/java/test/utils TestXMLUtils.java

Posted by Davanum Srinivas <di...@yahoo.com>.
Berin,
Is your IDE running on *UNIX/Linux? I see a lot of whitespace changes...

Thanks,
dims
--- bloritsch@apache.org wrote:
> bloritsch    01/10/11 05:29:23
> 
>   Modified:    java/test/utils TestXMLUtils.java
>   Log:
>   Change missed init() function.
>   
>   Revision  Changes    Path
>   1.7       +46 -46    xml-axis/java/test/utils/TestXMLUtils.java
>   
>   Index: TestXMLUtils.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/test/utils/TestXMLUtils.java,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- TestXMLUtils.java	2001/08/17 20:44:01	1.6
>   +++ TestXMLUtils.java	2001/10/11 12:29:23	1.7
>   @@ -20,10 +20,10 @@
>    
>        public void setup() {
>        }
>   -    
>   +
>        public void testInit()
>        {
>   -        DocumentBuilderFactory dbf = XMLUtils.init();
>   +        DocumentBuilderFactory dbf = XMLUtils.initDOMFactory();
>            assertTrue(dbf instanceof DocumentBuilderFactory);
>        }
>    
>   @@ -32,7 +32,7 @@
>            Document doc = XMLUtils.newDocument();
>            assertTrue(doc instanceof org.w3c.dom.Document);
>        }
>   -    
>   +
>        public void testNewDocumentInputSource()
>        {
>            Reader reader = (Reader)this.getTestXml("reader");
>   @@ -48,7 +48,7 @@
>            Document doc = XMLUtils.newDocument(inputsrc);
>            assertTrue(doc instanceof org.w3c.dom.Document);
>        }
>   -   
>   +
>        /* This test will fail unless you are connected to the Web, so just skip
>        * it unless you really want to test it.  When not connected to the Web you
>        * will get an UnknownHostException.
>   @@ -67,12 +67,12 @@
>            Reader reader = (Reader)this.getTestXml("reader");
>            InputSource inputsrc = new InputSource(reader);
>            Document doc = XMLUtils.newDocument(inputsrc);
>   -        
>   +
>            String xmlString = (String)this.getTestXml("string");
>            String result = XMLUtils.DocumentToString(doc);
>            assertEquals(xmlString, result);
>        }
>   -    
>   +
>        /**
>        * This test method is somewhat complex, but it solves a problem people have
>        * asked me about, which is how to unit test a method that has void return
>   @@ -81,23 +81,23 @@
>        */
>        public void testElementToWriter() throws IOException
>        {
>   -        /* Get the Document and one of its elements. */ 
>   +        /* Get the Document and one of its elements. */
>            Reader xmlReader = (Reader)this.getTestXml("reader");
>            InputSource inputsrc = new InputSource(xmlReader);
>            Document doc = XMLUtils.newDocument(inputsrc);
>            NodeList nl = doc.getElementsByTagName("display-name");
>            Element elem = (Element)nl.item(0);
>            String expected = "<display-name>Apache-Axis</display-name>";
>   -       
>   +
>            /*
>   -        * Create a PipedOutputStream to get the output from the tested method. 
>   -        * Pass the PipedOutputStream to the ConsumerPipe's constructor, which 
>   +        * Create a PipedOutputStream to get the output from the tested method.
>   +        * Pass the PipedOutputStream to the ConsumerPipe's constructor, which
>            * will create a PipedInputStream in a separate thread.
>            */
>            PipedOutputStream out = new PipedOutputStream();
>            OutputStreamWriter writer = new OutputStreamWriter(out);
>            ConsumerPipe cpipe = new ConsumerPipe(out);
>   -        
>   +
>            /*
>            * Call the method under test, passing the PipedOutStream to trap the
>            * results.
>   @@ -113,28 +113,28 @@
>            String result = cpipe.getResult();
>            //don't forget to close this end of the pipe (ConsumerPipe closes the other end).
>            out.close();
>   -        
>   +
>            assertEquals(expected, result);
>        }
>   -    
>   +
>        /**
>        * For explanation of the methodology used to test this method, see notes in
>        * previous test method.
>   -    */ 
>   +    */
>        public void testDocumentToStream() throws IOException
>        {
>            Reader reader = (Reader)this.getTestXml("reader");
>            InputSource inputsrc = new InputSource(reader);
>            Document doc = XMLUtils.newDocument(inputsrc);
>   -        
>   +
>            PipedOutputStream out = new PipedOutputStream();
>            ConsumerPipe cpipe = new ConsumerPipe(out);
>   -       
>   +
>            XMLUtils.DocumentToStream(doc, out);
>            out.flush();
>            String result = cpipe.getResult();
>            out.close();
>   -        
>   +
>            String expected = (String)this.getTestXml("string");
>            assertEquals(expected, result);
>        }
>   @@ -144,7 +144,7 @@
>            Reader reader = (Reader)this.getTestXml("reader");
>            InputSource inputsrc = new InputSource(reader);
>            Document doc = XMLUtils.newDocument(inputsrc);
>   -        
>   +
>            NodeList nl = doc.getElementsByTagName("display-name");
>            Element elem = (Element)nl.item(0);
>            String expected = "<display-name>Apache-Axis</display-name>";
>   @@ -152,29 +152,29 @@
>            assertEquals("display-name", elem.getTagName());
>            assertEquals(expected, result);
>        }
>   -    
>   +
>        public void testGetInnerXMLString()
>        {
>            Reader reader = (Reader)this.getTestXml("reader");
>            InputSource inputsrc = new InputSource(reader);
>            Document doc = XMLUtils.newDocument(inputsrc);
>   -        
>   +
>            NodeList nl = doc.getElementsByTagName("display-name");
>            Element elem = (Element)nl.item(0);
>            String expected = "Apache-Axis";
>            String result = XMLUtils.getInnerXMLString(elem);
>            assertEquals(expected, result);
>        }
>   -        
>   +
>        public void testGetPrefix()
>        {
>            Document doc = XMLUtils.newDocument();
>   -       
>   -        Element elem = doc.createElement("svg"); 
>   -        elem.setAttribute("xmlns:svg", "\"http://www.w3.org/2000/svg\""); 
>   -        elem.setAttribute("xmlns:xlink", "\"http://www.w3.org/1999/xlink\""); 
>   -        elem.setAttribute("xmlns:xhtml", "\"http://www.w3.org/1999/xhtml\""); 
>   -        
>   +
>   +        Element elem = doc.createElement("svg");
>   +        elem.setAttribute("xmlns:svg", "\"http://www.w3.org/2000/svg\"");
>   +        elem.setAttribute("xmlns:xlink", "\"http://www.w3.org/1999/xlink\"");
>   +        elem.setAttribute("xmlns:xhtml", "\"http://www.w3.org/1999/xhtml\"");
>   +
>            String expected = "svg";
>            String result = XMLUtils.getPrefix("\"http://www.w3.org/2000/svg\"", elem);
>            assertEquals(expected, result);
>   @@ -185,14 +185,14 @@
>            result = XMLUtils.getPrefix("\"http://www.w3.org/1999/xhtml\"", elem);
>            assertEquals(expected, result);
>        }
>   -    
>   +
>        public void testGetNamespace()
>        {
>   -        String testDoc = "<svg xmlns:svg=\"http://www.w3.org/2000/svg\"/>"; 
>   +        String testDoc = "<svg xmlns:svg=\"http://www.w3.org/2000/svg\"/>";
>            InputSource inputsrc = new InputSource(new StringReader(testDoc));
>            Document doc = XMLUtils.newDocument(inputsrc);
>            assertNotNull(doc);
>   -        
>   +
>            NodeList nl = doc.getElementsByTagName("svg");
>            Element elem = (Element)nl.item(0);
>    
>   @@ -200,7 +200,7 @@
>            String result = XMLUtils.getNamespace("svg", elem);
>            assertEquals(expected, result);
>        }
>   -    
>   +
>        /**
>        * This is a utility method for creating XML document input sources for this
> 
=== message truncated ===


=====
Davanum Srinivas - http://jguru.com/dims/

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com