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 di...@apache.org on 2004/06/09 15:59:11 UTC

cvs commit: ws-axis/java/test/wsdl/qualify Qualify_BindingImpl.java Qualify_ServiceTestCase.java

dims        2004/06/09 06:59:11

  Modified:    java/test/wsdl/qualify Qualify_BindingImpl.java
                        Qualify_ServiceTestCase.java
  Log:
  Fix broken test case....The checks were looking at extra text nodes that were generated by the pretty flag. Cross checked with a stand alone code that uses just DOM and nothing else.
  
  public class Main {
      public static void main(String[] args) throws Exception {
          String xml = "<soapenv:Envelope xmlns:soapenv=\http://schemas.xmlsoap.org/soap/envelope/\ xmlns:xsd=\http://www.w3.org/2001/XMLSchema\ xmlns:xsi=\http://www.w3.org/2001/XMLSchema-instance\>" +
                          "<soapenv:Body>" +
                              "<Simple xmlns=\urn:qualifyTest\>" +
                                  "<name>Tommy</name>" +
                              "</Simple>" +
                          "</soapenv:Body>" +
                      "</soapenv:Envelope>";
          ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          dbf.setNamespaceAware(true);
          DocumentBuilder db = dbf.newDocumentBuilder();
          Node node = db.parse(bais).getDocumentElement();
          node = node.getFirstChild().getFirstChild().getFirstChild();
          System.out.println(node.getNamespaceURI());
          System.out.println(node.getLocalName());
          XMLUtils.PrettyElementToStream((Element)node,System.out);
      }
  }
  
  Revision  Changes    Path
  1.10      +12 -5     ws-axis/java/test/wsdl/qualify/Qualify_BindingImpl.java
  
  Index: Qualify_BindingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/qualify/Qualify_BindingImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Qualify_BindingImpl.java	25 Feb 2004 14:03:04 -0000	1.9
  +++ Qualify_BindingImpl.java	9 Jun 2004 13:59:11 -0000	1.10
  @@ -32,6 +32,7 @@
   import org.apache.axis.message.SOAPEnvelope;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +import org.w3c.dom.NodeList;
   
   public class Qualify_BindingImpl implements test.wsdl.qualify.Qualify_Port {
       
  @@ -69,12 +70,18 @@
                                   simpleNS + " should be: " + namespace);
           }
   
  -        Node nameNode = body.getFirstChild();
  -        String nameNS = nameNode.getNamespaceURI();
  -        if (nameNS != null ) {
  -            throw new AxisFault("Namespace of name element incorrect: " + 
  -                                nameNS + " should be: NULL");
  +        NodeList list = body.getChildNodes();
  +        for(int i=0;i<list.getLength();i++) {
  +            Node node = list.item(i);
  +            if(node.getNodeType() == Node.TEXT_NODE)
  +                continue;
  +            String nameNS = node.getNamespaceURI();
  +            if (!nameNS.equals("urn:qualifyTest")) {
  +                throw new AxisFault("Namespace of name element incorrect: " + 
  +                                    nameNS + " should be: urn:qualifyTest");
  +            }
           }
  +        
           // Return a response (which the client will validate)
           return "Hello there: " + name;
       }
  
  
  
  1.10      +2 -1      ws-axis/java/test/wsdl/qualify/Qualify_ServiceTestCase.java
  
  Index: Qualify_ServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/wsdl/qualify/Qualify_ServiceTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Qualify_ServiceTestCase.java	25 Feb 2004 14:03:04 -0000	1.9
  +++ Qualify_ServiceTestCase.java	9 Jun 2004 13:59:11 -0000	1.10
  @@ -89,7 +89,8 @@
   
               Node nameNode = body.getFirstChild();
               String nameNS = nameNode.getNamespaceURI();
  -            assertNull("Namespace of name element incorrect", nameNS);
  +            assertEquals("Namespace of <name> element incorrect", 
  +                         nameNS, namespace);
               
               // Check the response
               assertEquals(value, "Hello there: " + name);