You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/02/07 04:30:55 UTC
svn commit: r151673 - in webservices/axis/trunk/java/dev/scratch/prototype2:
./ src/java/org/apache/axis/impl/llom/
src/java/org/apache/axis/impl/llom/serialize/
src/test/org/apache/axis/om/impl/seriliazer/
src/test/org/apache/axis/om/impl/streamwrapper/
Author: ajith
Date: Sun Feb 6 19:30:54 2005
New Revision: 151673
URL: http://svn.apache.org/viewcvs?view=rev&rev=151673
Log:
The bugs that caused the tests to fail are fixed. Project xml is also updated
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/seriliazer/ElementSerializerTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/project.xml?view=diff&r1=151672&r2=151673
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/project.xml (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/project.xml Sun Feb 6 19:30:54 2005
@@ -139,10 +139,10 @@
<excludes>
<exclude>**/*Abstract*.java</exclude>
- <exclude>**/*Util*.java</exclude>
- <exclude>**/OMStaxStreamingWrapperTest.java</exclude>
+ <exclude>**/*Util*.java</exclude>
+ <!--exclude>**/OMStaxStreamingWrapperTest.java</exclude>
<exclude>**/OMSerailizerTest.java</exclude>
- <exclude>**/ElementSerializerTest.java</exclude>
+ <exclude>**/ElementSerializerTest.java</exclude-->
</excludes>
<includes>
<include>**/*Test.java</include>
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java?view=diff&r1=151672&r2=151673
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMStAXWrapper.java Sun Feb 6 19:30:54 2005
@@ -109,7 +109,7 @@
//Note - navigator is written in such a way that it first
//returns the starting node at the first call to it
currentNode = navigator.next();
- nextNode = navigator.next();
+ updateNextNode();
switchingAllowed = cacheOff;
}
/**
@@ -629,7 +629,7 @@
if (navigable) {
currentEvent = generateEvents(currentNode);
updateCompleteStatus();
- updateNextNode();
+ updateLastNode();
} else {
currentEvent = builder.next();
updateCompleteStatus();
@@ -649,10 +649,18 @@
* At the same time the parser and builder are set up for the upcoming event
* generation
*/
- private void updateNextNode() throws XMLStreamException {
+ private void updateLastNode() throws XMLStreamException {
lastNode = currentNode;
currentNode = nextNode;
+ try {
+ updateNextNode();
+ } catch (Exception e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private void updateNextNode() {
if (navigator.isNavigable()) {
nextNode = navigator.next();
} else {
@@ -672,7 +680,7 @@
try {
parser = (XMLStreamReader) builder.getParser();
} catch (ClassCastException e) {
- throw new XMLStreamException("incompatible parser found!", e);
+ throw new UnsupportedOperationException("incompatible parser found!");
}
switched = true;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java?view=diff&r1=151672&r2=151673
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java Sun Feb 6 19:30:54 2005
@@ -27,17 +27,12 @@
*/
public class StreamingOMSerializer implements XMLStreamConstants, OMSerializer {
-// private Stack namespacePrefixStack = new Stack();
-// private Stack namespaceCountStack = new Stack();
-
-// public Stack getNamespacePrefixStack() {
-// return namespacePrefixStack;
-// }
-//
-// public void setNamespacePrefixStack(Stack namespacePrefixStack) {
-// if (namespacePrefixStack != null)
-// this.namespacePrefixStack = namespacePrefixStack;
-// }
+ /* The behavior of the serializer is such that it returns when it encounters the
+ starting element for the second time. The depth variable tracks the depth of the
+ serilizer and tells it when to return.
+ Note that it is assumed that this serilization starts on an Element
+ */
+ private int depth = 0;
public void serialize(Object obj, XMLStreamWriter writer) throws XMLStreamException {
if (!(obj instanceof XMLStreamReader)) {
@@ -52,8 +47,10 @@
protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
while (reader.hasNext()) {
int event = reader.next();
+
if (event == START_ELEMENT) {
serializeElement(reader, writer);
+ depth ++;
} else if (event == ATTRIBUTE) {
serializeAttributes(reader, writer);
} else if (event == CHARACTERS) {
@@ -64,6 +61,7 @@
serializeCData(reader, writer);
} else if (event == END_ELEMENT) {
serializeEndElement(writer);
+ depth--;
} else if (event == END_DOCUMENT) {
try {
serializeEndElement(writer);
@@ -71,6 +69,7 @@
//this is eaten
}
}
+ if (depth==0) break;
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/seriliazer/ElementSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/seriliazer/ElementSerializerTest.java?view=diff&r1=151672&r2=151673
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/seriliazer/ElementSerializerTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/seriliazer/ElementSerializerTest.java Sun Feb 6 19:30:54 2005
@@ -43,9 +43,7 @@
tempFile = File.createTempFile("temp","xml");
writer = XMLOutputFactory.newInstance().
createXMLStreamWriter(new FileOutputStream(tempFile));
-// writer = XMLOutputFactory.newInstance().
-// createXMLStreamWriter(System.out);
- builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMFactory.newInstance(),reader);
+ builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMFactory.newInstance(),reader);
}
public void testElementSerilization() throws Exception{
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?view=diff&r1=151672&r2=151673
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java Sun Feb 6 19:30:54 2005
@@ -48,18 +48,18 @@
}
-// public void testWrapperFullOM() throws Exception {
-// assertNotNull(envelope);
-// //this serializing will cause the OM to fully build!
-// XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(tempFile));
-// envelope.serialize(writer,true);
-// parser = envelope.getPullParser(false);
-// while (parser.hasNext()) {
-// int event = parser.next();
-// assertTrue(event > 0);
-// }
-//
-// }
+ public void testWrapperFullOM() throws Exception {
+ assertNotNull(envelope);
+ //this serializing will cause the OM to fully build!
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(tempFile));
+ envelope.serialize(writer,true);
+ parser = envelope.getPullParser(false);
+ while (parser.hasNext()) {
+ int event = parser.next();
+ assertTrue(event > 0);
+ }
+
+ }
public void testWrapperHalfOM() throws Exception {
assertNotNull(envelope);
@@ -70,14 +70,14 @@
}
}
-// public void testWrapperHalfOMWithCacheOff() throws Exception {
-// assertNotNull(envelope);
-// parser = envelope.getPullParser(true);
-// while (parser.hasNext()) {
-// int event = parser.next();
-// assertTrue(event > 0);
-// }
-// }
+ public void testWrapperHalfOMWithCacheOff() throws Exception {
+ assertNotNull(envelope);
+ parser = envelope.getPullParser(true);
+ while (parser.hasNext()) {
+ int event = parser.next();
+ assertTrue(event > 0);
+ }
+ }
//
// public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException {
// assertNotNull(envelope);