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 [134/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/soap/impl/llom/OMHeaderBlockTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderBlockTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderBlockTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderBlockTest.java Thu Sep 15 11:52:11 2005
@@ -1,58 +1,58 @@
-/*
- * 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.impl.llom;
-
-import org.apache.axis2.om.OMTestCase;
-import org.apache.axis2.soap.SOAPHeader;
-import org.apache.axis2.soap.SOAPHeaderBlock;
-
-import java.util.Iterator;
-
-public class OMHeaderBlockTest extends OMTestCase {
- SOAPHeader soapHeader;
- SOAPHeaderBlock soapHeaderElement;
-
- public OMHeaderBlockTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- soapHeader = soapEnvelope.getHeader();
- Iterator headerElementIter = soapHeader.examineAllHeaderBlocks();
- if (headerElementIter.hasNext()) {
- soapHeaderElement = (SOAPHeaderBlock) headerElementIter.next();
- }
- }
-
- public void testSetAndGetActor() {
- String newActorURI = "http://newActor.org";
- soapHeaderElement.setRole(newActorURI);
- assertTrue("Actor was not properly set",
- soapHeaderElement.getRole().equalsIgnoreCase(newActorURI));
- }
-
- public void testSetAndGetMustUnderstand() {
- soapHeaderElement.setMustUnderstand(false);
- assertTrue("MustUnderstand was not properly set",
- !soapHeaderElement.getMustUnderstand());
- }
-
- public void testGetMustUnderstand() {
- //TODO Implement getMustUnderstand().
- }
-
-}
+/*
+ * 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.impl.llom;
+
+import org.apache.axis2.om.OMTestCase;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+
+import java.util.Iterator;
+
+public class OMHeaderBlockTest extends OMTestCase {
+ SOAPHeader soapHeader;
+ SOAPHeaderBlock soapHeaderElement;
+
+ public OMHeaderBlockTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soapHeader = soapEnvelope.getHeader();
+ Iterator headerElementIter = soapHeader.examineAllHeaderBlocks();
+ if (headerElementIter.hasNext()) {
+ soapHeaderElement = (SOAPHeaderBlock) headerElementIter.next();
+ }
+ }
+
+ public void testSetAndGetActor() {
+ String newActorURI = "http://newActor.org";
+ soapHeaderElement.setRole(newActorURI);
+ assertTrue("Actor was not properly set",
+ soapHeaderElement.getRole().equalsIgnoreCase(newActorURI));
+ }
+
+ public void testSetAndGetMustUnderstand() {
+ soapHeaderElement.setMustUnderstand(false);
+ assertTrue("MustUnderstand was not properly set",
+ !soapHeaderElement.getMustUnderstand());
+ }
+
+ public void testGetMustUnderstand() {
+ //TODO Implement getMustUnderstand().
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderBlockTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderTest.java Thu Sep 15 11:52:11 2005
@@ -1,84 +1,84 @@
-/*
- * 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.impl.llom;
-
-import org.apache.axis2.om.OMTestCase;
-import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
-import org.apache.axis2.soap.SOAPHeader;
-import org.apache.axis2.soap.SOAPHeaderBlock;
-
-import java.util.Iterator;
-
-public class OMHeaderTest extends OMTestCase {
- SOAPHeader soapHeader;
-
- public OMHeaderTest(String testName) {
- super(testName);
- }
-
- public static void main(String[] args) {
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- soapHeader = soapEnvelope.getHeader();
- }
-
- public void testAddHeaderElement() {
- String newElementName = "MyHeaderElement";
- SOAPHeaderBlock soapHeaderElement = soapHeader.addHeaderBlock(
- newElementName,
- new OMNamespaceImpl("http://opensource.lk", "lsf"));
- assertTrue(
- "Header Element added has different parent than it should have",
- soapHeaderElement.getParent() == soapHeader);
- assertTrue(
- "Header Element added has different localname than it was given",
- soapHeaderElement.getLocalName().equalsIgnoreCase(
- newElementName));
- }
-
- public void testExamineHeaderElements() {
- }
-
- public void testExtractHeaderElements() {
- //TODO Implement extractHeaderBlocks().
- }
-
- public void testExamineMustUnderstandHeaderElements() {
- //TODO Implement examineMustUnderstandHeaderBlocks().
- }
-
- public void testExamineAllHeaderElements() {
- Iterator iterator = soapHeader.examineAllHeaderBlocks();
- int headerElementCount = 0;
- while (iterator.hasNext()) {
- iterator.next();
- headerElementCount++;
- }
- assertTrue(
- "Number of header elements in the header differs from expected value of 3",
- headerElementCount == 3);
- }
-
- public void testExtractAllHeaderElements() {
- //TODO Implement extractAllHeaderBlocks().
- }
-
-}
+/*
+ * 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.impl.llom;
+
+import org.apache.axis2.om.OMTestCase;
+import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+
+import java.util.Iterator;
+
+public class OMHeaderTest extends OMTestCase {
+ SOAPHeader soapHeader;
+
+ public OMHeaderTest(String testName) {
+ super(testName);
+ }
+
+ public static void main(String[] args) {
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ soapHeader = soapEnvelope.getHeader();
+ }
+
+ public void testAddHeaderElement() {
+ String newElementName = "MyHeaderElement";
+ SOAPHeaderBlock soapHeaderElement = soapHeader.addHeaderBlock(
+ newElementName,
+ new OMNamespaceImpl("http://opensource.lk", "lsf"));
+ assertTrue(
+ "Header Element added has different parent than it should have",
+ soapHeaderElement.getParent() == soapHeader);
+ assertTrue(
+ "Header Element added has different localname than it was given",
+ soapHeaderElement.getLocalName().equalsIgnoreCase(
+ newElementName));
+ }
+
+ public void testExamineHeaderElements() {
+ }
+
+ public void testExtractHeaderElements() {
+ //TODO Implement extractHeaderBlocks().
+ }
+
+ public void testExamineMustUnderstandHeaderElements() {
+ //TODO Implement examineMustUnderstandHeaderBlocks().
+ }
+
+ public void testExamineAllHeaderElements() {
+ Iterator iterator = soapHeader.examineAllHeaderBlocks();
+ int headerElementCount = 0;
+ while (iterator.hasNext()) {
+ iterator.next();
+ headerElementCount++;
+ }
+ assertTrue(
+ "Number of header elements in the header differs from expected value of 3",
+ headerElementCount == 3);
+ }
+
+ public void testExtractAllHeaderElements() {
+ //TODO Implement extractAllHeaderBlocks().
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/OMHeaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java Thu Sep 15 11:52:11 2005
@@ -1,553 +1,553 @@
-package org.apache.axis2.soap.impl.llom.builder;
-
-import junit.framework.TestCase;
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMXMLParserWrapper;
-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;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.StringReader;
-import java.util.Iterator;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Anushka
- * Date: Jun 3, 2005
- * Time: 10:22:26 AM
- * To change this template use File | Settings | File Templates.
- */
-public class StAXSOAPModelBuilderTest extends TestCase {
-
- private Log log = LogFactory.getLog(getClass());
- public void setUp() {
-
- }
-
- public void testStAXSOAPModelBuilder() {
- String soap12Message =
- "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
- " <env:Header>\n" +
- " <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
- " env:role=\"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\"\n" +
- " env:mustUnderstand=\"true\">\n" +
- " foo\n" +
- " </test:echoOk>\n" +
- " </env:Header>\n" +
- " <env:Body>\n" +
- " <env:Fault>\n" +
- " <env:Code>\n" +
- " <env:Value>env:Sender</env:Value>\n" +
- " <env:SubCode>\n" +
- " <env:Value>m:MessageTimeout</env:Value>\n" +
- " <env:SubCode>\n" +
- " <env:Value>m:MessageTimeout</env:Value>\n" +
- " </env:SubCode>\n" +
- " </env:SubCode>\n" +
- " </env:Code>\n" +
- " <env:Reason>\n" +
- " <env:Text>Sender Timeout</env:Text>\n" +
- " </env:Reason>\n" +
- " <env:Node>\n" +
- " http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\n" +
- " </env:Node>\n" +
- " <env:Role>\n" +
- " ultimateReceiver\n" +
- " </env:Role>\n" +
- " <env:Detail xmlns:m=\"http:www.sample.org\">\n" +
- " Details of error\n" +
- " <m:MaxTime m:detail=\"This is only a test\">\n" +
- " P5M\n" +
- " </m:MaxTime>\n" +
- " <m:AveTime>\n" +
- " <m:Time>\n" +
- " P3M\n" +
- " </m:Time>\n" +
- " </m:AveTime>\n" +
- " </env:Detail>\n" +
- " </env:Fault>\n" +
- " </env:Body>\n" +
- "</env:Envelope>";
-
- String soap11Message =
- "<?xml version='1.0' ?>" +
- "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
- " <env:Header>\n" +
- " <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
- " env:actor=\"http://schemas.xmlsoap.org/soap/actor/next\"\n" +
- " env:mustUnderstand=\"1\"" +
- " >\n" +
- " foo\n" +
- " </test:echoOk>\n" +
- " </env:Header>\n" +
- " <env:Body>\n" +
- " <env:Fault>\n" +
- " <env:faultcode>\n" +
- " env:Sender\n" +
- " </env:faultcode>\n" +
- " <env:faultstring>\n" +
- " Sender Timeout\n" +
- " </env:faultstring>\n" +
- " <env:faultactor>\n" +
- " http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver\n" +
- " </env:faultactor>\n" +
- " <env:detail xmlns:m=\"http:www.sample.org\">\n" +
- " Details of error\n" +
- " <m:MaxTime m:detail=\"This is only a test\">\n" +
- " P5M\n" +
- " </m:MaxTime>\n" +
- " <m:AveTime>\n" +
- " <m:Time>\n" +
- " P3M\n" +
- " </m:Time>\n" +
- " </m:AveTime>\n" +
- " </env:detail>\n" +
- " <n:Test xmlns:n=\"http:www.Test.org\">\n" +
- " <n:TestElement>\n" +
- " This is only a test\n" +
- " </n:TestElement>\n" +
- " </n:Test>\n" +
- " </env:Fault>\n" +
- " </env:Body>\n" +
- "</env:Envelope>";
-
-
- try {
- XMLStreamReader sopa12Parser = XMLInputFactory.newInstance()
- .createXMLStreamReader(new StringReader(soap12Message));
- OMXMLParserWrapper soap12Builder = new StAXSOAPModelBuilder(sopa12Parser, null);
- SOAPEnvelope soap12Envelope = (SOAPEnvelope) soap12Builder.getDocumentElement();
-// soap12Envelope.build();
-// XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-// soap12Envelope.serialize(writer);
-// writer.flush();
-
- assertTrue("SOAP 1.2 :- envelope local name mismatch",
- soap12Envelope.getLocalName().equals(
- SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- envelope namespace uri mismatch",
- soap12Envelope.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- SOAPHeader header = soap12Envelope.getHeader();
- assertTrue("SOAP 1.2 :- Header local name mismatch",
- header.getLocalName().equals(
- SOAPConstants.HEADER_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Header namespace uri mismatch",
- header.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) header.getFirstElement();
- assertTrue("SOAP 1.2 :- Header block name mismatch",
- headerBlock.getLocalName().equals("echoOk"));
- assertTrue("SOAP 1.2 :- Header block name space uri mismatch",
- headerBlock.getNamespace().getName().equals(
- "http://example.org/ts-tests"));
- assertEquals("SOAP 1.2 :- Header block text mismatch",headerBlock.getText().trim(),"foo");
-
- Iterator headerBlockAttributes = headerBlock.getAttributes();
- OMAttribute roleAttribute = (OMAttribute) headerBlockAttributes.next();
- assertTrue("SOAP 1.2 :- Role attribute name mismatch",
- roleAttribute.getLocalName().equals(
- SOAP12Constants.SOAP_ROLE));
-
-
- assertTrue("SOAP 1.2 :- Role value mismatch",
- roleAttribute.getValue().trim().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI + "/" +
- SOAP12Constants.SOAP_ROLE +
- "/" +
- "ultimateReceiver"));
- assertTrue("SOAP 1.2 :- Role attribute namespace uri mismatch",
- roleAttribute.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- OMAttribute mustUnderstandAttribute = (OMAttribute) headerBlockAttributes.next();
- assertTrue("SOAP 1.2 :- Mustunderstand attribute name mismatch",
- mustUnderstandAttribute.getLocalName().equals(
- SOAPConstants.ATTR_MUSTUNDERSTAND));
- assertTrue("SOAP 1.2 :- Mustunderstand value mismatch",
- mustUnderstandAttribute.getValue().equals(
- SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE));
- assertTrue(
- "SOAP 1.2 :- Mustunderstand attribute namespace uri mismatch",
- mustUnderstandAttribute.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- SOAPBody body = soap12Envelope.getBody();
- assertTrue("SOAP 1.2 :- Body local name mismatch",
- body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Body namespace uri mismatch",
- body.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- SOAPFault fault = body.getFault();
- assertTrue("SOAP 1.2 :- Fault local name mismatch",
- fault.getLocalName().equals(
- SOAPConstants.SOAPFAULT_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault namespace uri mismatch",
- fault.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- Iterator iteratorInFault = fault.getChildren();
-
- iteratorInFault.next();
- SOAPFaultCode code = (SOAPFaultCode) iteratorInFault.next();
- assertTrue("SOAP 1.2 :- Fault code local name mismatch",
- code.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
- code.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- Iterator iteratorInCode = code.getChildren();
-
- iteratorInCode.next();
- SOAPFaultValue value1 = (SOAPFaultValue) iteratorInCode.next();
- assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
- value1.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
- value1.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Value1 text mismatch",
- value1.getText().equals("env:Sender"));
-
- iteratorInCode.next();
- SOAPFaultSubCode subCode1 = (SOAPFaultSubCode) iteratorInCode.next();
- assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
- subCode1.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
- subCode1.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- Iterator iteratorInSubCode1 = subCode1.getChildren();
-
- iteratorInSubCode1.next();
- SOAPFaultValue value2 = (SOAPFaultValue) iteratorInSubCode1.next();
- assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
- value2.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
- value2.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Value2 text mismatch",
- value2.getText().equals("m:MessageTimeout"));
-
- iteratorInSubCode1.next();
- SOAPFaultSubCode subCode2 = (SOAPFaultSubCode) iteratorInSubCode1.next();
- assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
- subCode2.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
- subCode2.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- Iterator iteratorInSubCode2 = subCode2.getChildren();
-
- iteratorInSubCode2.next();
- SOAPFaultValue value3 = (SOAPFaultValue) iteratorInSubCode2.next();
- assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
- value3.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
- value3.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Value2 text mismatch",
- value3.getText().equals("m:MessageTimeout"));
-
- iteratorInFault.next();
- SOAPFaultReason reason = (SOAPFaultReason) iteratorInFault.next();
- assertTrue("SOAP 1.2 :- Fault reason local name mismatch",
- reason.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault reason namespace uri mismatch",
- reason.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- Iterator iteratorInReason = reason.getChildren();
-
- iteratorInReason.next();
- SOAPFaultText text = (SOAPFaultText) iteratorInReason.next();
- assertTrue("SOAP 1.2 :- Fault text local name mismatch",
- text.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Text namespace uri mismatch",
- text.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Text value mismatch",
- text.getText().equals("Sender Timeout"));
-
- iteratorInFault.next();
- SOAPFaultNode node = (SOAPFaultNode) iteratorInFault.next();
- assertTrue("SOAP 1.2 :- Fault node local name mismatch",
- node.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault node namespace uri mismatch",
- node.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Node value mismatch",
- node.getText().trim().equals(
- "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
-
- iteratorInFault.next();
- SOAPFaultRole role = (SOAPFaultRole) iteratorInFault.next();
- assertTrue("SOAP 1.2 :- Fault role local name mismatch",
- role.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault role namespace uri mismatch",
- role.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Role value mismatch",
- role.getText().trim().equals("ultimateReceiver"));
-
- iteratorInFault.next();
- SOAPFaultDetail detail = (SOAPFaultDetail) iteratorInFault.next();
- assertTrue("SOAP 1.2 :- Fault detail local name mismatch",
- detail.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault detail namespace uri mismatch",
- detail.getNamespace().getName().equals(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- assertTrue("SOAP 1.2 :- Text in detail mismatch",
- detail.getText().trim().equals("Details of error"));
-
- Iterator iteratorInDetail = detail.getChildren();
-
- iteratorInDetail.next();
- OMElement element1 = (OMElement) iteratorInDetail.next();
- assertTrue("SOAP 1.2 :- MaxTime element mismatch",
- element1.getLocalName().equals("MaxTime"));
- assertTrue("SOAP 1.2 :- MaxTime element namespace mismatch",
- element1.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.2 :- Text value in MaxTime element mismatch",
- element1.getText().trim().equals("P5M"));
-
- Iterator attributeIterator = element1.getAttributes();
- OMAttribute attributeInMaxTime = (OMAttribute) attributeIterator.next();
- assertTrue("SOAP 1.2 :- Attribute local name mismatch",
- attributeInMaxTime.getLocalName().equals("detail"));
- assertTrue("SOAP 1.2 :- Attribute namespace mismatch",
- attributeInMaxTime.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.2 :- Attribute value mismatch",
- attributeInMaxTime.getValue().trim().equals("This is only a test"));
-
- iteratorInDetail.next();
- OMElement element2 = (OMElement) iteratorInDetail.next();
- assertTrue("SOAP 1.2 :- AveTime element mismatch",
- element2.getLocalName().equals("AveTime"));
- assertTrue("SOAP 1.2 :- AveTime element namespace mismatch",
- element2.getNamespace().getName().equals(
- "http:www.sample.org"));
-
- Iterator iteratorInAveTimeElement = element2.getChildren();
-
- iteratorInAveTimeElement.next();
- OMElement element21 = (OMElement) iteratorInAveTimeElement.next();
- assertTrue("SOAP 1.2 :- Time element mismatch",
- element21.getLocalName().equals("Time"));
- assertTrue("SOAP 1.2 :- Time element namespace mismatch",
- element21.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.2 :- Text value in Time element mismatch",
- element21.getText().trim().equals("P3M"));
-
- XMLStreamReader sopa11Parser = XMLInputFactory.newInstance()
- .createXMLStreamReader(new StringReader(soap11Message));
- OMXMLParserWrapper soap11Builder = new StAXSOAPModelBuilder(sopa11Parser, null);
- SOAPEnvelope soap11Envelope = (SOAPEnvelope) soap11Builder.getDocumentElement();
-// soap11Envelope.build();
-// writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-// soap11Envelope.serialize(writer);
-// writer.flush();
-
- assertTrue("SOAP 1.1 :- envelope local name mismatch",
- soap11Envelope.getLocalName().equals(
- SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- envelope namespace uri mismatch",
- soap11Envelope.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- header = soap11Envelope.getHeader();
- assertTrue("SOAP 1.1 :- Header local name mismatch",
- header.getLocalName().equals(
- SOAPConstants.HEADER_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- Header namespace uri mismatch",
- header.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- headerBlock = (SOAPHeaderBlock) header.getFirstElement();
- assertTrue("SOAP 1.1 :- Header block name mismatch",
- headerBlock.getLocalName().equals("echoOk"));
- assertTrue("SOAP 1.1 :- Header block name space uri mismatch",
- headerBlock.getNamespace().getName().equals(
- "http://example.org/ts-tests"));
- assertTrue("SOAP 1.1 :- Headaer block text mismatch",
- headerBlock.getText().trim().equals("foo"));
-
- headerBlockAttributes = headerBlock.getAttributes();
-
- mustUnderstandAttribute =
- (OMAttribute) headerBlockAttributes.next();
- assertTrue("SOAP 1.1 :- Mustunderstand attribute name mismatch",
- mustUnderstandAttribute.getLocalName().equals(
- SOAPConstants.ATTR_MUSTUNDERSTAND));
- assertTrue("SOAP 1.1 :- Mustunderstand value mismatch",
- mustUnderstandAttribute.getValue().equals(
- SOAPConstants.ATTR_MUSTUNDERSTAND_1));
- assertTrue(
- "SOAP 1.1 :- Mustunderstand attribute namespace uri mismatch",
- mustUnderstandAttribute.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- OMAttribute actorAttribute = (OMAttribute) headerBlockAttributes.next();
- assertTrue("SOAP 1.1 :- Actor attribute name mismatch",
- actorAttribute.getLocalName().equals(
- SOAP11Constants.ATTR_ACTOR));
- assertTrue("SOAP 1.1 :- Actor value mismatch",
- actorAttribute.getValue().trim().equals(
- "http://schemas.xmlsoap.org/soap/" +
- SOAP11Constants.ATTR_ACTOR +
- "/" +
- "next"));
- assertTrue("SOAP 1.1 :- Actor attribute namespace uri mismatch",
- actorAttribute.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- body = soap11Envelope.getBody();
- assertTrue("SOAP 1.1 :- Body local name mismatch",
- body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- Body namespace uri mismatch",
- body.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- fault = body.getFault();
- assertTrue("SOAP 1.1 :- Fault namespace uri mismatch",
- fault.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
-
- iteratorInFault = fault.getChildren();
-
- iteratorInFault.next();
- code = (SOAPFaultCode) iteratorInFault.next();
- assertEquals("SOAP Fault code local name mismatch",
- code.getLocalName(),
- (SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- Fault code namespace uri mismatch",
- code.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertEquals("SOAP 1.1 :- Fault code value mismatch", code.getValue().getText().trim(),
- "env:Sender");
-
- iteratorInFault.next();
- reason = (SOAPFaultReason) iteratorInFault.next();
- assertTrue("SOAP 1.1 :- Fault string local name mismatch",
- reason.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
- assertTrue("SOAP 1.2 :- Fault string namespace uri mismatch",
- reason.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.1 :- Fault string value mismatch",
- reason.getSOAPText().getText().trim().equals("Sender Timeout"));
-
- iteratorInFault.next();
- role = (SOAPFaultRole) iteratorInFault.next();
- assertTrue("SOAP 1.1 :- Fault actor local name mismatch",
- role.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- Fault actor namespace uri mismatch",
- role.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.1 :- Actor value mismatch",
- role.getText().trim().equals(
- "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));
-
- iteratorInFault.next();
- detail = (SOAPFaultDetail) iteratorInFault.next();
- assertTrue("SOAP 1.1 :- Fault detail local name mismatch",
- detail.getLocalName().equals(
- SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
- assertTrue("SOAP 1.1 :- Fault detail namespace uri mismatch",
- detail.getNamespace().getName().equals(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
- assertTrue("SOAP 1.2 :- Text in detail mismatch",
- detail.getText().trim().equals("Details of error"));
-
- iteratorInDetail = detail.getChildren();
-
- iteratorInDetail.next();
- element1 = (OMElement) iteratorInDetail.next();
- assertTrue("SOAP 1.1 :- MaxTime element mismatch",
- element1.getLocalName().equals("MaxTime"));
- assertTrue("SOAP 1.1 :- MaxTime element namespace mismatch",
- element1.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.1 :- Text value in MaxTime element mismatch",
- element1.getText().trim().equals("P5M"));
-
- attributeIterator = element1.getAttributes();
- attributeInMaxTime = (OMAttribute) attributeIterator.next();
- assertTrue("SOAP 1.1 :- Attribute local name mismatch",
- attributeInMaxTime.getLocalName().equals("detail"));
- assertTrue("SOAP 1.1 :- Attribute namespace mismatch",
- attributeInMaxTime.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.1 :- Attribute value mismatch",
- attributeInMaxTime.getValue().equals("This is only a test"));
-
- iteratorInDetail.next();
- element2 = (OMElement) iteratorInDetail.next();
- assertTrue("SOAP 1.1 :- AveTime element mismatch",
- element2.getLocalName().equals("AveTime"));
- assertTrue("SOAP 1.1 :- AveTime element namespace mismatch",
- element2.getNamespace().getName().equals(
- "http:www.sample.org"));
-
- iteratorInAveTimeElement = element2.getChildren();
-
- iteratorInAveTimeElement.next();
- element21 = (OMElement) iteratorInAveTimeElement.next();
- assertTrue("SOAP 1.1 :- Time element mismatch",
- element21.getLocalName().equals("Time"));
- assertTrue("SOAP 1.1 :- Time element namespace mismatch",
- element21.getNamespace().getName().equals(
- "http:www.sample.org"));
- assertTrue("SOAP 1.1 :- Text value in Time element mismatch",
- element21.getText().trim().equals("P3M"));
-
- iteratorInFault.next();
- OMElement testElement = (OMElement) iteratorInFault.next();
- assertTrue("SOAP 1.1 :- Test element mismatch",
- testElement.getLocalName().equals("Test"));
- assertTrue("SOAP 1.1 :- Test element namespace mismatch",
- testElement.getNamespace().getName().equals(
- "http:www.Test.org"));
-
- OMElement childOfTestElement = testElement.getFirstElement();
- assertTrue("SOAP 1.1 :- Test element child local name mismatch",
- childOfTestElement.getLocalName().equals("TestElement"));
- assertTrue("SOAP 1.1 :- Test element child namespace mismatch",
- childOfTestElement.getNamespace().getName().equals(
- "http:www.Test.org"));
- assertTrue("SOAP 1.1 :- Test element child value mismatch",
- childOfTestElement.getText().trim().equals("This is only a test"));
-
- } catch (XMLStreamException e) {
- log.info(e.getMessage());
- fail("Test failed. Reason -> " + e.getMessage());
- } catch (Exception e) {
- log.info(e.getMessage());
- fail("Test failed. Reason -> " + e.getMessage());
-
- }
- }
-}
+package org.apache.axis2.soap.impl.llom.builder;
+
+import junit.framework.TestCase;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+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;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.StringReader;
+import java.util.Iterator;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Anushka
+ * Date: Jun 3, 2005
+ * Time: 10:22:26 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class StAXSOAPModelBuilderTest extends TestCase {
+
+ private Log log = LogFactory.getLog(getClass());
+ public void setUp() {
+
+ }
+
+ public void testStAXSOAPModelBuilder() {
+ String soap12Message =
+ "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
+ " <env:Header>\n" +
+ " <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+ " env:role=\"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\"\n" +
+ " env:mustUnderstand=\"true\">\n" +
+ " foo\n" +
+ " </test:echoOk>\n" +
+ " </env:Header>\n" +
+ " <env:Body>\n" +
+ " <env:Fault>\n" +
+ " <env:Code>\n" +
+ " <env:Value>env:Sender</env:Value>\n" +
+ " <env:SubCode>\n" +
+ " <env:Value>m:MessageTimeout</env:Value>\n" +
+ " <env:SubCode>\n" +
+ " <env:Value>m:MessageTimeout</env:Value>\n" +
+ " </env:SubCode>\n" +
+ " </env:SubCode>\n" +
+ " </env:Code>\n" +
+ " <env:Reason>\n" +
+ " <env:Text>Sender Timeout</env:Text>\n" +
+ " </env:Reason>\n" +
+ " <env:Node>\n" +
+ " http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\n" +
+ " </env:Node>\n" +
+ " <env:Role>\n" +
+ " ultimateReceiver\n" +
+ " </env:Role>\n" +
+ " <env:Detail xmlns:m=\"http:www.sample.org\">\n" +
+ " Details of error\n" +
+ " <m:MaxTime m:detail=\"This is only a test\">\n" +
+ " P5M\n" +
+ " </m:MaxTime>\n" +
+ " <m:AveTime>\n" +
+ " <m:Time>\n" +
+ " P3M\n" +
+ " </m:Time>\n" +
+ " </m:AveTime>\n" +
+ " </env:Detail>\n" +
+ " </env:Fault>\n" +
+ " </env:Body>\n" +
+ "</env:Envelope>";
+
+ String soap11Message =
+ "<?xml version='1.0' ?>" +
+ "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+ " <env:Header>\n" +
+ " <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+ " env:actor=\"http://schemas.xmlsoap.org/soap/actor/next\"\n" +
+ " env:mustUnderstand=\"1\"" +
+ " >\n" +
+ " foo\n" +
+ " </test:echoOk>\n" +
+ " </env:Header>\n" +
+ " <env:Body>\n" +
+ " <env:Fault>\n" +
+ " <env:faultcode>\n" +
+ " env:Sender\n" +
+ " </env:faultcode>\n" +
+ " <env:faultstring>\n" +
+ " Sender Timeout\n" +
+ " </env:faultstring>\n" +
+ " <env:faultactor>\n" +
+ " http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver\n" +
+ " </env:faultactor>\n" +
+ " <env:detail xmlns:m=\"http:www.sample.org\">\n" +
+ " Details of error\n" +
+ " <m:MaxTime m:detail=\"This is only a test\">\n" +
+ " P5M\n" +
+ " </m:MaxTime>\n" +
+ " <m:AveTime>\n" +
+ " <m:Time>\n" +
+ " P3M\n" +
+ " </m:Time>\n" +
+ " </m:AveTime>\n" +
+ " </env:detail>\n" +
+ " <n:Test xmlns:n=\"http:www.Test.org\">\n" +
+ " <n:TestElement>\n" +
+ " This is only a test\n" +
+ " </n:TestElement>\n" +
+ " </n:Test>\n" +
+ " </env:Fault>\n" +
+ " </env:Body>\n" +
+ "</env:Envelope>";
+
+
+ try {
+ XMLStreamReader sopa12Parser = XMLInputFactory.newInstance()
+ .createXMLStreamReader(new StringReader(soap12Message));
+ OMXMLParserWrapper soap12Builder = new StAXSOAPModelBuilder(sopa12Parser, null);
+ SOAPEnvelope soap12Envelope = (SOAPEnvelope) soap12Builder.getDocumentElement();
+// soap12Envelope.build();
+// XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+// soap12Envelope.serialize(writer);
+// writer.flush();
+
+ assertTrue("SOAP 1.2 :- envelope local name mismatch",
+ soap12Envelope.getLocalName().equals(
+ SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- envelope namespace uri mismatch",
+ soap12Envelope.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ SOAPHeader header = soap12Envelope.getHeader();
+ assertTrue("SOAP 1.2 :- Header local name mismatch",
+ header.getLocalName().equals(
+ SOAPConstants.HEADER_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Header namespace uri mismatch",
+ header.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+ assertTrue("SOAP 1.2 :- Header block name mismatch",
+ headerBlock.getLocalName().equals("echoOk"));
+ assertTrue("SOAP 1.2 :- Header block name space uri mismatch",
+ headerBlock.getNamespace().getName().equals(
+ "http://example.org/ts-tests"));
+ assertEquals("SOAP 1.2 :- Header block text mismatch",headerBlock.getText().trim(),"foo");
+
+ Iterator headerBlockAttributes = headerBlock.getAttributes();
+ OMAttribute roleAttribute = (OMAttribute) headerBlockAttributes.next();
+ assertTrue("SOAP 1.2 :- Role attribute name mismatch",
+ roleAttribute.getLocalName().equals(
+ SOAP12Constants.SOAP_ROLE));
+
+
+ assertTrue("SOAP 1.2 :- Role value mismatch",
+ roleAttribute.getValue().trim().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI + "/" +
+ SOAP12Constants.SOAP_ROLE +
+ "/" +
+ "ultimateReceiver"));
+ assertTrue("SOAP 1.2 :- Role attribute namespace uri mismatch",
+ roleAttribute.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ OMAttribute mustUnderstandAttribute = (OMAttribute) headerBlockAttributes.next();
+ assertTrue("SOAP 1.2 :- Mustunderstand attribute name mismatch",
+ mustUnderstandAttribute.getLocalName().equals(
+ SOAPConstants.ATTR_MUSTUNDERSTAND));
+ assertTrue("SOAP 1.2 :- Mustunderstand value mismatch",
+ mustUnderstandAttribute.getValue().equals(
+ SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE));
+ assertTrue(
+ "SOAP 1.2 :- Mustunderstand attribute namespace uri mismatch",
+ mustUnderstandAttribute.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ SOAPBody body = soap12Envelope.getBody();
+ assertTrue("SOAP 1.2 :- Body local name mismatch",
+ body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Body namespace uri mismatch",
+ body.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ SOAPFault fault = body.getFault();
+ assertTrue("SOAP 1.2 :- Fault local name mismatch",
+ fault.getLocalName().equals(
+ SOAPConstants.SOAPFAULT_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault namespace uri mismatch",
+ fault.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ Iterator iteratorInFault = fault.getChildren();
+
+ iteratorInFault.next();
+ SOAPFaultCode code = (SOAPFaultCode) iteratorInFault.next();
+ assertTrue("SOAP 1.2 :- Fault code local name mismatch",
+ code.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+ code.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ Iterator iteratorInCode = code.getChildren();
+
+ iteratorInCode.next();
+ SOAPFaultValue value1 = (SOAPFaultValue) iteratorInCode.next();
+ assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+ value1.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+ value1.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Value1 text mismatch",
+ value1.getText().equals("env:Sender"));
+
+ iteratorInCode.next();
+ SOAPFaultSubCode subCode1 = (SOAPFaultSubCode) iteratorInCode.next();
+ assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
+ subCode1.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
+ subCode1.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ Iterator iteratorInSubCode1 = subCode1.getChildren();
+
+ iteratorInSubCode1.next();
+ SOAPFaultValue value2 = (SOAPFaultValue) iteratorInSubCode1.next();
+ assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+ value2.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+ value2.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Value2 text mismatch",
+ value2.getText().equals("m:MessageTimeout"));
+
+ iteratorInSubCode1.next();
+ SOAPFaultSubCode subCode2 = (SOAPFaultSubCode) iteratorInSubCode1.next();
+ assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
+ subCode2.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
+ subCode2.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ Iterator iteratorInSubCode2 = subCode2.getChildren();
+
+ iteratorInSubCode2.next();
+ SOAPFaultValue value3 = (SOAPFaultValue) iteratorInSubCode2.next();
+ assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+ value3.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+ value3.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Value2 text mismatch",
+ value3.getText().equals("m:MessageTimeout"));
+
+ iteratorInFault.next();
+ SOAPFaultReason reason = (SOAPFaultReason) iteratorInFault.next();
+ assertTrue("SOAP 1.2 :- Fault reason local name mismatch",
+ reason.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault reason namespace uri mismatch",
+ reason.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ Iterator iteratorInReason = reason.getChildren();
+
+ iteratorInReason.next();
+ SOAPFaultText text = (SOAPFaultText) iteratorInReason.next();
+ assertTrue("SOAP 1.2 :- Fault text local name mismatch",
+ text.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Text namespace uri mismatch",
+ text.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Text value mismatch",
+ text.getText().equals("Sender Timeout"));
+
+ iteratorInFault.next();
+ SOAPFaultNode node = (SOAPFaultNode) iteratorInFault.next();
+ assertTrue("SOAP 1.2 :- Fault node local name mismatch",
+ node.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault node namespace uri mismatch",
+ node.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Node value mismatch",
+ node.getText().trim().equals(
+ "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
+
+ iteratorInFault.next();
+ SOAPFaultRole role = (SOAPFaultRole) iteratorInFault.next();
+ assertTrue("SOAP 1.2 :- Fault role local name mismatch",
+ role.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault role namespace uri mismatch",
+ role.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Role value mismatch",
+ role.getText().trim().equals("ultimateReceiver"));
+
+ iteratorInFault.next();
+ SOAPFaultDetail detail = (SOAPFaultDetail) iteratorInFault.next();
+ assertTrue("SOAP 1.2 :- Fault detail local name mismatch",
+ detail.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault detail namespace uri mismatch",
+ detail.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ assertTrue("SOAP 1.2 :- Text in detail mismatch",
+ detail.getText().trim().equals("Details of error"));
+
+ Iterator iteratorInDetail = detail.getChildren();
+
+ iteratorInDetail.next();
+ OMElement element1 = (OMElement) iteratorInDetail.next();
+ assertTrue("SOAP 1.2 :- MaxTime element mismatch",
+ element1.getLocalName().equals("MaxTime"));
+ assertTrue("SOAP 1.2 :- MaxTime element namespace mismatch",
+ element1.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.2 :- Text value in MaxTime element mismatch",
+ element1.getText().trim().equals("P5M"));
+
+ Iterator attributeIterator = element1.getAttributes();
+ OMAttribute attributeInMaxTime = (OMAttribute) attributeIterator.next();
+ assertTrue("SOAP 1.2 :- Attribute local name mismatch",
+ attributeInMaxTime.getLocalName().equals("detail"));
+ assertTrue("SOAP 1.2 :- Attribute namespace mismatch",
+ attributeInMaxTime.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.2 :- Attribute value mismatch",
+ attributeInMaxTime.getValue().trim().equals("This is only a test"));
+
+ iteratorInDetail.next();
+ OMElement element2 = (OMElement) iteratorInDetail.next();
+ assertTrue("SOAP 1.2 :- AveTime element mismatch",
+ element2.getLocalName().equals("AveTime"));
+ assertTrue("SOAP 1.2 :- AveTime element namespace mismatch",
+ element2.getNamespace().getName().equals(
+ "http:www.sample.org"));
+
+ Iterator iteratorInAveTimeElement = element2.getChildren();
+
+ iteratorInAveTimeElement.next();
+ OMElement element21 = (OMElement) iteratorInAveTimeElement.next();
+ assertTrue("SOAP 1.2 :- Time element mismatch",
+ element21.getLocalName().equals("Time"));
+ assertTrue("SOAP 1.2 :- Time element namespace mismatch",
+ element21.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.2 :- Text value in Time element mismatch",
+ element21.getText().trim().equals("P3M"));
+
+ XMLStreamReader sopa11Parser = XMLInputFactory.newInstance()
+ .createXMLStreamReader(new StringReader(soap11Message));
+ OMXMLParserWrapper soap11Builder = new StAXSOAPModelBuilder(sopa11Parser, null);
+ SOAPEnvelope soap11Envelope = (SOAPEnvelope) soap11Builder.getDocumentElement();
+// soap11Envelope.build();
+// writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+// soap11Envelope.serialize(writer);
+// writer.flush();
+
+ assertTrue("SOAP 1.1 :- envelope local name mismatch",
+ soap11Envelope.getLocalName().equals(
+ SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- envelope namespace uri mismatch",
+ soap11Envelope.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ header = soap11Envelope.getHeader();
+ assertTrue("SOAP 1.1 :- Header local name mismatch",
+ header.getLocalName().equals(
+ SOAPConstants.HEADER_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- Header namespace uri mismatch",
+ header.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+ assertTrue("SOAP 1.1 :- Header block name mismatch",
+ headerBlock.getLocalName().equals("echoOk"));
+ assertTrue("SOAP 1.1 :- Header block name space uri mismatch",
+ headerBlock.getNamespace().getName().equals(
+ "http://example.org/ts-tests"));
+ assertTrue("SOAP 1.1 :- Headaer block text mismatch",
+ headerBlock.getText().trim().equals("foo"));
+
+ headerBlockAttributes = headerBlock.getAttributes();
+
+ mustUnderstandAttribute =
+ (OMAttribute) headerBlockAttributes.next();
+ assertTrue("SOAP 1.1 :- Mustunderstand attribute name mismatch",
+ mustUnderstandAttribute.getLocalName().equals(
+ SOAPConstants.ATTR_MUSTUNDERSTAND));
+ assertTrue("SOAP 1.1 :- Mustunderstand value mismatch",
+ mustUnderstandAttribute.getValue().equals(
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1));
+ assertTrue(
+ "SOAP 1.1 :- Mustunderstand attribute namespace uri mismatch",
+ mustUnderstandAttribute.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ OMAttribute actorAttribute = (OMAttribute) headerBlockAttributes.next();
+ assertTrue("SOAP 1.1 :- Actor attribute name mismatch",
+ actorAttribute.getLocalName().equals(
+ SOAP11Constants.ATTR_ACTOR));
+ assertTrue("SOAP 1.1 :- Actor value mismatch",
+ actorAttribute.getValue().trim().equals(
+ "http://schemas.xmlsoap.org/soap/" +
+ SOAP11Constants.ATTR_ACTOR +
+ "/" +
+ "next"));
+ assertTrue("SOAP 1.1 :- Actor attribute namespace uri mismatch",
+ actorAttribute.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ body = soap11Envelope.getBody();
+ assertTrue("SOAP 1.1 :- Body local name mismatch",
+ body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- Body namespace uri mismatch",
+ body.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ fault = body.getFault();
+ assertTrue("SOAP 1.1 :- Fault namespace uri mismatch",
+ fault.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+ iteratorInFault = fault.getChildren();
+
+ iteratorInFault.next();
+ code = (SOAPFaultCode) iteratorInFault.next();
+ assertEquals("SOAP Fault code local name mismatch",
+ code.getLocalName(),
+ (SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- Fault code namespace uri mismatch",
+ code.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertEquals("SOAP 1.1 :- Fault code value mismatch", code.getValue().getText().trim(),
+ "env:Sender");
+
+ iteratorInFault.next();
+ reason = (SOAPFaultReason) iteratorInFault.next();
+ assertTrue("SOAP 1.1 :- Fault string local name mismatch",
+ reason.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+ assertTrue("SOAP 1.2 :- Fault string namespace uri mismatch",
+ reason.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.1 :- Fault string value mismatch",
+ reason.getSOAPText().getText().trim().equals("Sender Timeout"));
+
+ iteratorInFault.next();
+ role = (SOAPFaultRole) iteratorInFault.next();
+ assertTrue("SOAP 1.1 :- Fault actor local name mismatch",
+ role.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- Fault actor namespace uri mismatch",
+ role.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.1 :- Actor value mismatch",
+ role.getText().trim().equals(
+ "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));
+
+ iteratorInFault.next();
+ detail = (SOAPFaultDetail) iteratorInFault.next();
+ assertTrue("SOAP 1.1 :- Fault detail local name mismatch",
+ detail.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+ assertTrue("SOAP 1.1 :- Fault detail namespace uri mismatch",
+ detail.getNamespace().getName().equals(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+ assertTrue("SOAP 1.2 :- Text in detail mismatch",
+ detail.getText().trim().equals("Details of error"));
+
+ iteratorInDetail = detail.getChildren();
+
+ iteratorInDetail.next();
+ element1 = (OMElement) iteratorInDetail.next();
+ assertTrue("SOAP 1.1 :- MaxTime element mismatch",
+ element1.getLocalName().equals("MaxTime"));
+ assertTrue("SOAP 1.1 :- MaxTime element namespace mismatch",
+ element1.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.1 :- Text value in MaxTime element mismatch",
+ element1.getText().trim().equals("P5M"));
+
+ attributeIterator = element1.getAttributes();
+ attributeInMaxTime = (OMAttribute) attributeIterator.next();
+ assertTrue("SOAP 1.1 :- Attribute local name mismatch",
+ attributeInMaxTime.getLocalName().equals("detail"));
+ assertTrue("SOAP 1.1 :- Attribute namespace mismatch",
+ attributeInMaxTime.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.1 :- Attribute value mismatch",
+ attributeInMaxTime.getValue().equals("This is only a test"));
+
+ iteratorInDetail.next();
+ element2 = (OMElement) iteratorInDetail.next();
+ assertTrue("SOAP 1.1 :- AveTime element mismatch",
+ element2.getLocalName().equals("AveTime"));
+ assertTrue("SOAP 1.1 :- AveTime element namespace mismatch",
+ element2.getNamespace().getName().equals(
+ "http:www.sample.org"));
+
+ iteratorInAveTimeElement = element2.getChildren();
+
+ iteratorInAveTimeElement.next();
+ element21 = (OMElement) iteratorInAveTimeElement.next();
+ assertTrue("SOAP 1.1 :- Time element mismatch",
+ element21.getLocalName().equals("Time"));
+ assertTrue("SOAP 1.1 :- Time element namespace mismatch",
+ element21.getNamespace().getName().equals(
+ "http:www.sample.org"));
+ assertTrue("SOAP 1.1 :- Text value in Time element mismatch",
+ element21.getText().trim().equals("P3M"));
+
+ iteratorInFault.next();
+ OMElement testElement = (OMElement) iteratorInFault.next();
+ assertTrue("SOAP 1.1 :- Test element mismatch",
+ testElement.getLocalName().equals("Test"));
+ assertTrue("SOAP 1.1 :- Test element namespace mismatch",
+ testElement.getNamespace().getName().equals(
+ "http:www.Test.org"));
+
+ OMElement childOfTestElement = testElement.getFirstElement();
+ assertTrue("SOAP 1.1 :- Test element child local name mismatch",
+ childOfTestElement.getLocalName().equals("TestElement"));
+ assertTrue("SOAP 1.1 :- Test element child namespace mismatch",
+ childOfTestElement.getNamespace().getName().equals(
+ "http:www.Test.org"));
+ assertTrue("SOAP 1.1 :- Test element child value mismatch",
+ childOfTestElement.getText().trim().equals("This is only a test"));
+
+ } catch (XMLStreamException e) {
+ log.info(e.getMessage());
+ fail("Test failed. Reason -> " + e.getMessage());
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ fail("Test failed. Reason -> " + e.getMessage());
+
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/soap11/SOAP11SerializerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/project.xml?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/project.xml (original)
+++ webservices/axis2/trunk/java/project.xml Thu Sep 15 11:52:11 2005
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Copyright 2001-2004 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.
- */
- -->
-<project>
- <pomVersion>3</pomVersion>
- <extend>etc/project.xml</extend>
- <id>axis2</id>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 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.
+ */
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>etc/project.xml</extend>
+ <id>axis2</id>
+</project>
Propchange: webservices/axis2/trunk/java/project.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/xdocs/navigation.xml
------------------------------------------------------------------------------
svn:eol-style = native