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 di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [130/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/a...
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/factory/OMLinkedListImplFactoryTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/factory/OMLinkedListImplFactoryTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/factory/OMLinkedListImplFactoryTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/factory/OMLinkedListImplFactoryTest.java Thu Sep 15 11:52:11 2005
@@ -1,222 +1,222 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.om.factory;
-
-import org.apache.axis2.om.*;
-import org.apache.axis2.soap.*;
-import org.apache.axis2.soap.impl.llom.SOAPConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * User: Eran Chinthaka (eran.chinthaka@gmail.com)
- * Date: Feb 8, 2005
- * Time: 11:06:09 AM
- * All Rights Reserved.
- */
-public class OMLinkedListImplFactoryTest extends AbstractTestCase {
-
- private Log log = LogFactory.getLog(getClass());
-
- public OMLinkedListImplFactoryTest(String testName) {
- super(testName);
- }
-
- SOAPFactory omFactory;
- OMNamespace namespace;
- String nsUri = "http://www.apache.org/~chinthaka";
- String nsPrefix = "myhome";
-
- protected void setUp() throws Exception {
- super.setUp();
- omFactory = OMAbstractFactory.getSOAP11Factory();
- namespace = omFactory.createOMNamespace(nsUri, nsPrefix);
- }
-
- public void testCreateOMElementWithNoBuilder() {
- OMElement omElement = omFactory.createOMElement("chinthaka",
- namespace);
- assertTrue(
- "Programatically created OMElement should have done = true ",
- omElement.isComplete());
-
- }
-
- public void testCreateOMElement() {
- try {
- OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/whitespacedMessage.xml"));
- OMElement documentElement = omBuilder.getDocumentElement();
- OMElement child = omFactory.createOMElement("child",
- namespace,
- documentElement,
- omBuilder);
- assertTrue(
- "OMElement with a builder should start with done = false ",
- !child.isComplete());
- assertTrue("This OMElement must have a builder ",
- child.getBuilder() instanceof OMXMLParserWrapper);
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
- public void testCreateOMNamespace() {
- assertTrue("OMNamespace uri not correct",
- nsUri.equals(namespace.getName())); // here equalsIgnoreCase should not be used as case does matter
- assertTrue("OMNamespace prefix not correct",
- nsPrefix.equals(namespace.getPrefix())); // here equalsIgnoreCase should not be used as case does matter
- }
-
- public void testCreateText() {
- OMElement omElement = omFactory.createOMElement("chinthaka",
- namespace);
- String text = "sampleText";
- OMText omText = omFactory.createText(omElement, text);
- assertTrue("Programatically created OMText should have done = true ",
- omText.isComplete());
- assertTrue(
- "Programatically created OMText should have correct text value ",
- text.equals(omText.getText()));
-
- }
-
- public void testCreateSOAPBody() {
- try {
- OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/minimalMessage.xml"));
- SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
- SOAPBody soapBodyOne = omFactory.createSOAPBody(soapEnvelope);
- assertTrue(
- "Programatically created SOAPBody should have done = true ",
- soapBodyOne.isComplete());
- soapBodyOne.detach();
- SOAPBody soapBodyTwo = omFactory.createSOAPBody(soapEnvelope,
- omBuilder);
- assertTrue(
- "SOAPBody with a builder should start with done = false ",
- !soapBodyTwo.isComplete());
- assertTrue("This SOAPBody must have a builder ",
- soapBodyTwo.getBuilder() instanceof OMXMLParserWrapper);
-
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
- public void testCreateSOAPEnvelope() {
- try {
- OMNamespace soapNamespace = omFactory.createOMNamespace(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
- SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX);
- SOAPEnvelope soapEnvelopeTwo = omFactory.createSOAPEnvelope();
- assertTrue(
- "Programatically created SOAPEnvelope should have done = true ",
- soapEnvelopeTwo.isComplete());
- SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(
- OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/minimalMessage.xml")));
- assertTrue(
- "SOAPEnvelope with a builder should start with done = false ",
- !soapEnvelope.isComplete());
- assertTrue("This SOAPEnvelope must have a builder ",
- soapEnvelope.getBuilder() instanceof OMXMLParserWrapper);
-
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
- public void testCreateSOAPHeader() {
- try {
- OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/minimalMessage.xml"));
- SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
- SOAPHeader soapHeader = omFactory.createSOAPHeader(soapEnvelope);
- assertTrue(
- "Programatically created SOAPHeader should have done = true ",
- soapHeader.isComplete());
- soapHeader.detach();
- SOAPHeader soapHeaderTwo = omFactory.createSOAPHeader(soapEnvelope,
- omBuilder);
- assertTrue(
- "SOAPHeader with a builder should start with done = false ",
- !soapHeaderTwo.isComplete());
- assertTrue("This SOAPHeader must have a builder ",
- soapHeaderTwo.getBuilder() instanceof OMXMLParserWrapper);
-
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
- public void testCreateSOAPHeaderBlock() {
- try {
- OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/soapmessage.xml"));
- SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(
- "soapHeaderBlockOne", namespace, soapHeader);
- assertTrue(
- "Programatically created SOAPHeaderBlock should have done = true ",
- soapHeaderBlock.isComplete());
- SOAPHeaderBlock soapHeaderBlockTwo = omFactory.createSOAPHeaderBlock(
- "soapHeaderBlockOne", namespace, soapHeader, omBuilder);
- assertTrue(
- "SOAPHeaderBlock with a builder should start with done = false ",
- !soapHeaderBlockTwo.isComplete());
- assertTrue("This SOAPHeaderBlock must have a builder ",
- soapHeaderBlockTwo.getBuilder() instanceof OMXMLParserWrapper);
-
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
- public void testCreateSOAPFault() {
- try {
- OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
- getTestResourceFile("soap/soapmessage.xml"));
- SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
- SOAPBody soapBody = soapEnvelope.getBody();
- SOAPFault soapFault = omFactory.createSOAPFault(soapBody,
- new Exception(" this is just a test "));
- assertTrue(
- "Programatically created SOAPFault should have done = true ",
- soapFault.isComplete());
- soapFault.detach();
- SOAPFault soapFaultTwo = omFactory.createSOAPFault(soapBody,
- omBuilder);
- assertTrue(
- "SOAPFault with a builder should start with done = false ",
- !soapFaultTwo.isComplete());
- assertTrue("This SOAPFault must have a builder ",
- soapFaultTwo.getBuilder() instanceof OMXMLParserWrapper);
-
-
- } catch (Exception e) {
- log.info(e.getMessage());
- }
- }
-
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.om.factory;
+
+import org.apache.axis2.om.*;
+import org.apache.axis2.soap.*;
+import org.apache.axis2.soap.impl.llom.SOAPConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * User: Eran Chinthaka (eran.chinthaka@gmail.com)
+ * Date: Feb 8, 2005
+ * Time: 11:06:09 AM
+ * All Rights Reserved.
+ */
+public class OMLinkedListImplFactoryTest extends AbstractTestCase {
+
+ private Log log = LogFactory.getLog(getClass());
+
+ public OMLinkedListImplFactoryTest(String testName) {
+ super(testName);
+ }
+
+ SOAPFactory omFactory;
+ OMNamespace namespace;
+ String nsUri = "http://www.apache.org/~chinthaka";
+ String nsPrefix = "myhome";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ omFactory = OMAbstractFactory.getSOAP11Factory();
+ namespace = omFactory.createOMNamespace(nsUri, nsPrefix);
+ }
+
+ public void testCreateOMElementWithNoBuilder() {
+ OMElement omElement = omFactory.createOMElement("chinthaka",
+ namespace);
+ assertTrue(
+ "Programatically created OMElement should have done = true ",
+ omElement.isComplete());
+
+ }
+
+ public void testCreateOMElement() {
+ try {
+ OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/whitespacedMessage.xml"));
+ OMElement documentElement = omBuilder.getDocumentElement();
+ OMElement child = omFactory.createOMElement("child",
+ namespace,
+ documentElement,
+ omBuilder);
+ assertTrue(
+ "OMElement with a builder should start with done = false ",
+ !child.isComplete());
+ assertTrue("This OMElement must have a builder ",
+ child.getBuilder() instanceof OMXMLParserWrapper);
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+ public void testCreateOMNamespace() {
+ assertTrue("OMNamespace uri not correct",
+ nsUri.equals(namespace.getName())); // here equalsIgnoreCase should not be used as case does matter
+ assertTrue("OMNamespace prefix not correct",
+ nsPrefix.equals(namespace.getPrefix())); // here equalsIgnoreCase should not be used as case does matter
+ }
+
+ public void testCreateText() {
+ OMElement omElement = omFactory.createOMElement("chinthaka",
+ namespace);
+ String text = "sampleText";
+ OMText omText = omFactory.createText(omElement, text);
+ assertTrue("Programatically created OMText should have done = true ",
+ omText.isComplete());
+ assertTrue(
+ "Programatically created OMText should have correct text value ",
+ text.equals(omText.getText()));
+
+ }
+
+ public void testCreateSOAPBody() {
+ try {
+ OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/minimalMessage.xml"));
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
+ SOAPBody soapBodyOne = omFactory.createSOAPBody(soapEnvelope);
+ assertTrue(
+ "Programatically created SOAPBody should have done = true ",
+ soapBodyOne.isComplete());
+ soapBodyOne.detach();
+ SOAPBody soapBodyTwo = omFactory.createSOAPBody(soapEnvelope,
+ omBuilder);
+ assertTrue(
+ "SOAPBody with a builder should start with done = false ",
+ !soapBodyTwo.isComplete());
+ assertTrue("This SOAPBody must have a builder ",
+ soapBodyTwo.getBuilder() instanceof OMXMLParserWrapper);
+
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+ public void testCreateSOAPEnvelope() {
+ try {
+ OMNamespace soapNamespace = omFactory.createOMNamespace(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+ SOAPEnvelope soapEnvelopeTwo = omFactory.createSOAPEnvelope();
+ assertTrue(
+ "Programatically created SOAPEnvelope should have done = true ",
+ soapEnvelopeTwo.isComplete());
+ SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(
+ OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/minimalMessage.xml")));
+ assertTrue(
+ "SOAPEnvelope with a builder should start with done = false ",
+ !soapEnvelope.isComplete());
+ assertTrue("This SOAPEnvelope must have a builder ",
+ soapEnvelope.getBuilder() instanceof OMXMLParserWrapper);
+
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+ public void testCreateSOAPHeader() {
+ try {
+ OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/minimalMessage.xml"));
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
+ SOAPHeader soapHeader = omFactory.createSOAPHeader(soapEnvelope);
+ assertTrue(
+ "Programatically created SOAPHeader should have done = true ",
+ soapHeader.isComplete());
+ soapHeader.detach();
+ SOAPHeader soapHeaderTwo = omFactory.createSOAPHeader(soapEnvelope,
+ omBuilder);
+ assertTrue(
+ "SOAPHeader with a builder should start with done = false ",
+ !soapHeaderTwo.isComplete());
+ assertTrue("This SOAPHeader must have a builder ",
+ soapHeaderTwo.getBuilder() instanceof OMXMLParserWrapper);
+
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+ public void testCreateSOAPHeaderBlock() {
+ try {
+ OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/soapmessage.xml"));
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(
+ "soapHeaderBlockOne", namespace, soapHeader);
+ assertTrue(
+ "Programatically created SOAPHeaderBlock should have done = true ",
+ soapHeaderBlock.isComplete());
+ SOAPHeaderBlock soapHeaderBlockTwo = omFactory.createSOAPHeaderBlock(
+ "soapHeaderBlockOne", namespace, soapHeader, omBuilder);
+ assertTrue(
+ "SOAPHeaderBlock with a builder should start with done = false ",
+ !soapHeaderBlockTwo.isComplete());
+ assertTrue("This SOAPHeaderBlock must have a builder ",
+ soapHeaderBlockTwo.getBuilder() instanceof OMXMLParserWrapper);
+
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+ public void testCreateSOAPFault() {
+ try {
+ OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
+ getTestResourceFile("soap/soapmessage.xml"));
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ SOAPFault soapFault = omFactory.createSOAPFault(soapBody,
+ new Exception(" this is just a test "));
+ assertTrue(
+ "Programatically created SOAPFault should have done = true ",
+ soapFault.isComplete());
+ soapFault.detach();
+ SOAPFault soapFaultTwo = omFactory.createSOAPFault(soapBody,
+ omBuilder);
+ assertTrue(
+ "SOAPFault with a builder should start with done = false ",
+ !soapFaultTwo.isComplete());
+ assertTrue("This SOAPFault must have a builder ",
+ soapFaultTwo.getBuilder() instanceof OMXMLParserWrapper);
+
+
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+
+
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/factory/OMLinkedListImplFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/builder/StAXOMBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/builder/StAXOMBuilderTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/builder/StAXOMBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/builder/StAXOMBuilderTest.java Thu Sep 15 11:52:11 2005
@@ -1,66 +1,66 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.om.impl.builder;
-
-import org.apache.axis2.om.*;
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
-
-import javax.xml.stream.XMLInputFactory;
-import java.io.FileReader;
-import java.util.Iterator;
-
-public class StAXOMBuilderTest extends AbstractTestCase {
- StAXOMBuilder stAXOMBuilder;
- FileReader testFile;
- private OMElement rootElement;
-
- /**
- * Constructor.
- */
- public StAXOMBuilderTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- testFile = new FileReader(getTestResourceFile("non_soap.xml"));
- stAXOMBuilder =
- OMXMLBuilderFactory.createStAXOMBuilder(
- OMAbstractFactory.getSOAP11Factory(),
- XMLInputFactory.newInstance().createXMLStreamReader(
- testFile));
- }
-
- 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.getFirstChild();
- while (omnode instanceof OMText) {
- omnode = omnode.getNextSibling();
- }
- Iterator children = ((OMElement) omnode).getChildren();
- int childrenCount = 0;
- while (children.hasNext()) {
- OMNode node = (OMNode) children.next();
- if (node instanceof OMElement)
- childrenCount++;
- }
- assertTrue(childrenCount == 5);
- }
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.om.impl.builder;
+
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import java.io.FileReader;
+import java.util.Iterator;
+
+public class StAXOMBuilderTest extends AbstractTestCase {
+ StAXOMBuilder stAXOMBuilder;
+ FileReader testFile;
+ private OMElement rootElement;
+
+ /**
+ * Constructor.
+ */
+ public StAXOMBuilderTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ testFile = new FileReader(getTestResourceFile("non_soap.xml"));
+ stAXOMBuilder =
+ OMXMLBuilderFactory.createStAXOMBuilder(
+ OMAbstractFactory.getSOAP11Factory(),
+ XMLInputFactory.newInstance().createXMLStreamReader(
+ testFile));
+ }
+
+ 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.getFirstChild();
+ while (omnode instanceof OMText) {
+ omnode = omnode.getNextSibling();
+ }
+ Iterator children = ((OMElement) omnode).getChildren();
+ int childrenCount = 0;
+ while (children.hasNext()) {
+ OMNode node = (OMNode) children.next();
+ if (node instanceof OMElement)
+ childrenCount++;
+ }
+ assertTrue(childrenCount == 5);
+ }
}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/builder/StAXOMBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java Thu Sep 15 11:52:11 2005
@@ -1,228 +1,228 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.om.impl.streamwrapper;
-
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axis2.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileReader;
-
-public class OMStaxStreamingWrapperTest extends AbstractTestCase {
- private SOAPEnvelope envelope = null;
- private File tempFile;
- private XMLStreamReader parser;
-
- public OMStaxStreamingWrapperTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
- createXMLStreamReader(
- new FileReader(
- getTestResourceFile("soap/soapmessage1.xml")));
- OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
- OMAbstractFactory.getSOAP11Factory(), xmlStreamReader);
- envelope = (SOAPEnvelope) builder.getDocumentElement();
- tempFile = File.createTempFile("temp", "xml");
-
- }
-
-
- // 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.serializeWithCache(writer,true);
- // parser = envelope.getXMLStreamReader(false);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // }
- //
- // }
-
- public void testWrapperHalfOM() throws Exception {
- assertNotNull(envelope);
- parser = envelope.getXMLStreamReaderWithoutCaching();
- while (parser.hasNext()) {
- int event = parser.next();
- assertTrue(event > 0);
- }
- }
-
- // public void testWrapperHalfOMWithCacheOff() throws Exception {
- // assertNotNull(envelope);
- // parser = envelope.getXMLStreamReader(true);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // }
- // }
- //
- // public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException {
- // assertNotNull(envelope);
- // parser = envelope.getXMLStreamReader(true);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // if (event == XMLStreamConstants.START_ELEMENT) {
- // checkStartElement(parser);
- // } else if (event == XMLStreamConstants.CHARACTERS) {
- // checkCharacters(parser);
- // }
- // }
- //
- //
- // }
- //
- // public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
- // assertNotNull(envelope);
- // parser = envelope.getXMLStreamReader(false);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // if (event == XMLStreamConstants.START_ELEMENT) {
- // checkStartElement(parser);
- // } else if (event == XMLStreamConstants.CHARACTERS) {
- // checkCharacters(parser);
- // }
- // }
- //
- //
- // }
- //
- // private void checkCharacters(XMLStreamReader wrapper) {
- // assertFalse(wrapper.isStartElement());
- // assertFalse(wrapper.isEndElement());
- // assertFalse(wrapper.isWhiteSpace());
- // assertFalse(wrapper.hasName());
- // assertTrue(wrapper.isCharacters());
- //
- // assertNotNull(wrapper.getText());
- // assertTrue(wrapper.getTextLength() > 0);
- // }
- //
- // private void checkStartElement(XMLStreamReader wrapper) {
- // assertTrue(wrapper.isStartElement());
- // assertTrue(wrapper.hasName());
- // assertFalse(wrapper.isEndElement());
- // assertFalse(wrapper.isCharacters());
- // assertFalse(wrapper.isWhiteSpace());
- //
- // //at the start element event these need to be supplied
- // assertNotNull(wrapper.getLocalName());
- // assertNotNull(wrapper.getName());
- // assertNotNull(wrapper.getNamespaceURI());
- // //prefix may be null
- // wrapper.getPrefix();
- //
- // //todo add the other checks here
- // int attribCount = wrapper.getAttributeCount();
- // for (int i = 0; i < attribCount; i++) {
- // assertNotNull(wrapper.getAttributeLocalName(i));
- // assertNotNull(wrapper.getAttributeValue(i));
- // assertNotNull(wrapper.getAttributeName(i));
- // wrapper.getAttributePrefix(i);
- // wrapper.getAttributeNamespace(i);
- // //todo add the other checks here
- // }
- //
- //
- // }
- //
- // public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException {
- // assertNotNull(envelope);
- // parser = envelope.getXMLStreamReader(true);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // if (event == XMLStreamConstants.START_ELEMENT) {
- // checkStartElement(parser);
- // } else if (event == XMLStreamConstants.CHARACTERS) {
- // checkCharacters(parser);
- // }
- // }
- //
- //
- // }
- //
- // public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
- // assertNotNull(envelope);
- // parser = envelope.getXMLStreamReader(false);
- // while (parser.hasNext()) {
- // int event = parser.next();
- // assertTrue(event > 0);
- // if (event == XMLStreamConstants.START_ELEMENT) {
- // checkStartElement(parser);
- // } else if (event == XMLStreamConstants.CHARACTERS) {
- // checkCharacters(parser);
- // }
- // }
- //
- //
- // }
- //
- // private void checkCharacters(XMLStreamReader wrapper) {
- // assertFalse(wrapper.isStartElement());
- // assertFalse(wrapper.isEndElement());
- // assertFalse(wrapper.isWhiteSpace());
- // assertFalse(wrapper.hasName());
- // assertTrue(wrapper.isCharacters());
- //
- // assertNotNull(wrapper.getText());
- // assertTrue(wrapper.getTextLength() > 0);
- // }
- //
- // private void checkStartElement(XMLStreamReader wrapper) {
- // assertTrue(wrapper.isStartElement());
- // assertTrue(wrapper.hasName());
- // assertFalse(wrapper.isEndElement());
- // assertFalse(wrapper.isCharacters());
- // assertFalse(wrapper.isWhiteSpace());
- //
- // //at the start element event these need to be supplied
- // assertNotNull(wrapper.getLocalName());
- // assertNotNull(wrapper.getName());
- // assertNotNull(wrapper.getNamespaceURI());
- // //prefix may be null
- // wrapper.getPrefix();
- //
- // //todo add the other checks here
- // int attribCount = wrapper.getAttributeCount();
- // for (int i = 0; i < attribCount; i++) {
- // assertNotNull(wrapper.getAttributeLocalName(i));
- // assertNotNull(wrapper.getAttributeValue(i));
- // assertNotNull(wrapper.getAttributeName(i));
- // wrapper.getAttributePrefix(i);
- // wrapper.getAttributeNamespace(i);
- // //todo add the other checks here
- // }
- //
- //
- // }
-
-
- protected void tearDown() throws Exception {
- tempFile.delete();
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.om.impl.streamwrapper;
+
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+
+public class OMStaxStreamingWrapperTest extends AbstractTestCase {
+ private SOAPEnvelope envelope = null;
+ private File tempFile;
+ private XMLStreamReader parser;
+
+ public OMStaxStreamingWrapperTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
+ createXMLStreamReader(
+ new FileReader(
+ getTestResourceFile("soap/soapmessage1.xml")));
+ OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+ OMAbstractFactory.getSOAP11Factory(), xmlStreamReader);
+ envelope = (SOAPEnvelope) builder.getDocumentElement();
+ tempFile = File.createTempFile("temp", "xml");
+
+ }
+
+
+ // 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.serializeWithCache(writer,true);
+ // parser = envelope.getXMLStreamReader(false);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // }
+ //
+ // }
+
+ public void testWrapperHalfOM() throws Exception {
+ assertNotNull(envelope);
+ parser = envelope.getXMLStreamReaderWithoutCaching();
+ while (parser.hasNext()) {
+ int event = parser.next();
+ assertTrue(event > 0);
+ }
+ }
+
+ // public void testWrapperHalfOMWithCacheOff() throws Exception {
+ // assertNotNull(envelope);
+ // parser = envelope.getXMLStreamReader(true);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // }
+ // }
+ //
+ // public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException {
+ // assertNotNull(envelope);
+ // parser = envelope.getXMLStreamReader(true);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // if (event == XMLStreamConstants.START_ELEMENT) {
+ // checkStartElement(parser);
+ // } else if (event == XMLStreamConstants.CHARACTERS) {
+ // checkCharacters(parser);
+ // }
+ // }
+ //
+ //
+ // }
+ //
+ // public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
+ // assertNotNull(envelope);
+ // parser = envelope.getXMLStreamReader(false);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // if (event == XMLStreamConstants.START_ELEMENT) {
+ // checkStartElement(parser);
+ // } else if (event == XMLStreamConstants.CHARACTERS) {
+ // checkCharacters(parser);
+ // }
+ // }
+ //
+ //
+ // }
+ //
+ // private void checkCharacters(XMLStreamReader wrapper) {
+ // assertFalse(wrapper.isStartElement());
+ // assertFalse(wrapper.isEndElement());
+ // assertFalse(wrapper.isWhiteSpace());
+ // assertFalse(wrapper.hasName());
+ // assertTrue(wrapper.isCharacters());
+ //
+ // assertNotNull(wrapper.getText());
+ // assertTrue(wrapper.getTextLength() > 0);
+ // }
+ //
+ // private void checkStartElement(XMLStreamReader wrapper) {
+ // assertTrue(wrapper.isStartElement());
+ // assertTrue(wrapper.hasName());
+ // assertFalse(wrapper.isEndElement());
+ // assertFalse(wrapper.isCharacters());
+ // assertFalse(wrapper.isWhiteSpace());
+ //
+ // //at the start element event these need to be supplied
+ // assertNotNull(wrapper.getLocalName());
+ // assertNotNull(wrapper.getName());
+ // assertNotNull(wrapper.getNamespaceURI());
+ // //prefix may be null
+ // wrapper.getPrefix();
+ //
+ // //todo add the other checks here
+ // int attribCount = wrapper.getAttributeCount();
+ // for (int i = 0; i < attribCount; i++) {
+ // assertNotNull(wrapper.getAttributeLocalName(i));
+ // assertNotNull(wrapper.getAttributeValue(i));
+ // assertNotNull(wrapper.getAttributeName(i));
+ // wrapper.getAttributePrefix(i);
+ // wrapper.getAttributeNamespace(i);
+ // //todo add the other checks here
+ // }
+ //
+ //
+ // }
+ //
+ // public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException {
+ // assertNotNull(envelope);
+ // parser = envelope.getXMLStreamReader(true);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // if (event == XMLStreamConstants.START_ELEMENT) {
+ // checkStartElement(parser);
+ // } else if (event == XMLStreamConstants.CHARACTERS) {
+ // checkCharacters(parser);
+ // }
+ // }
+ //
+ //
+ // }
+ //
+ // public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
+ // assertNotNull(envelope);
+ // parser = envelope.getXMLStreamReader(false);
+ // while (parser.hasNext()) {
+ // int event = parser.next();
+ // assertTrue(event > 0);
+ // if (event == XMLStreamConstants.START_ELEMENT) {
+ // checkStartElement(parser);
+ // } else if (event == XMLStreamConstants.CHARACTERS) {
+ // checkCharacters(parser);
+ // }
+ // }
+ //
+ //
+ // }
+ //
+ // private void checkCharacters(XMLStreamReader wrapper) {
+ // assertFalse(wrapper.isStartElement());
+ // assertFalse(wrapper.isEndElement());
+ // assertFalse(wrapper.isWhiteSpace());
+ // assertFalse(wrapper.hasName());
+ // assertTrue(wrapper.isCharacters());
+ //
+ // assertNotNull(wrapper.getText());
+ // assertTrue(wrapper.getTextLength() > 0);
+ // }
+ //
+ // private void checkStartElement(XMLStreamReader wrapper) {
+ // assertTrue(wrapper.isStartElement());
+ // assertTrue(wrapper.hasName());
+ // assertFalse(wrapper.isEndElement());
+ // assertFalse(wrapper.isCharacters());
+ // assertFalse(wrapper.isWhiteSpace());
+ //
+ // //at the start element event these need to be supplied
+ // assertNotNull(wrapper.getLocalName());
+ // assertNotNull(wrapper.getName());
+ // assertNotNull(wrapper.getNamespaceURI());
+ // //prefix may be null
+ // wrapper.getPrefix();
+ //
+ // //todo add the other checks here
+ // int attribCount = wrapper.getAttributeCount();
+ // for (int i = 0; i < attribCount; i++) {
+ // assertNotNull(wrapper.getAttributeLocalName(i));
+ // assertNotNull(wrapper.getAttributeValue(i));
+ // assertNotNull(wrapper.getAttributeName(i));
+ // wrapper.getAttributePrefix(i);
+ // wrapper.getAttributeNamespace(i);
+ // //todo add the other checks here
+ // }
+ //
+ //
+ // }
+
+
+ protected void tearDown() throws Exception {
+ tempFile.delete();
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java Thu Sep 15 11:52:11 2005
@@ -1,108 +1,108 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.om.impl.traverse;
-
-import junit.framework.TestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-
-public class OMChildrenWithSpecificAttributeIteratorTest extends TestCase {
-
- public OMChildrenWithSpecificAttributeIteratorTest(String testName) {
- super(testName);
- }
-
- public void testChildrenRetrievalWithDetaching() {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
- OMElement documentElement = getSampleDocumentElement(testNamespace);
-
- Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
- documentElement.getFirstChild(), new QName(testNamespace.getName(), "myAttr",
- testNamespace.getPrefix()), "Axis2", true);
-
- int childCount = getChidrenCount(childrenIter);
- assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);
-
- Iterator children = documentElement.getChildren();
- childCount = getChidrenCount(children);
- assertEquals("Iterator must return only one child, having detached the other children", childCount, 1);
-
- }
-
- public void testChildrenRetrievalWithNoDetaching() {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
- OMElement documentElement = getSampleDocumentElement(testNamespace);
-
- Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
- documentElement.getFirstChild(), new QName(testNamespace.getName(), "myAttr",
- testNamespace.getPrefix()), "Axis2", false);
-
- int childCount = getChidrenCount(childrenIter);
- assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);
-
- Iterator children = documentElement.getChildren();
- childCount = getChidrenCount(children);
- assertEquals("Iterator must return 6 children, having not detached the children", childCount, 6);
-
- }
-
- private OMElement getSampleDocumentElement(OMNamespace testNamespace){
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement documentElement = factory.createOMElement("Employees", testNamespace);
- documentElement.declareNamespace(testNamespace);
-
- OMElement employee;
- OMElement name;
-
- for (int i = 0; i < 5; i++) {
- employee = factory.createOMElement("Employee", testNamespace, documentElement);
- name = factory.createOMElement("Name"+i, testNamespace);
- employee.addAttribute("myAttr", "Axis2", testNamespace);
- name.setText("Apache Developer");
- employee.addChild(name);
- }
-
- //adding one more child with the given attr
- employee = factory.createOMElement("Employee", testNamespace, documentElement);
- name = factory.createOMElement("Name", testNamespace);
- name.addAttribute("myAttr", "Un-Related Value", testNamespace);
- name.setText("Apache Developer");
- employee.addChild(name);
-
- return documentElement;
- }
-
- private int getChidrenCount(Iterator childrenIter) {
- int childCount = 0;
- while (childrenIter.hasNext()) {
- OMElement omElement = (OMElement) childrenIter.next();
- childCount++;
- }
-
- return childCount;
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.om.impl.traverse;
+
+import junit.framework.TestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class OMChildrenWithSpecificAttributeIteratorTest extends TestCase {
+
+ public OMChildrenWithSpecificAttributeIteratorTest(String testName) {
+ super(testName);
+ }
+
+ public void testChildrenRetrievalWithDetaching() {
+
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
+ OMElement documentElement = getSampleDocumentElement(testNamespace);
+
+ Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
+ documentElement.getFirstChild(), new QName(testNamespace.getName(), "myAttr",
+ testNamespace.getPrefix()), "Axis2", true);
+
+ int childCount = getChidrenCount(childrenIter);
+ assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);
+
+ Iterator children = documentElement.getChildren();
+ childCount = getChidrenCount(children);
+ assertEquals("Iterator must return only one child, having detached the other children", childCount, 1);
+
+ }
+
+ public void testChildrenRetrievalWithNoDetaching() {
+
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
+ OMElement documentElement = getSampleDocumentElement(testNamespace);
+
+ Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
+ documentElement.getFirstChild(), new QName(testNamespace.getName(), "myAttr",
+ testNamespace.getPrefix()), "Axis2", false);
+
+ int childCount = getChidrenCount(childrenIter);
+ assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);
+
+ Iterator children = documentElement.getChildren();
+ childCount = getChidrenCount(children);
+ assertEquals("Iterator must return 6 children, having not detached the children", childCount, 6);
+
+ }
+
+ private OMElement getSampleDocumentElement(OMNamespace testNamespace){
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ OMElement documentElement = factory.createOMElement("Employees", testNamespace);
+ documentElement.declareNamespace(testNamespace);
+
+ OMElement employee;
+ OMElement name;
+
+ for (int i = 0; i < 5; i++) {
+ employee = factory.createOMElement("Employee", testNamespace, documentElement);
+ name = factory.createOMElement("Name"+i, testNamespace);
+ employee.addAttribute("myAttr", "Axis2", testNamespace);
+ name.setText("Apache Developer");
+ employee.addChild(name);
+ }
+
+ //adding one more child with the given attr
+ employee = factory.createOMElement("Employee", testNamespace, documentElement);
+ name = factory.createOMElement("Name", testNamespace);
+ name.addAttribute("myAttr", "Un-Related Value", testNamespace);
+ name.setText("Apache Developer");
+ employee.addChild(name);
+
+ return documentElement;
+ }
+
+ private int getChidrenCount(Iterator childrenIter) {
+ int childCount = 0;
+ while (childrenIter.hasNext()) {
+ OMElement omElement = (OMElement) childrenIter.next();
+ childCount++;
+ }
+
+ return childCount;
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparator.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparator.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparator.java Thu Sep 15 11:52:11 2005
@@ -1,153 +1,153 @@
-package org.apache.axis2.om.util;
-
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMNode;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Iterator;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- * <p/>
- */
-public class XMLComparator {
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
- private Log log = LogFactory.getLog(getClass());
-
-
- public boolean compare(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
- if (elementOne == null && elementTwo == null) {
- log.info("Both Elements are null.");
- return true;
- }
- if (elementOne == null && elementTwo != null) {
- throw new XMLComparisonException(
- "Element One is null and Element Two is not null");
- }
- if (elementOne != null && elementTwo == null) {
- throw new XMLComparisonException(
- "Element Two is null and Element One is not null");
- }
-
- log.info(
- "Now Checking " + elementOne.getLocalName() + " and " +
- elementTwo.getLocalName() +
- "=============================");
-
- log.info("Comparing Element Names .......");
- compare("Elements names are not equal. ",
- elementOne.getLocalName(),
- elementTwo.getLocalName());
-
- log.info("Comparing Namespaces .........");
- compare("Element namespaces are not equal",
- elementOne.getNamespace(),
- elementTwo.getNamespace());
-
- log.info("Comparing attributes .....");
- compareAllAttributes(elementOne, elementTwo);
-
- log.info("Comparing texts .....");
- compare("Elements texts are not equal ",
- elementOne.getText(),
- elementTwo.getText());
-
- log.info("Comparing Children ......");
- compareAllChildren(elementOne, elementTwo);
-
-
- return true;
- }
-
- private void compareAllAttributes(OMElement elementOne,
- OMElement elementTwo) throws XMLComparisonException {
- compareAttibutes(elementOne, elementTwo);
- compareAttibutes(elementTwo, elementOne);
- }
-
- private void compareAllChildren(OMElement elementOne,
- OMElement elementTwo) throws XMLComparisonException {
- compareChildren(elementOne, elementTwo);
- compareChildren(elementTwo, elementOne);
- }
-
- private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
- Iterator elementOneChildren = elementOne.getChildren();
- while (elementOneChildren.hasNext()) {
- OMNode omNode = (OMNode) elementOneChildren.next();
- if (omNode instanceof OMElement) {
- OMElement elementOneChild = (OMElement) omNode;
- OMElement elementTwoChild = elementTwo.getFirstChildWithName(
- elementOneChild.getQName());
- if (elementTwoChild == null) {
- throw new XMLComparisonException(
- " There is no " + elementOneChild.getLocalName() +
- " element under " +
- elementTwo.getLocalName());
- }
- compare(elementOneChild, elementTwoChild);
- }
- }
- }
-
-
- private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
- Iterator attributes = elementOne.getAttributes();
- while (attributes.hasNext()) {
- OMAttribute omAttribute = (OMAttribute) attributes.next();
- OMAttribute attr = elementTwo.getFirstAttribute(
- omAttribute.getQName());
- if (attr == null) {
- throw new XMLComparisonException(
- "Attributes are not the same in two elements. Attribute " +
- omAttribute.getLocalName() +
- " != ");
- }
- }
- }
-
- private void compare(String failureNotice, String one, String two) throws XMLComparisonException {
- if (!one.equals(two)) {
- throw new XMLComparisonException(
- failureNotice + one + " != " + two);
- }
- }
-
- private void compare(String failureNotice,
- OMNamespace one,
- OMNamespace two) throws XMLComparisonException {
- if (one == null && two == null) {
- return;
- } else if (one != null && two == null) {
- throw new XMLComparisonException(
- "First Namespace is NOT null. But the second is null");
- } else if (one == null && two != null) {
- throw new XMLComparisonException(
- "First Namespace is null. But the second is NOT null");
- }
-
- if (!one.getName().equals(two.getName())) {
- throw new XMLComparisonException(
- failureNotice + one + " != " + two);
- }
-
- // Do we need to compare prefixes as well
- }
-}
+package org.apache.axis2.om.util;
+
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Iterator;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public class XMLComparator {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ private Log log = LogFactory.getLog(getClass());
+
+
+ public boolean compare(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+ if (elementOne == null && elementTwo == null) {
+ log.info("Both Elements are null.");
+ return true;
+ }
+ if (elementOne == null && elementTwo != null) {
+ throw new XMLComparisonException(
+ "Element One is null and Element Two is not null");
+ }
+ if (elementOne != null && elementTwo == null) {
+ throw new XMLComparisonException(
+ "Element Two is null and Element One is not null");
+ }
+
+ log.info(
+ "Now Checking " + elementOne.getLocalName() + " and " +
+ elementTwo.getLocalName() +
+ "=============================");
+
+ log.info("Comparing Element Names .......");
+ compare("Elements names are not equal. ",
+ elementOne.getLocalName(),
+ elementTwo.getLocalName());
+
+ log.info("Comparing Namespaces .........");
+ compare("Element namespaces are not equal",
+ elementOne.getNamespace(),
+ elementTwo.getNamespace());
+
+ log.info("Comparing attributes .....");
+ compareAllAttributes(elementOne, elementTwo);
+
+ log.info("Comparing texts .....");
+ compare("Elements texts are not equal ",
+ elementOne.getText(),
+ elementTwo.getText());
+
+ log.info("Comparing Children ......");
+ compareAllChildren(elementOne, elementTwo);
+
+
+ return true;
+ }
+
+ private void compareAllAttributes(OMElement elementOne,
+ OMElement elementTwo) throws XMLComparisonException {
+ compareAttibutes(elementOne, elementTwo);
+ compareAttibutes(elementTwo, elementOne);
+ }
+
+ private void compareAllChildren(OMElement elementOne,
+ OMElement elementTwo) throws XMLComparisonException {
+ compareChildren(elementOne, elementTwo);
+ compareChildren(elementTwo, elementOne);
+ }
+
+ private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+ Iterator elementOneChildren = elementOne.getChildren();
+ while (elementOneChildren.hasNext()) {
+ OMNode omNode = (OMNode) elementOneChildren.next();
+ if (omNode instanceof OMElement) {
+ OMElement elementOneChild = (OMElement) omNode;
+ OMElement elementTwoChild = elementTwo.getFirstChildWithName(
+ elementOneChild.getQName());
+ if (elementTwoChild == null) {
+ throw new XMLComparisonException(
+ " There is no " + elementOneChild.getLocalName() +
+ " element under " +
+ elementTwo.getLocalName());
+ }
+ compare(elementOneChild, elementTwoChild);
+ }
+ }
+ }
+
+
+ private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+ Iterator attributes = elementOne.getAttributes();
+ while (attributes.hasNext()) {
+ OMAttribute omAttribute = (OMAttribute) attributes.next();
+ OMAttribute attr = elementTwo.getFirstAttribute(
+ omAttribute.getQName());
+ if (attr == null) {
+ throw new XMLComparisonException(
+ "Attributes are not the same in two elements. Attribute " +
+ omAttribute.getLocalName() +
+ " != ");
+ }
+ }
+ }
+
+ private void compare(String failureNotice, String one, String two) throws XMLComparisonException {
+ if (!one.equals(two)) {
+ throw new XMLComparisonException(
+ failureNotice + one + " != " + two);
+ }
+ }
+
+ private void compare(String failureNotice,
+ OMNamespace one,
+ OMNamespace two) throws XMLComparisonException {
+ if (one == null && two == null) {
+ return;
+ } else if (one != null && two == null) {
+ throw new XMLComparisonException(
+ "First Namespace is NOT null. But the second is null");
+ } else if (one == null && two != null) {
+ throw new XMLComparisonException(
+ "First Namespace is null. But the second is NOT null");
+ }
+
+ if (!one.getName().equals(two.getName())) {
+ throw new XMLComparisonException(
+ failureNotice + one + " != " + two);
+ }
+
+ // Do we need to compare prefixes as well
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparatorTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparatorTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparatorTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparatorTest.java Thu Sep 15 11:52:11 2005
@@ -1,44 +1,44 @@
-package org.apache.axis2.om.util;
-
-import org.apache.axis2.om.OMTestCase;
-import org.apache.axis2.om.impl.llom.util.XMLComparator;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- * <p/>
- */
-public class XMLComparatorTest extends OMTestCase {
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
- public XMLComparatorTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testCompare() throws Exception {
- StAXSOAPModelBuilder omBuilder = getOMBuilder("");
- XMLComparator xmlComparator = new XMLComparator();
- assertTrue(
- xmlComparator.compare(omBuilder.getDocumentElement(),
- omBuilder.getDocumentElement()));
-
-
- }
-}
+package org.apache.axis2.om.util;
+
+import org.apache.axis2.om.OMTestCase;
+import org.apache.axis2.om.impl.llom.util.XMLComparator;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public class XMLComparatorTest extends OMTestCase {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ public XMLComparatorTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testCompare() throws Exception {
+ StAXSOAPModelBuilder omBuilder = getOMBuilder("");
+ XMLComparator xmlComparator = new XMLComparator();
+ assertTrue(
+ xmlComparator.compare(omBuilder.getDocumentElement(),
+ omBuilder.getDocumentElement()));
+
+
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparisonException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparisonException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparisonException.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparisonException.java Thu Sep 15 11:52:11 2005
@@ -1,35 +1,35 @@
-package org.apache.axis2.om.util;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- * <p/>
- */
-public class XMLComparisonException extends Exception {
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
-
- public XMLComparisonException(String message) {
- super(message);
- }
-
- public XMLComparisonException(Throwable cause) {
- super(cause);
- }
-
- public XMLComparisonException(String message, Throwable cause) {
- super(message, cause);
- }
-}
+package org.apache.axis2.om.util;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public class XMLComparisonException extends Exception {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public XMLComparisonException(String message) {
+ super(message);
+ }
+
+ public XMLComparisonException(Throwable cause) {
+ super(cause);
+ }
+
+ public XMLComparisonException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/util/XMLComparisonException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPBodyTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPBodyTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPBodyTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPBodyTest.java Thu Sep 15 11:52:11 2005
@@ -1,155 +1,155 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.soap;
-
-import org.apache.axis2.om.OMException;
-import org.apache.axis2.soap.impl.llom.SOAPConstants;
-
-public class SOAPBodyTest extends SOAPBodyTestCase {
-
- public SOAPBodyTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- //SOAP 1.1 Body Test (Programaticaly created)----------------------------------------------------------------------------------
- public void testSOAP11AddFault1() {
- soap11Body.addFault(new Exception("This an exception for testing"));
- assertTrue(
- "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",
- soap11Body.hasFault());
-
- }
-
- public void testSOAP11addFault2() {
- soap11Body.addFault(soap11Factory.createSOAPFault(soap11Body));
- assertTrue(
- "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",
- soap11Body.hasFault());
-
-
- }
-
- public void testSOAP11HasFault() {
- assertFalse(
- "SOAP 1.1 Body Test:- After creating a soap body it has a fault",
- soap11Body.hasFault());
- soap11Body.addFault(new Exception("This an exception for testing"));
- assertTrue(
- "SOAP 1.1 Body Test:- After calling addFault method, hasFault method returns false",
- soap11Body.hasFault());
- }
-
- public void testSOAP11GetFault() {
- assertTrue(
- "SOAP 1.1 Body Test:- After creating a soap body it has a fault",
- soap11Body.getFault() == null);
- soap11Body.addFault(new Exception("This an exception for testing"));
- assertFalse(
- "SOAP 1.1 Body Test:- After calling addFault method, getFault method returns null",
- soap11Body.getFault() == null);
- }
-
- //SOAP 1.2 Body Test (Programaticaly Created)----------------------------------------------------------------------------------
- public void testSOAP12AddFault1() {
- soap12Body.addFault(new Exception("This an exception for testing"));
- assertTrue(
- "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",
- soap12Body.hasFault());
-
- }
-
- public void testSOAP12AddFault2() {
- soap12Body.addFault(soap12Factory.createSOAPFault(soap12Body));
- assertTrue(
- "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",
- soap12Body.hasFault());
- }
-
- public void testSOAP12HasFault() {
- assertFalse(
- "SOAP 1.2 Body Test:- After creating a soap body it has a fault",
- soap12Body.hasFault());
- soap12Body.addFault(new Exception("This an exception for testing"));
- assertTrue(
- "SOAP 1.2 Body Test:- After calling addFault method, hasFault method returns false",
- soap12Body.hasFault());
- }
-
- public void testSOAP12GetFault() {
- assertTrue(
- "SOAP 1.2 Body Test:- After creating a soap body it has a fault",
- soap12Body.getFault() == null);
- soap12Body.addFault(new Exception("This an exception for testing"));
- assertFalse(
- "SOAP 1.2 Body Test:- After calling addFault method, getFault method returns null",
- soap12Body.getFault() == null);
- }
-
- //SOAP 1.1 Body Test (With Parser)-------------------------------------------------------------------------------------------
- public void testSOAP11HasFaultWithParser() {
- assertTrue(
- "SOAP 1.1 Body Test With parser :- hasFault method returns false",
- soap11BodyWithParser.hasFault());
- }
-
- public void testSOAP11GetFaultWithParser() {
- assertFalse(
- "SOAP 1.1 Body Test With parser :- getFault method returns null",
- soap11BodyWithParser.getFault() == null);
- assertTrue(
- "SOAP 1.1 Body Test With parser : - SOAP fault name mismatch",
- soap11BodyWithParser.getFault().getLocalName().equals(
- SOAPConstants.SOAPFAULT_LOCAL_NAME));
- }
-
- //SOAP 1.2 Body Test (With Parser)-------------------------------------------------------------------------------------------------
- public void testSOAP12HasFaultWithParser() {
- assertTrue(
- "SOAP 1.2 Body Test With parser :- hasFault method returns false",
- soap12BodyWithParser.hasFault());
- }
-
- public void testSOAP12GetFaultWithParser() {
- assertFalse(
- "SOAP 1.2 Body Test With parser :- getFault method returns null",
- soap12BodyWithParser.getFault() == null);
- assertTrue(
- "SOAP 1.2 Body Test With parser : - SOAP fault name mismatch",
- soap12BodyWithParser.getFault().getLocalName().equals(
- SOAPConstants.SOAPFAULT_LOCAL_NAME));
- }
-
- public void testSOAPBodyDetachment(){
- try {
- soap11Body.detach();
- fail("Detachment of SOAP Body is not allowed !!");
- } catch (OMException e) {
- assertTrue(true);
- }
-
- try {
- soap12Body.detach();
- fail("Detachment of SOAP Body is not allowed !!");
- } catch (OMException e) {
- assertTrue(true);
- }
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.soap;
+
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.impl.llom.SOAPConstants;
+
+public class SOAPBodyTest extends SOAPBodyTestCase {
+
+ public SOAPBodyTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SOAP 1.1 Body Test (Programaticaly created)----------------------------------------------------------------------------------
+ public void testSOAP11AddFault1() {
+ soap11Body.addFault(new Exception("This an exception for testing"));
+ assertTrue(
+ "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",
+ soap11Body.hasFault());
+
+ }
+
+ public void testSOAP11addFault2() {
+ soap11Body.addFault(soap11Factory.createSOAPFault(soap11Body));
+ assertTrue(
+ "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",
+ soap11Body.hasFault());
+
+
+ }
+
+ public void testSOAP11HasFault() {
+ assertFalse(
+ "SOAP 1.1 Body Test:- After creating a soap body it has a fault",
+ soap11Body.hasFault());
+ soap11Body.addFault(new Exception("This an exception for testing"));
+ assertTrue(
+ "SOAP 1.1 Body Test:- After calling addFault method, hasFault method returns false",
+ soap11Body.hasFault());
+ }
+
+ public void testSOAP11GetFault() {
+ assertTrue(
+ "SOAP 1.1 Body Test:- After creating a soap body it has a fault",
+ soap11Body.getFault() == null);
+ soap11Body.addFault(new Exception("This an exception for testing"));
+ assertFalse(
+ "SOAP 1.1 Body Test:- After calling addFault method, getFault method returns null",
+ soap11Body.getFault() == null);
+ }
+
+ //SOAP 1.2 Body Test (Programaticaly Created)----------------------------------------------------------------------------------
+ public void testSOAP12AddFault1() {
+ soap12Body.addFault(new Exception("This an exception for testing"));
+ assertTrue(
+ "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",
+ soap12Body.hasFault());
+
+ }
+
+ public void testSOAP12AddFault2() {
+ soap12Body.addFault(soap12Factory.createSOAPFault(soap12Body));
+ assertTrue(
+ "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",
+ soap12Body.hasFault());
+ }
+
+ public void testSOAP12HasFault() {
+ assertFalse(
+ "SOAP 1.2 Body Test:- After creating a soap body it has a fault",
+ soap12Body.hasFault());
+ soap12Body.addFault(new Exception("This an exception for testing"));
+ assertTrue(
+ "SOAP 1.2 Body Test:- After calling addFault method, hasFault method returns false",
+ soap12Body.hasFault());
+ }
+
+ public void testSOAP12GetFault() {
+ assertTrue(
+ "SOAP 1.2 Body Test:- After creating a soap body it has a fault",
+ soap12Body.getFault() == null);
+ soap12Body.addFault(new Exception("This an exception for testing"));
+ assertFalse(
+ "SOAP 1.2 Body Test:- After calling addFault method, getFault method returns null",
+ soap12Body.getFault() == null);
+ }
+
+ //SOAP 1.1 Body Test (With Parser)-------------------------------------------------------------------------------------------
+ public void testSOAP11HasFaultWithParser() {
+ assertTrue(
+ "SOAP 1.1 Body Test With parser :- hasFault method returns false",
+ soap11BodyWithParser.hasFault());
+ }
+
+ public void testSOAP11GetFaultWithParser() {
+ assertFalse(
+ "SOAP 1.1 Body Test With parser :- getFault method returns null",
+ soap11BodyWithParser.getFault() == null);
+ assertTrue(
+ "SOAP 1.1 Body Test With parser : - SOAP fault name mismatch",
+ soap11BodyWithParser.getFault().getLocalName().equals(
+ SOAPConstants.SOAPFAULT_LOCAL_NAME));
+ }
+
+ //SOAP 1.2 Body Test (With Parser)-------------------------------------------------------------------------------------------------
+ public void testSOAP12HasFaultWithParser() {
+ assertTrue(
+ "SOAP 1.2 Body Test With parser :- hasFault method returns false",
+ soap12BodyWithParser.hasFault());
+ }
+
+ public void testSOAP12GetFaultWithParser() {
+ assertFalse(
+ "SOAP 1.2 Body Test With parser :- getFault method returns null",
+ soap12BodyWithParser.getFault() == null);
+ assertTrue(
+ "SOAP 1.2 Body Test With parser : - SOAP fault name mismatch",
+ soap12BodyWithParser.getFault().getLocalName().equals(
+ SOAPConstants.SOAPFAULT_LOCAL_NAME));
+ }
+
+ public void testSOAPBodyDetachment(){
+ try {
+ soap11Body.detach();
+ fail("Detachment of SOAP Body is not allowed !!");
+ } catch (OMException e) {
+ assertTrue(true);
+ }
+
+ try {
+ soap12Body.detach();
+ fail("Detachment of SOAP Body is not allowed !!");
+ } catch (OMException e) {
+ assertTrue(true);
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPBodyTest.java
------------------------------------------------------------------------------
svn:eol-style = native