axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Daniels" <gdani...@macromedia.com>
Subject Re: cvs commit: xml-axis/java/test/encoding TestDOM.java
Date Fri, 10 Aug 2001 13:14:50 GMT
Oh yeah, and also add setting of the dirty flag when modifying the
envelope...

--G

----- Original Message -----
From: <gdaniels@apache.org>
To: <xml-axis-cvs@apache.org>
Sent: Friday, August 10, 2001 9:08 AM
Subject: cvs commit: xml-axis/java/test/encoding TestDOM.java


> gdaniels    01/08/10 06:08:22
>
>   Modified:    java/src/org/apache/axis/encoding
>                         DeserializationContext.java
>                java/src/org/apache/axis/message MessageElement.java
>                         SOAPEnvelope.java
>                java/test/RPCDispatch TestSerializedRPC.java
>                java/test/encoding TestDOM.java
>   Log:
>   Remember prefix mappings for recorded elements in a different way.
>
>   We now mark the first prefixMapping as the start of the MessageElement's
>   recorded SAX events, instead of the startElement event.  This should
>   enable us to correctly serialize recorded elements and remember all the
>   prefix mappings correctly.
>
>   Also add a main() to TestDOM, and test the DOM round-trip in the main()
>   for TestSerializedRPC.
>
>   Revision  Changes    Path
>   1.19      +16 -0
xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
>
>   Index: DeserializationContext.java
>   ===================================================================
>   RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.
java,v
>   retrieving revision 1.18
>   retrieving revision 1.19
>   diff -u -r1.18 -r1.19
>   --- DeserializationContext.java 2001/07/22 05:57:22 1.18
>   +++ DeserializationContext.java 2001/08/10 13:08:22 1.19
>   @@ -307,6 +307,17 @@
>            return recorder.getLength() - 1;
>        }
>
>   +    protected int startOfMappingsPos = -1;
>   +
>   +    public int getStartOfMappingsPos()
>   +    {
>   +        if (startOfMappingsPos == -1) {
>   +            return getCurrentRecordPos();
>   +        }
>   +
>   +        return startOfMappingsPos;
>   +    }
>   +
>        /****************************************************************
>         * Management of sub-handlers (deserializers)
>         */
>   @@ -389,6 +400,9 @@
>            if (recorder != null)
>                recorder.startPrefixMapping(prefix, uri);
>
>   +        if (startOfMappingsPos == -1)
>   +            startOfMappingsPos = getCurrentRecordPos();
>   +
>            if (prefix != null) {
>                namespaces.add(uri, prefix);
>            } else {
>   @@ -497,6 +511,8 @@
>
>            nextHandler.startElement(namespace, localName, qName,
>                                     attributes, this);
>   +
>   +        startOfMappingsPos = -1;
>        }
>
>        public void endElement(String namespace, String localName, String
qName)
>
>
>
>   1.41      +2 -1
xml-axis/java/src/org/apache/axis/message/MessageElement.java
>
>   Index: MessageElement.java
>   ===================================================================
>   RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
>   retrieving revision 1.40
>   retrieving revision 1.41
>   diff -u -r1.40 -r1.41
>   --- MessageElement.java 2001/08/09 20:34:22 1.40
>   +++ MessageElement.java 2001/08/10 13:08:22 1.41
>   @@ -141,7 +141,7 @@
>                this.prefix = qName.substring(0, idx);
>
>            this.context = context;
>   -        this.startEventIndex = context.getCurrentRecordPos();
>   +        this.startEventIndex = context.getStartOfMappingsPos();
>            this.recorder = context.getRecorder();
>
>            if (attributes == null) {
>   @@ -274,6 +274,7 @@
>
>            StringWriter writer = new StringWriter();
>            output(new SerializationContext(writer, msgContext));
>   +        writer.close();
>
>            Reader reader = new
StringReader(writer.getBuffer().toString());
>            Document doc = XMLUtils.newDocument(new InputSource(reader));
>
>
>
>   1.31      +7 -0
xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
>
>   Index: SOAPEnvelope.java
>   ===================================================================
>   RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
>   retrieving revision 1.30
>   retrieving revision 1.31
>   diff -u -r1.30 -r1.31
>   --- SOAPEnvelope.java 2001/08/09 20:34:22 1.30
>   +++ SOAPEnvelope.java 2001/08/10 13:08:22 1.31
>   @@ -133,6 +133,7 @@
>                System.out.println("Adding header to message...");
>            header.setEnvelope(this);
>            headers.addElement(header);
>   +        _isDirty = true;
>        }
>
>        public void addBodyElement(SOAPBodyElement element)
>   @@ -141,6 +142,7 @@
>                System.out.println("Adding body element to message...");
>            element.setEnvelope(this);
>            bodyElements.addElement(element);
>   +        _isDirty = true;
>        }
>
>        public void removeHeader(SOAPHeader header)
>   @@ -148,6 +150,7 @@
>            if (DEBUG_LOG)
>                System.out.println("Removing header from message...");
>            headers.removeElement(header);
>   +        _isDirty = true;
>        }
>
>        public void removeBodyElement(SOAPBodyElement element)
>   @@ -155,6 +158,7 @@
>            if (DEBUG_LOG)
>                System.out.println("Removing body element from
message...");
>            bodyElements.removeElement(element);
>   +        _isDirty = true;
>        }
>
>        public void removeTrailer(MessageElement element)
>   @@ -162,12 +166,14 @@
>            if (DEBUG_LOG)
>                System.out.println("Removing trailer from message...");
>            trailers.removeElement(element);
>   +        _isDirty = true;
>        }
>
>        public void clearBody()
>        {
>            if (!bodyElements.isEmpty())
>                bodyElements.removeAllElements();
>   +        _isDirty = true;
>        }
>
>        public void addTrailer(MessageElement element)
>   @@ -176,6 +182,7 @@
>                System.out.println("Adding trailer to message...");
>            element.setEnvelope(this);
>            trailers.addElement(element);
>   +        _isDirty = true;
>        }
>
>        public SOAPHeader getHeaderByName(String namespace, String
localPart)
>
>
>
>   1.7       +1 -0
xml-axis/java/test/RPCDispatch/TestSerializedRPC.java
>
>   Index: TestSerializedRPC.java
>   ===================================================================
>   RCS file:
/home/cvs/xml-axis/java/test/RPCDispatch/TestSerializedRPC.java,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- TestSerializedRPC.java 2001/08/08 19:52:54 1.6
>   +++ TestSerializedRPC.java 2001/08/10 13:08:22 1.7
>   @@ -186,6 +186,7 @@
>            TestSerializedRPC tester = new TestSerializedRPC("Test
Serialized RPC");
>            tester.testSerReverseString();
>            tester.testSerReverseData();
>   +        tester.testArgAsDOM();
>          } catch (Exception e) {
>            e.printStackTrace();
>          }
>
>
>
>   1.3       +6 -1      xml-axis/java/test/encoding/TestDOM.java
>
>   Index: TestDOM.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/test/encoding/TestDOM.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- TestDOM.java 2001/08/09 22:59:14 1.2
>   +++ TestDOM.java 2001/08/10 13:08:22 1.3
>   @@ -55,10 +55,15 @@
>           message.setMessageContext(msgContext);
>
>           // Now completely round trip it
>   -       SOAPEnvelope envelope = message.getAsSOAPEnvelope();
>   +       SOAPEnvelope envelope = message.getAsSOAPEnvelope();
>   +
>           // Element dom = message.getAsDOM();
>           String result = message.getAsString();
>
>           assertEquals(request, result);
>   +    }
>   +
>   +    public static void main(String [] args) throws Exception
>   +    {
>         TestDOM tester = new TestDOM("TestDOM");
>         tester.testDOM();
>        }
>    }
>
>
>
>


Mime
View raw message