axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/test/saaj TestHeaders.java
Date Mon, 05 Apr 2004 12:30:34 GMT
dims        2004/04/05 05:30:34

  Modified:    java/src/org/apache/axis/message SOAPHeader.java
               java/test/saaj TestHeaders.java
  Log:
  Fix for SAAJ 1.2 TCK Failure: Fix problems with extract and examine All Headers.
  
  Revision  Changes    Path
  1.80      +1 -4      ws-axis/java/src/org/apache/axis/message/SOAPHeader.java
  
  Index: SOAPHeader.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- SOAPHeader.java	9 Mar 2004 08:18:24 -0000	1.79
  +++ SOAPHeader.java	5 Apr 2004 12:30:33 -0000	1.80
  @@ -130,8 +130,6 @@
   
           Vector result = new Vector();
   
  -        ArrayList headers = super.getChildren();
  -
           for(int i = 0; i < headers.size(); i++) {
               SOAPHeaderElement she = (SOAPHeaderElement)headers.get(i);
               if (she.getMustUnderstand()) {
  @@ -145,12 +143,11 @@
       }
   
       public Iterator examineAllHeaderElements() {
  -        return super.getChildElements();
  +        return headers.iterator();
       }
   
       public Iterator extractAllHeaderElements() {
           Vector result = new Vector();
  -        ArrayList headers = super.getChildren();
           for(int i = 0; i < headers.size(); i++) {
               result.add(headers.get(i));
           }
  
  
  
  1.3       +43 -0     ws-axis/java/test/saaj/TestHeaders.java
  
  Index: TestHeaders.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/saaj/TestHeaders.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestHeaders.java	7 May 2003 13:49:25 -0000	1.2
  +++ TestHeaders.java	5 Apr 2004 12:30:34 -0000	1.3
  @@ -9,6 +9,7 @@
   import javax.xml.soap.SOAPMessage;
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
  +import java.util.Iterator;
   
   public class TestHeaders extends junit.framework.TestCase {
   
  @@ -60,5 +61,47 @@
           
           String xml = new String(baos.toByteArray());
           assertTrue(xml.indexOf(localName) != -1);
  +    }
  +    
  +    public void testExtractAllHeaders() throws Exception {
  +        MessageFactory mf = MessageFactory.newInstance();
  +        SOAPMessage soapMessage = mf.createMessage();
  +        SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
  +        SOAPHeader hdr = envelope.getHeader();
  +        SOAPHeaderElement she1 = hdr.addHeaderElement(envelope.createName("foo1", "f1",
"foo1-URI"));
  +        she1.setActor("actor-URI");
  +
  +        Iterator iterator = hdr.extractAllHeaderElements();
  +        SOAPHeaderElement she = null;
  +        int cnt = 0;
  +        while (iterator.hasNext()) {
  +            cnt++;
  +            she = (SOAPHeaderElement) iterator.next();
  +            assertEquals(she, she1);
  +        }
  +        assertEquals(1, cnt);
  +        iterator = hdr.extractAllHeaderElements();
  +        assertTrue(!iterator.hasNext());
  +    }
  +
  +    public void testExamineAllHeaders() throws Exception {
  +        MessageFactory mf = MessageFactory.newInstance();
  +        SOAPMessage soapMessage = mf.createMessage();
  +        SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
  +        SOAPHeader hdr = envelope.getHeader();
  +        SOAPHeaderElement she1 = hdr.addHeaderElement(envelope.createName("foo1", "f1",
"foo1-URI"));
  +        she1.setActor("actor-URI");
  +
  +        Iterator iterator = hdr.examineAllHeaderElements();
  +        SOAPHeaderElement she = null;
  +        int cnt = 0;
  +        while (iterator.hasNext()) {
  +            cnt++;
  +            she = (SOAPHeaderElement) iterator.next();
  +            assertEquals(she, she1);
  +        }
  +        assertEquals(1, cnt);
  +        iterator = hdr.examineAllHeaderElements();
  +        assertTrue(iterator.hasNext());
       }
   }
  
  
  

Mime
View raw message