Author: veithen
Date: Sun Nov 6 14:59:06 2011
New Revision: 1198385
URL: http://svn.apache.org/viewvc?rev=1198385&view=rev
Log:
Simplified some unit test code.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestGetDocumentElement.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java?rev=1198385&r1=1198384&r2=1198385&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
Sun Nov 6 14:59:06 2011
@@ -19,7 +19,6 @@
package org.apache.axiom.om;
-import org.apache.axiom.om.util.StAXUtils;
import org.custommonkey.xmlunit.Diff;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -35,7 +34,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Iterator;
-
public class SpacesTest extends AbstractTestCase {
private static final String filePath = "spaces.xml";
private static final String filePath2 = "spaces2.xml";
@@ -49,9 +47,7 @@ public class SpacesTest extends Abstract
private void checkOMConformance(InputStream iStream) throws Exception {
OMXMLParserWrapper staxOMBuilder = OMXMLBuilderFactory.
- createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
- StAXUtils.createXMLStreamReader(
- iStream));
+ createOMBuilder(OMAbstractFactory.getOMFactory(), iStream);
rootElement = staxOMBuilder.getDocumentElement();
boolean hasCDataNode = hasCDataNode(rootElement);
String file = hasCDataNode ? filePath : filePath2;
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java?rev=1198385&r1=1198384&r2=1198385&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
Sun Nov 6 14:59:06 2011
@@ -55,18 +55,16 @@ public class StaxParserTest extends Abst
//parser 2 is one of our parsers taken with cache. i.e. when the parser
//proceeds the object model will be built
- builder2 = OMXMLBuilderFactory.createStAXOMBuilder(
+ builder2 = OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getSOAP11Factory(),
- StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xmlDocument.getBytes())));
+ new ByteArrayInputStream(xmlDocument.getBytes()));
parser2 = builder2.getDocumentElement().getXMLStreamReader();
//same as parser2 but this time the parser is not a caching parser.
Once the
//parser proceeds, it's gone forever.
- builder3 = OMXMLBuilderFactory.createStAXOMBuilder(
+ builder3 = OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getSOAP11Factory(),
- StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xmlDocument.getBytes())));
+ new ByteArrayInputStream(xmlDocument.getBytes()));
parser3 =
builder3.getDocumentElement().getXMLStreamReaderWithoutCaching();
@@ -128,10 +126,9 @@ public class StaxParserTest extends Abst
public void testParserBehaviornonCaching() throws Exception {
- OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(
+ OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getOMFactory(),
- StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xmlDocument.getBytes())));
+ new ByteArrayInputStream(xmlDocument.getBytes()));
OMElement documentElement = builder2.getDocumentElement();
XMLStreamReader originalParser =
@@ -161,10 +158,9 @@ public class StaxParserTest extends Abst
public void testParserBehaviorCaching() throws Exception {
- OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(
+ OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getSOAP11Factory(),
- StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xmlDocument.getBytes())));
+ new ByteArrayInputStream(xmlDocument.getBytes()));
OMElement documentElement = builder2.getDocumentElement();
XMLStreamReader originalParser =
@@ -197,10 +193,9 @@ public class StaxParserTest extends Abst
public void testParserBehaviorNonCaching2() throws Exception {
- OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(
+ OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getSOAP11Factory(),
- StAXUtils.createXMLStreamReader(
- new ByteArrayInputStream(xmlDocument.getBytes())));
+ new ByteArrayInputStream(xmlDocument.getBytes()));
OMElement documentElement = builder2.getDocumentElement();
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java?rev=1198385&r1=1198384&r2=1198385&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
Sun Nov 6 14:59:06 2011
@@ -26,7 +26,6 @@ import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.util.StAXUtils;
import java.util.Iterator;
@@ -41,10 +40,9 @@ public class StAXOMBuilderTest extends A
protected void setUp() throws Exception {
stAXOMBuilder =
- OMXMLBuilderFactory.createStAXOMBuilder(
+ OMXMLBuilderFactory.createOMBuilder(
OMAbstractFactory.getSOAP11Factory(),
- StAXUtils.createXMLStreamReader(
- getTestResource("non_soap.xml")));
+ getTestResource("non_soap.xml"));
}
protected void tearDown() throws Exception {
@@ -53,9 +51,6 @@ public class StAXOMBuilderTest extends A
public void testGetRootElement() throws Exception {
rootElement = stAXOMBuilder.getDocumentElement();
- assertTrue("Root element can not be null", rootElement != null);
- assertTrue(" Name of the root element is wrong",
- rootElement.getLocalName().equalsIgnoreCase("Root"));
// get the first OMElement child
OMNode omnode = rootElement.getFirstOMChild();
while (omnode instanceof OMText) {
@@ -73,9 +68,6 @@ public class StAXOMBuilderTest extends A
public void testClose1() throws Exception {
rootElement = stAXOMBuilder.getDocumentElement();
- assertTrue("Root element can not be null", rootElement != null);
- assertTrue(" Name of the root element is wrong",
- rootElement.getLocalName().equalsIgnoreCase("Root"));
// get the first OMElement child
OMNode omnode = rootElement.getFirstOMChild();
while (omnode instanceof OMText) {
@@ -98,9 +90,6 @@ public class StAXOMBuilderTest extends A
public void testClose2() throws Exception {
rootElement = stAXOMBuilder.getDocumentElement();
- assertTrue("Root element can not be null", rootElement != null);
- assertTrue(" Name of the root element is wrong",
- rootElement.getLocalName().equalsIgnoreCase("Root"));
// get the first OMElement child
OMNode omnode = rootElement.getFirstOMChild();
while (omnode instanceof OMText) {
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestGetDocumentElement.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestGetDocumentElement.java?rev=1198385&r1=1198384&r2=1198385&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestGetDocumentElement.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/builder/TestGetDocumentElement.java
Sun Nov 6 14:59:06 2011
@@ -39,7 +39,8 @@ public class TestGetDocumentElement exte
OMXMLParserWrapper builder =
OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
new StringReader("<!--comment1--><root/><!--comment2-->"));
OMElement element = builder.getDocumentElement();
- assertEquals("root", element.getLocalName());
+ assertNotNull("Document element can not be null", element);
+ assertEquals("Name of the document element is wrong", "root",
element.getLocalName());
// The getDocumentElement doesn't detach the document element from the
document:
assertSame(builder.getDocument(), element.getParent());
assertSame(builder.getDocument().getOMDocumentElement(), element);