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 he...@apache.org on 2004/11/30 15:11:34 UTC
svn commit: r107006 - in webservices/axis/trunk/java/dev/scratch/prototype1/src: java/org/apache/axis/om java/org/apache/axis/om/impl java/org/apache/axis/om/impl/streamwrapper java/org/apache/axis/om/impl/util test-resources/soap test/org/apache/axis test/org/apache/axis/engine/deployment test/org/apache/axis/om test/org/apache/axis/om/impl/streamwrapper test/org/apache/axis/om/soap
Author: hemapani
Date: Tue Nov 30 06:11:32 2004
New Revision: 107006
URL: http://svn.apache.org/viewcvs?view=rev&rev=107006
Log:
Refactoring to correct the test classes : commitng on behalf of ajith
Added:
webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emptyBodymessage.xml
- copied unchanged from r106994, webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml
Removed:
webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestCase.java
Modified:
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java
webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/OMElement.java Tue Nov 30 06:11:32 2004
@@ -1,7 +1,7 @@
package org.apache.axis.om;
-import org.apache.xml.utils.QName;
+import javax.xml.namespace.QName;
import java.util.Iterator;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMElementImpl.java Tue Nov 30 06:11:32 2004
@@ -3,8 +3,9 @@
import org.apache.axis.om.*;
import org.apache.axis.om.impl.util.OMChildrenIterator;
import org.apache.axis.om.impl.util.OMChildrenQNameIterator;
-import org.apache.xml.utils.QName;
+
+import javax.xml.namespace.QName;
import java.io.PrintStream;
import java.util.Iterator;
@@ -28,6 +29,7 @@
* Time: 1:16:10 PM
*/
public class OMElementImpl extends OMNamedNodeImpl implements OMElement {
+
private OMNode firstChild;
private OMXMLParserWrapper builder;
private OMAttributeImpl firstAttribute;
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/OMNamedNodeImpl.java Tue Nov 30 06:11:32 2004
@@ -4,8 +4,8 @@
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNamedNode;
import org.apache.axis.om.OMNamespace;
-import org.apache.xml.utils.QName;
+import javax.xml.namespace.QName;
import java.io.PrintStream;
/**
@@ -75,7 +75,7 @@
}
public QName getQName() {
- QName qName = new QName(ns.getValue(), ns.getPrefix(), localName);
+ QName qName = new QName(ns.getValue(), localName,ns.getPrefix());
return qName;
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPEnvelopeImpl.java Tue Nov 30 06:11:32 2004
@@ -8,8 +8,9 @@
import org.apache.axis.om.soap.SOAPBody;
import org.apache.axis.om.soap.SOAPEnvelope;
import org.apache.axis.om.soap.SOAPHeader;
-import org.apache.xml.utils.QName;
+
+import javax.xml.namespace.QName;
import java.util.Iterator;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/SOAPHeaderElementImpl.java Tue Nov 30 06:11:32 2004
@@ -6,8 +6,8 @@
import org.apache.axis.om.OMXMLParserWrapper;
import org.apache.axis.om.impl.util.SOAPConstants;
import org.apache.axis.om.soap.SOAPHeaderElement;
-import org.apache.xml.utils.QName;
+import javax.xml.namespace.QName;
import java.util.Iterator;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/streamwrapper/OMXPPWrapper.java Tue Nov 30 06:11:32 2004
@@ -86,7 +86,7 @@
lastNode.setNextSibling(node);
node.setPreviousSibling(lastNode);
} else {
- System.out.println("lastNode = " + lastNode.getClass());
+// System.out.println("lastNode = " + lastNode.getClass());
OMElementImpl e = (OMElementImpl) lastNode;
node = constructNode((OMElement) lastNode, elementName);
// node = new OMElementImpl(parser.getName(), null, (OMElement) lastNode, this);
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java Tue Nov 30 06:11:32 2004
@@ -3,8 +3,8 @@
import org.apache.axis.om.OMNode;
import org.apache.axis.om.impl.OMNamedNodeImpl;
import org.apache.axis.om.impl.OMNodeImpl;
-import org.apache.xml.utils.QName;
+import javax.xml.namespace.QName;
import java.util.Iterator;
/**
@@ -116,8 +116,13 @@
}
// if the given localname is null, whatever value this.qname has, its a match
- boolean localNameMatch = qNameToBeMatched.getLocalName() == null || qNameToBeMatched.getLocalName() == "" || (elementQName != null && elementQName.getLocalName().equalsIgnoreCase(qNameToBeMatched.getLocalName()));
- boolean namespaceURIMatch = qNameToBeMatched.getNamespaceURI() == null || qNameToBeMatched.getNamespaceURI() == "" || (elementQName != null && elementQName.getNamespaceURI().equalsIgnoreCase(qNameToBeMatched.getNamespaceURI()));
+ boolean localNameMatch = qNameToBeMatched.getLocalPart() == null ||
+ qNameToBeMatched.getLocalPart() == "" ||
+ (elementQName != null && elementQName.getLocalPart().equalsIgnoreCase(qNameToBeMatched.getLocalPart()));
+
+ boolean namespaceURIMatch = qNameToBeMatched.getNamespaceURI() == null ||
+ qNameToBeMatched.getNamespaceURI() == "" ||
+ (elementQName != null && elementQName.getNamespaceURI().equalsIgnoreCase(qNameToBeMatched.getNamespaceURI()));
return localNameMatch && namespaceURIMatch;
Copied: webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emptyBodymessage.xml (from r106994, webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml)
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emptyBodymessage.xml?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml&r1=106994&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emptyBodymessage.xml&r2=107006
==============================================================================
Deleted: /webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test-resources/soap/emtyBodymessage.xml?view=auto&rev=107005
==============================================================================
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/AbstractTestCase.java Tue Nov 30 06:11:32 2004
@@ -30,7 +30,10 @@
protected String sampleDir = "src/samples/";
protected String outDir = "target/generated/samples/";
protected String tempDir = "target/generated/temp";
- /**
+ protected String testResourceDir = "src/test-resources";
+
+
+ /**
* Basedir for all file I/O. Important when running tests from
* the reactor.
*/
@@ -44,26 +47,16 @@
super(testName);
if(basedir == null){
basedir = new File(".").getAbsolutePath();
- if(!(basedir.endsWith("axis")
- ||basedir.endsWith("axis\\")
- ||basedir.endsWith("axis/"))){
- basedir = new File("./modules/axis").getAbsolutePath();
- }
}
testDir = new File(basedir,testDir).getAbsolutePath();
sampleDir = new File(basedir,sampleDir).getAbsolutePath();
outDir = new File(basedir,outDir).getAbsolutePath();
tempDir = new File(basedir,tempDir).getAbsolutePath();
}
-
- /**
- * Get test input file.
- *
- * @param path Path to test input file.
- */
- public String getTestFile(String path)
- {
- return new File(basedir,path).getAbsolutePath();
- }
+
+
+ public File getTestResourceFile(String relativePath){
+ return new File(testResourceDir,relativePath);
+ }
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/engine/deployment/ServiceTest.java Tue Nov 30 06:11:32 2004
@@ -30,18 +30,6 @@
public class ServiceTest extends TestCase {
public void testparseService1() throws PhaseException ,DeploymentException, AxisFault{
- /* File file = new File("src/test-resources/deployment/service1.xml");
- String filename = "D:/Axis 2.0/projects/Deployement/test-data";
- InputStream inputStream = null;
- try {
- inputStream = new FileInputStream(file);
- } catch (FileNotFoundException e) {
- e.printStackTrace(); //To change body of catch statement use Options | File Templates.
- }
- DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
- EngineRegistry er = deploymentEngine.start();
- // DeploymentEngine deploymentEngine = new DeploymentEngine(inputStream, file.getName());
- */
String filename = "src/test-resources/deployment";
DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
try {
@@ -62,6 +50,4 @@
axisFault.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
}
-
-
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/IteratorTester.java Tue Nov 30 06:11:32 2004
@@ -3,6 +3,7 @@
import junit.framework.TestCase;
import org.apache.axis.om.impl.streamwrapper.OMStAXBuilder;
import org.apache.axis.om.soap.SOAPMessage;
+import org.apache.axis.AbstractTestCase;
import javax.xml.stream.XMLInputFactory;
import java.io.FileReader;
@@ -28,29 +29,28 @@
* Time: 12:34:15 PM
*
*/
-public class IteratorTester extends TestCase{
- private static final String IN_FILE_NAME = "resources/soapmessage.xml";
- private static final String IN_FILE_NAME2 = "src/test-resources/soap/sample1.xml";
- SOAPMessage document = null;
+public class IteratorTester extends AbstractTestCase{
+
+ SOAPMessage message = null;
+
+ public IteratorTester(String testName) {
+ super(testName);
+ }
protected void setUp() throws Exception {
-// XmlPullParser parser= XmlPullParserFactory.newInstance().newPullParser();
-// parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-// parser.setInput();
-// ;
- document = new OMStAXBuilder(XMLInputFactory.newInstance().
- createXMLStreamReader(new FileReader(IN_FILE_NAME2))).getSOAPMessage();
+ message = new OMStAXBuilder(XMLInputFactory.newInstance().
+ createXMLStreamReader(new FileReader(getTestResourceFile("soap/sample1.xml")))).getSOAPMessage();
}
public void testIterator(){
- OMElement elt = document.getEnvelope();
+ OMElement elt = message.getEnvelope();
Iterator iter = elt.getChildren();
while (iter.hasNext()) {
OMNode o = (OMNode) iter.next();
- System.out.println("o = " + o);
- if (o!=null)
- System.out.println("value o " + o.getValue());
+ //Todo need to improve this test
+ assertNotNull(o);
+
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTest.java Tue Nov 30 06:11:32 2004
@@ -19,6 +19,7 @@
import org.apache.axis.om.impl.SOAPMessageImpl;
import org.apache.axis.om.impl.streamwrapper.OMXPPWrapper;
import org.apache.axis.om.soap.SOAPMessage;
+import org.apache.axis.AbstractTestCase;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -31,10 +32,15 @@
* This test case tests the basic expectations of the engine from the OM.
* @author Srinath Perera (hemapani@opensource.lk)
*/
-public class OMTest extends TestCase{
- SOAPMessage omdoc;
+public class OMTest extends AbstractTestCase{
+ SOAPMessage message;
+
+ public OMTest(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
- File file = new File("src/test-resources/soap/sample1.xml");
+ File file = getTestResourceFile("soap/sample1.xml");
FileInputStream in = new FileInputStream(file);
XmlPullParserFactory pf = XmlPullParserFactory.newInstance();
@@ -43,7 +49,7 @@
parser.setInput(new InputStreamReader(in));
OMXMLParserWrapper parserWrapper = new OMXPPWrapper(parser);
- omdoc = parserWrapper.getSOAPMessage();
+ message = parserWrapper.getSOAPMessage();
}
@@ -52,24 +58,24 @@
*/
public void testNullInChilderen(){
- isNullChildrenAreThere(omdoc.getEnvelope());
+ isNullChildrenThere(message.getEnvelope());
}
/**
- * the document is completly namesapce qulified so all the OMElements got to have namespace values not null
+ * the message is completly namesapce qulified so all the OMElements got to have namespace values not null
*
*/
public void test4MissingNamespaces(){
- isNameSpacesMissing(omdoc.getEnvelope());
+ isNameSpacesMissing(message.getEnvelope());
}
- public void isNullChildrenAreThere(OMElement omeleent){
+ public void isNullChildrenThere(OMElement omeleent){
Iterator it = omeleent.getChildren();
while(it.hasNext()){
OMNode node = (OMNode)it.next();
assertNotNull(node);
if(node.getType() == OMNode.ELEMENT_NODE){
- isNullChildrenAreThere((OMElement)node);
+ isNullChildrenThere((OMElement)node);
}
}
}
Deleted: /webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestCase.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestCase.java?view=auto&rev=107005
==============================================================================
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMTestUtils.java Tue Nov 30 06:11:32 2004
@@ -17,6 +17,7 @@
package org.apache.axis.om;
import java.io.FileReader;
+import java.io.File;
import java.util.Iterator;
@@ -30,14 +31,17 @@
* @author Srinath Perera(hemapani@opensource.lk)
*/
public class OMTestUtils {
- public static OMXPPWrapper getOMBuilder(String file) throws Exception {
+
+
+
+ public static OMXPPWrapper getOMBuilder(File file) throws Exception {
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(new FileReader(file));
OMXPPWrapper omXmlPullParserWrapper = new OMXPPWrapper(parser);
return omXmlPullParserWrapper;
}
-
+
public static void walkThrough(OMElement omEle){
Iterator attibIt = omEle.getAttributes();
while(attibIt.hasNext()){
@@ -47,7 +51,8 @@
Iterator it = omEle.getChildren();
while(it.hasNext()){
OMNode ele = (OMNode)it.next();
- TestCase.assertNotNull("once the has next is not null, the " +
"eleemnt should not be null",ele);
+ TestCase.assertNotNull("once the has next is not null, the " +
+ "eleemnt should not be null",ele);
if(ele instanceof OMElement){
walkThrough((OMElement)ele);
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/OMnavigatorTest.java Tue Nov 30 06:11:32 2004
@@ -6,10 +6,14 @@
import org.apache.axis.om.impl.serialize.SimpleOMSerializer;
import org.apache.axis.om.impl.streamwrapper.OMStAXBuilder;
import org.apache.axis.om.soap.SOAPMessage;
+import org.apache.axis.AbstractTestCase;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.FileReader;
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -29,17 +33,22 @@
* @author Axis team
* Date: Nov 19, 2004
* Time: 4:35:04 PM
- *
+ *
+ * Todo - These test classes are supposed to be modified further to support exact XML's
*/
-public class OMnavigatorTest extends TestCase{
- private static final String IN_FILE_NAME2 = "src/test-resources/soap/soapmessage1.xml";
+public class OMnavigatorTest extends AbstractTestCase{
+
private SOAPMessage document = null;
private SimpleOMSerializer serilizer;
private OMStAXBuilder builder;
+ public OMnavigatorTest(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
- createXMLStreamReader(new FileReader(IN_FILE_NAME2));
+ createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
OMFactory factory = new OMLinkedListImplFactory();
builder = new OMStAXBuilder(factory,xmlStreamReader);
document = builder.getSOAPMessage();
@@ -48,46 +57,40 @@
public void testnavigatorFullyBuilt(){
- System.out.println(" ####### Testing fully built OM tree ########");
+
assertNotNull(document);
- serilizer.serialize(document.getEnvelope(),System.out);
+ try {
+ serilizer.serialize(document.getEnvelope(), new FileOutputStream(new File("temp.xml")));
+ } catch (FileNotFoundException e) {
+ assertFalse(true);
+ }
//now the OM is fully created
OMNavigator navigator = new OMNavigator(document.getEnvelope());
OMNode node=null;
while(navigator.isNavigable()){
node = navigator.next();
-
assertNotNull(node);
- System.out.println("node = " + node);
- System.out.println("node.getValue() = " + node.getValue());
-
}
}
public void testnavigatorHalfBuilt(){
- System.out.println(" ####### Testing partially built OM tree ########");
- assertNotNull(document);
- //now the OM is not fully created
+ assertNotNull(document);
+ //now the OM is not fully created
OMNavigator navigator = new OMNavigator(document.getEnvelope());
OMNode node=null;
while(navigator.isNavigable()){
node = navigator.next();
-
assertNotNull(node);
- System.out.println("node = " + node);
- System.out.println("node.getValue() = " + node.getValue());
-
}
}
public void testnavigatorHalfBuiltStep(){
- System.out.println(" ####### Testing partially built OM tree With Stepping########");
assertNotNull(document);
//now the OM is not fully created
@@ -104,9 +107,6 @@
}
assertNotNull(node);
-
- System.out.println("node = " + node);
- System.out.println("node.getValue() = " + node.getValue());
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/Tester.java Tue Nov 30 06:11:32 2004
@@ -25,94 +25,96 @@
import org.apache.axis.om.impl.OMTextImpl;
import org.apache.axis.om.impl.serialize.SimpleOMSerializer;
import org.apache.axis.om.impl.streamwrapper.OMStAXBuilder;
+import org.apache.axis.AbstractTestCase;
import org.xmlpull.v1.XmlPullParser;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
+import javax.xml.namespace.QName;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
+import java.util.Iterator;
/**
* @author Dasarath Weeratunge
+ * @author Ajith Ranabahu (Modifier)
*
*/
-public class Tester extends TestCase {
- private static final String IN_FILE_NAME = "src/test-resources/soap/soapmessage.xml";
- private static final String OUT_FILE_NAME = "src/test-resources/soap/tester-out.xml";
+public class Tester extends AbstractTestCase {
private SimpleOMSerializer serializer = null;
+ public Tester(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
super.setUp();
serializer = new SimpleOMSerializer();
}
- public void test1() throws Exception {
- System.out.println("\n+++");
+ public void testRootNotCompleteInPartialBuild() throws Exception {
OMElement root= getOMBuilder().getSOAPMessage().getEnvelope();
- System.out.println(root.isComplete());
- print(root,System.out);
+ assertFalse("Root should not be complete",root.isComplete());
}
- public void test2() throws Exception {
- System.out.println("\n+++");
+ /**
+ * Assumption - The fed XML has at least two children under the root element
+ * @throws Exception
+ */
+ public void testFirstChildDetach() throws Exception {
OMElement root= getOMBuilder().getSOAPMessage().getEnvelope();
+ assertFalse("Root should not be complete",root.isComplete());
+ OMNode oldFirstChild = root.getFirstChild();
+ assertNotNull(oldFirstChild);
+ oldFirstChild.detach();
- System.out.println(root.isComplete());
- root.getFirstChild().detach();
-
- System.out.println("---");
- navigate(root);
-
- OMElement header= (OMElement)root.getFirstChild();
- // we read the header completely but do not cache it
- // header.detach();
-
- System.out.println("---");
- navigate(root);
+ OMNode newFirstChild = root.getFirstChild();
+ assertNotNull(newFirstChild);
- System.out.println("---");
- print(root,System.out);
+ assertNotSame(oldFirstChild,newFirstChild);
}
- public void test3() throws Exception {
- System.out.println("\n+++");
+ public void testAdditionOfaCompletelyNewElement() throws Exception {
+
OMElement root= getOMBuilder().getSOAPMessage().getEnvelope();
OMNamespace soapenv= root.resolveNamespace("http://schemas.xmlsoap.org/soap/envelope/", "soapenv");
OMNamespace wsa= root.resolveNamespace("http://schemas.xmlsoap.org/ws/2004/03/addressing", "wsa");
- OMElement relatesTo= new OMElementImpl("RelatesTo", wsa);
+ //Assumption - A RelatesTo Element does not exist in the input document
+ OMElement relatesTo= new OMElementImpl("RelatesTo", wsa); //todo isn't this wrong? this should come from the factory
relatesTo.insertAttribute(new OMAttributeImpl("RelationshipType", null, "wsa:Reply", relatesTo));
relatesTo.insertAttribute(new OMAttributeImpl("mustUnderstand", soapenv, "0", relatesTo));
relatesTo.addChild(new OMTextImpl(relatesTo, "uuid:3821F4F0-D020-11D8-A10A-E4EE6425FCB0"));
relatesTo.setComplete(true);
- System.out.println(root.isComplete());
root.addChild(relatesTo);
- OMNavigator navigator= new OMNavigator(root);
- OMNode node= navigator.next();
- do {
- if (node instanceof OMElement) {
- OMElement el= (OMElement)node;
- System.out.println("OMElement= " + el.getLocalName());
- }
- else
- System.out.println("OMText= " + node.getValue());
- node= navigator.next();
+ QName name = new QName(wsa.getValue(),"RelatesTo",wsa.getPrefix());
+
+ Iterator children = root.getChildrenWithName(name);
+ //this should contain only one child!
+ if (children.hasNext()){
+ OMElement newlyAddedElement = (OMElement)children.next();
+
+ assertNotNull(newlyAddedElement);
+
+ assertEquals(newlyAddedElement.getLocalName(),"RelatesTo");
+ //todo put the assert statements here
+ }else{
+ assertFalse("New child not added",true);
}
- while (node != null);
- print(root,System.out);
}
+ //Todo need to fix this
public void test4() throws Exception {
- System.out.println("\n+++");
+
OMElementImpl root= new OMElementImpl("Envelope", null);
OMNamespace soapenv= root.createNamespace("http://schemas.xmlsoap.org/soap/envelope/", "soapenv");
root.setNamespace(soapenv);
@@ -151,7 +153,7 @@
from.insertSiblingBefore(to);
to.insertSiblingBefore(messageID);
- root.print(new PrintStream(new FileOutputStream(OUT_FILE_NAME)));
+ //print(root,new PrintStream(new FileOutputStream(OUT_FILE_NAME)));
}
// public void test5() throws Exception {
@@ -189,45 +191,12 @@
while (navigator.isNavigable()){
tempNode= navigator.next();
-
- if (tempNode instanceof OMElement) {
- OMElement el= (OMElement)tempNode;
- System.out.print("OMElement= " + el.getLocalName());
- }
- else
- System.out.print("OMText= " + tempNode.getValue());
-
}
-
-// do {
-// if (tempNode instanceof OMElement) {
-// OMElement el= (OMElement)tempNode;
-// System.out.print("OMElement= " + el.getLocalName());
-// }
-// else
-// System.out.print("OMText= " + tempNode.getValue());
-// System.out.println(" isComplete= " + tempNode.isComplete());
-// tempNode= navigator.next();
-// }
-// while (tempNode != null);
}
private OMXMLParserWrapper getOMBuilder() throws Exception {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(IN_FILE_NAME));
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage.xml")));
return new OMStAXBuilder(reader);
}
- private static Field[] flds= XmlPullParser.class.getDeclaredFields();
-
- public static String getFieldName(int field) throws Exception {
- for (int i= 1; i < flds.length + 1; i++) {
- if (flds[i].getInt(null) == field)
- return flds[i].getName();
- }
- return null;
- }
-
- private void print(OMNode node,OutputStream stream){
- this.serializer.serialize(node,stream);
- }
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java Tue Nov 30 06:11:32 2004
@@ -5,11 +5,15 @@
import org.apache.axis.om.impl.factory.OMLinkedListImplFactory;
import org.apache.axis.om.impl.serialize.SimpleOMSerializer;
import org.apache.axis.om.soap.SOAPMessage;
+import org.apache.axis.AbstractTestCase;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamConstants;
import java.io.FileReader;
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -31,28 +35,37 @@
* Time: 5:23:01 PM
*
*/
-public class OMStaxStreamingWrapperTest extends TestCase {
+public class OMStaxStreamingWrapperTest extends AbstractTestCase {
- private static final String IN_FILE_NAME2 = "src/test-resources/soap/soapmessage1.xml";
private SOAPMessage document = null;
private SimpleOMSerializer serilizer;
private OMStAXBuilder omStAXBuilder;
+ private File tempFile;
+
+ public OMStaxStreamingWrapperTest(String testName) {
+ super(testName);
+ }
protected void setUp() throws Exception {
XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
- createXMLStreamReader(new FileReader(IN_FILE_NAME2));
+ createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
OMFactory factory = new OMLinkedListImplFactory();
omStAXBuilder = new OMStAXBuilder(factory, xmlStreamReader);
document = omStAXBuilder.getSOAPMessage();
serilizer = new SimpleOMSerializer();
+
+ tempFile = File.createTempFile("temp","xml");
}
public void testWrapperFullOM() {
- System.out.println(" # -----------------------Full OM------------------------------- #");
assertNotNull(document);
//this serializing will cause the OM to fully build!
- serilizer.serialize(document.getEnvelope(), System.out);
+ try {
+ serilizer.serialize(document.getEnvelope(), new FileOutputStream(tempFile));
+ } catch (FileNotFoundException e) {
+ assertFalse(true);
+ }
//now the OM is fully created. Create the wrapper and see
OMStAXWrapper wrapper = new OMStAXWrapper(omStAXBuilder, document.getEnvelope());
@@ -62,11 +75,9 @@
assertTrue(event>0);
}
- System.out.println(" # -----------------------Full OM end ------------------------------- #");
}
public void testWrapperHalfOM() {
- System.out.println(" # -----------------------Half OM------------------------------- #");
assertNotNull(document);
//now the OM is not fully created. Create the wrapper and see
@@ -75,13 +86,11 @@
while (wrapper.hasNext()) {
int event = wrapper.next();
assertTrue(event>0);
-// System.out.println("returnEvent = " + getEventString(event));
+ //System.out.println("returnEvent = " + getEventString(event));
}
- System.out.println(" # -----------------------Half OM end------------------------------- #");
}
public void testWrapperHalfOMWithCacheOff() {
- System.out.println(" # -----------------------Half OM with cache off------------------------------- #");
assertNotNull(document);
//now the OM is not fully created. Create the wrapper and see
@@ -91,27 +100,11 @@
while (wrapper.hasNext()) {
int event = wrapper.next();
assertTrue(event>0);
-// System.out.println("returnEvent = " + getEventString(event));
+ //System.out.println("returnEvent = " + getEventString(event));
}
- System.out.println(" # -----------------------Half OM with cache off end------------------------------- #");
}
- private String getEventString(int event){
- String outStr = "";
- switch (event){
- case XMLStreamConstants.START_ELEMENT:
- outStr = "START_ELEMENT";
- break;
- case XMLStreamConstants.END_ELEMENT:
- outStr = "END_ELEMENT";
- break;
- case XMLStreamConstants.CHARACTERS:
- outStr = "char";
- break;
- default:outStr = event+"";
-
- }
- return outStr;
+ protected void tearDown() throws Exception {
+ tempFile.delete();
}
-
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java Tue Nov 30 06:11:32 2004
@@ -5,10 +5,14 @@
import org.apache.axis.om.impl.factory.OMLinkedListImplFactory;
import org.apache.axis.om.impl.serialize.SimpleOMSerializer;
import org.apache.axis.om.soap.SOAPMessage;
+import org.apache.axis.AbstractTestCase;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.FileReader;
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -28,32 +32,41 @@
* @author Axis team
* Date: Nov 18, 2004
* Time: 3:54:54 PM
- *
+ *
*/
-public class OmStAXBuilderTest extends TestCase{
+public class OmStAXBuilderTest extends AbstractTestCase {
+
+
- private static final String FILE_NAME = "src/test-resources/soap/soapmessage1.xml";
- private OMFactory factory =null;
+ private OMFactory factory = null;
private OMStAXBuilder builder;
private SimpleOMSerializer serilizer;
+ private File tempFile;
+
+ public OmStAXBuilderTest(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
factory = new OMLinkedListImplFactory();
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(FILE_NAME));
- builder = new OMStAXBuilder(factory,reader);
+ XMLStreamReader reader = XMLInputFactory.newInstance().
+ createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
+ builder = new OMStAXBuilder(factory, reader);
serilizer = new SimpleOMSerializer();
- }
+ tempFile = File.createTempFile("temp", "xml");
- public void testStaxBuilder(){
+ }
+ public void testStaxBuilder() throws FileNotFoundException{
SOAPMessage message = builder.getSOAPMessage();
assertNotNull(message);
- serilizer.serialize(message.getEnvelope(),System.out);
-
-
+ serilizer.serialize(message.getEnvelope(), new FileOutputStream(tempFile));
}
-
+ protected void tearDown() throws Exception {
+ tempFile.delete();
+ }
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/MessagesTest.java Tue Nov 30 06:11:32 2004
@@ -20,34 +20,39 @@
package org.apache.axis.om.soap;
import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMTestCase;
import org.apache.axis.om.OMTestUtils;
+import org.apache.axis.AbstractTestCase;
-public class MessagesTest extends OMTestCase {
+public class MessagesTest extends AbstractTestCase {
+
SOAPMessage soapMessage;
SOAPEnvelope soapEnvelope;
+ public MessagesTest(String testName) {
+ super(testName);
+ }
+
public void testMessageWithLotOfWhiteSpaces() throws OMException, Exception {
- soapMessage = OMTestUtils.getOMBuilder("src/test-resources/soap/whitespacedMessage.xml").getSOAPMessage();
+ soapMessage = OMTestUtils.getOMBuilder(getTestResourceFile("soap/whitespacedMessage.xml")).getSOAPMessage();
soapEnvelope = soapMessage.getEnvelope();
OMTestUtils.walkThrough(soapEnvelope);
}
public void testMinimalMessage() throws OMException, Exception {
- soapMessage = OMTestUtils.getOMBuilder("src/test-resources/soap/minimalMessage.xml").getSOAPMessage();
+ soapMessage = OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")).getSOAPMessage();
soapEnvelope = soapMessage.getEnvelope();
OMTestUtils.walkThrough(soapEnvelope);
}
public void testReallyBigMessage() throws OMException, Exception {
- soapMessage = OMTestUtils.getOMBuilder("src/test-resources/soap/reallyReallyBigMessage.xml").getSOAPMessage();
+ soapMessage = OMTestUtils.getOMBuilder(getTestResourceFile("soap/reallyReallyBigMessage.xml")).getSOAPMessage();
soapEnvelope = soapMessage.getEnvelope();
OMTestUtils.walkThrough(soapEnvelope);
}
public void testEmptyBodiedMessage() throws OMException, Exception {
- soapMessage = OMTestUtils.getOMBuilder("src/test-resources/soap/emtyBodymessage.xml").getSOAPMessage();
+ soapMessage = OMTestUtils.getOMBuilder(getTestResourceFile("soap/emptyBodymessage.xml")).getSOAPMessage();
soapEnvelope = soapMessage.getEnvelope();
OMTestUtils.walkThrough(soapEnvelope);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPBodyTest.java Tue Nov 30 06:11:32 2004
@@ -22,14 +22,17 @@
import org.apache.axis.om.impl.OMNamespaceImpl;
import org.apache.axis.om.soap.SOAPBody;
import org.apache.axis.om.soap.SOAPBodyElement;
-import org.apache.axis.om.OMTestCase;
+import org.apache.axis.om.OMTestUtils;
+import org.apache.axis.AbstractTestCase;
-public class SOAPBodyTest extends OMTestCase {
+public class SOAPBodyTest extends AbstractTestCase{
SOAPBody soapBody;
- public static void main(String[] args) {
+
+ public SOAPBodyTest(String testName) {
+ super(testName);
}
/*
@@ -37,6 +40,8 @@
*/
protected void setUp() throws Exception {
super.setUp();
+ SOAPEnvelope soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/soapmessage1.xml")).
+ getSOAPMessage().getEnvelope();
soapBody = soapEnvelope.getBody();
}
@@ -56,8 +61,12 @@
}
public void testAddBodyElement() {
- String newElementName = "MyBodyElement";
+
+ assertNotNull(soapBody);
+
+ String newElementName = "MyBodyElement";
SOAPBodyElement soapBodyElement = soapBody.addBodyElement(newElementName, new OMNamespaceImpl("http://opensource.lk", "lsf"));
+
assertTrue("Body Element added has different parent than it should have", soapBodyElement.getParent() == soapBody);
assertTrue("Body Element added has different localname than it was given", soapBodyElement.getLocalName().equalsIgnoreCase(newElementName));
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeAnotherTest.java Tue Nov 30 06:11:32 2004
@@ -19,15 +19,20 @@
*/
package org.apache.axis.om.soap;
-import org.apache.axis.om.OMTestCase;
import org.apache.axis.om.OMTestUtils;
+import org.apache.axis.AbstractTestCase;
-public class SOAPEnvelopeAnotherTest extends OMTestCase {
+public class SOAPEnvelopeAnotherTest extends AbstractTestCase {
SOAPMessage soapMessage;
SOAPEnvelope soapEnvelope;
+
+ public SOAPEnvelopeAnotherTest(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
- soapMessage = OMTestUtils.getOMBuilder("src/test-resources/soap/sample1.xml").getSOAPMessage();
+ soapMessage = OMTestUtils.getOMBuilder(getTestResourceFile("soap/sample1.xml")).getSOAPMessage();
soapEnvelope = soapMessage.getEnvelope();
}
public void testGetHeader() {
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPEnvelopeTest.java Tue Nov 30 06:11:32 2004
@@ -19,15 +19,27 @@
*/
package org.apache.axis.om.soap;
-import org.apache.axis.om.OMTestCase;
+import org.apache.axis.AbstractTestCase;
+import org.apache.axis.om.OMTestUtils;
-public class SOAPEnvelopeTest extends OMTestCase {
+public class SOAPEnvelopeTest extends AbstractTestCase {
+
+ private SOAPEnvelope soapEnvelope;
+
+ public SOAPEnvelopeTest(String testName) {
+ super(testName);
+ }
+
protected void setUp() throws Exception {
super.setUp();
+ soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/soapmessage.xml")).
+ getSOAPMessage().getEnvelope();
+
}
public void testGetHeader() {
SOAPHeader header = soapEnvelope.getHeader();
+
assertTrue("Header information retrieved not correct", ( header != null && header.getLocalName().equalsIgnoreCase("Header")) );
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderElementTest.java Tue Nov 30 06:11:32 2004
@@ -21,28 +21,35 @@
import org.apache.axis.om.soap.SOAPHeader;
import org.apache.axis.om.soap.SOAPHeaderElement;
-import org.apache.axis.om.OMTestCase;
+import org.apache.axis.om.OMTestUtils;
+import org.apache.axis.AbstractTestCase;
import java.util.Iterator;
-public class SOAPHeaderElementTest extends OMTestCase {
+public class SOAPHeaderElementTest extends AbstractTestCase{
SOAPHeader soapHeader;
SOAPHeaderElement soapHeaderElement;
+ public SOAPHeaderElementTest(String testName) {
+ super(testName);
+ }
protected void setUp() throws Exception {
super.setUp();
+ SOAPEnvelope soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/soapmessage.xml")).
+ getSOAPMessage().getEnvelope();
+
soapHeader = soapEnvelope.getHeader();
Iterator headerElementIter = soapHeader.examineAllHeaderElements();
+
if (headerElementIter.hasNext()) {
soapHeaderElement = (SOAPHeaderElement) headerElementIter.next();
}
- }
- public static void main(String[] args) {
}
+
public void testSetAndGetActor() {
String newActorURI = "http://newActor.org";
Modified: webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java?view=diff&rev=107006&p1=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java&r1=107005&p2=webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java&r2=107006
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype1/src/test/org/apache/axis/om/soap/SOAPHeaderTest.java Tue Nov 30 06:11:32 2004
@@ -22,15 +22,18 @@
import org.apache.axis.om.impl.OMNamespaceImpl;
import org.apache.axis.om.soap.SOAPHeader;
import org.apache.axis.om.soap.SOAPHeaderElement;
-import org.apache.axis.om.OMTestCase;
+import org.apache.axis.om.OMTestUtils;
+import org.apache.axis.AbstractTestCase;
import java.util.Iterator;
-public class SOAPHeaderTest extends OMTestCase {
+public class SOAPHeaderTest extends AbstractTestCase {
SOAPHeader soapHeader;
- public static void main(String[] args) {
+
+ public SOAPHeaderTest(String testName) {
+ super(testName);
}
/*
@@ -38,6 +41,9 @@
*/
protected void setUp() throws Exception {
super.setUp();
+ SOAPEnvelope soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/soapmessage.xml")).
+ getSOAPMessage().getEnvelope();
+
soapHeader = soapEnvelope.getHeader();
}