[jbossws-commits] JBossWS SVN: r3550 - in trunk/jbossws-core/src/test: java/org/jboss/test/ws/jaxws/wsaddressing and 2 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Tue Jun 12 08:40:14 EDT 2007
Author: heiko.braun at jboss.com
Date: 2007-06-12 08:40:13 -0400 (Tue, 12 Jun 2007)
New Revision: 3550
Removed:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/
Modified:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java
trunk/jbossws-core/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/jboss-client.xml
Log:
Fxi ws-addressing tests
Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2007-06-12 12:18:39 UTC (rev 3549)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2007-06-12 12:40:13 UTC (rev 3550)
@@ -31,105 +31,140 @@
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingException;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
import org.jboss.util.xml.DOMUtils;
import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
/**
* Test the SOAPAddressingProperties
- *
+ *
* @author Thomas.Diesler at jboss.org
* @since 13-Nov-2005
*/
-public class SOAPAddressingPropertiesTestCase extends JBossWSTest
+public class SOAPAddressingPropertiesTestCase extends JBossWSTest
{
- private SOAPAddressingProperties addrProps;
-
+ private SOAPAddressingProperties addrProps;
+
private String reqEnvStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
- + " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ + " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ " <wsa:ReplyTo>"
+ " <wsa:Address>http://business456.example/client1</wsa:Address>"
+ " <wsa:ReferenceParameters>"
+ " <ns1:sessionid xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>"
+ " </wsa:ReferenceParameters>"
+ " </wsa:ReplyTo>"
- + " <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>"
- + " <wsa:MessageID>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:MessageID>"
- + " </env:Header>"
- + " <env:Body/>"
- + "</env:Envelope>";
+ + " <wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>"
+ + " <wsa:MessageID>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:MessageID>"
+ + " </env:Header>"
+ + " <env:Body/>"
+ + "</env:Envelope>";
private String resEnvStr = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>" +
- " <wsa:To>http://business456.example/client1</wsa:To>" +
- " <wsa:Action>http://fabrikam123.example/ReplyPO</wsa:Action>" +
- " <wsa:RelatesTo>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:RelatesTo>" +
- " <ns1:sessionid wsa:IsReferenceParameter='true' xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>" +
- " </env:Header>" +
- " <env:Body/>" +
- "</env:Envelope>";
+ " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>" +
+ " <wsa:To>http://business456.example/client1</wsa:To>" +
+ " <wsa:Action>http://fabrikam123.example/ReplyPO</wsa:Action>" +
+ " <wsa:RelatesTo>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA</wsa:RelatesTo>" +
+ " <ns1:sessionid wsa:IsReferenceParameter='true' xmlns:ns1='http://somens'>someuniqueid</ns1:sessionid>" +
+ " </env:Header>" +
+ " <env:Body/>" +
+ "</env:Envelope>";
- public void setUp() throws Exception
- {
- super.setUp();
-
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
+ private String ERRORNOUS_XML = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n" +
+ " <soap:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>" +
+ "<wsa:Action></wsa:Action>\n" +
+ "<wsa:MessageID>urn:uuid:1fa5a31f-bbe7-4ad5-8b92-d765f4a32dc9</wsa:MessageID>\n" +
+ "<wsa:ReplyTo>\n" +
+ "<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>\n" +
+ "<wsa:ReferenceParameters>\n" +
+ "<ns1:clientid xmlns:ns1=\"http://somens\">clientid-1</ns1:clientid>\n" +
+ "</wsa:ReferenceParameters>\n" +
+ "</wsa:ReplyTo>\n" +
+ "<wsa:To>http://mycomp:8080/testws</wsa:To>\n" +
+ "</soap:Header>" +
+ " <soap:Body/>\n" +
+ "</soap:Envelope>";
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
- AddressingBuilder addrBuilder = SOAPAddressingBuilder.getAddressingBuilder();
- addrProps = (SOAPAddressingProperties)addrBuilder.newAddressingProperties();
- addrProps.readHeaders(soapMessage);
- }
-
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
+
+ AddressingBuilder addrBuilder = SOAPAddressingBuilder.getAddressingBuilder();
+ addrProps = (SOAPAddressingProperties)addrBuilder.newAddressingProperties();
+ addrProps.readHeaders(soapMessage);
+ }
+
public void testReadHeaders() throws Exception
- {
- assertEquals(new URI("uuid:6B29FC40-CA47-1067-B31D-00DD010662DA"), addrProps.getMessageID().getURI());
- assertEquals(new URI("http://business456.example/client1"), addrProps.getReplyTo().getAddress().getURI());
- assertEquals(new URI("http://fabrikam123.example/Purchasing"), addrProps.getTo().getURI());
- assertEquals(new URI("http://fabrikam123.example/SubmitPO"), addrProps.getAction().getURI());
- }
+ {
+ assertEquals(new URI("uuid:6B29FC40-CA47-1067-B31D-00DD010662DA"), addrProps.getMessageID().getURI());
+ assertEquals(new URI("http://business456.example/client1"), addrProps.getReplyTo().getAddress().getURI());
+ assertEquals(new URI("http://fabrikam123.example/Purchasing"), addrProps.getTo().getURI());
+ assertEquals(new URI("http://fabrikam123.example/SubmitPO"), addrProps.getAction().getURI());
+ }
- public void testWriteHeaders() throws Exception
- {
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage wasMsg = factory.createMessage();
- addrProps.writeHeaders(wasMsg);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- wasMsg.writeTo(baos);
- String wasEnv = new String(baos.toByteArray());
+ public void testWriteHeaders() throws Exception
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage wasMsg = factory.createMessage();
+ addrProps.writeHeaders(wasMsg);
- SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
- baos = new ByteArrayOutputStream();
- expMsg.writeTo(baos);
- String expEnv = new String(baos.toByteArray());
-
- assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
- }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
- public void testReplyToHeaders() throws Exception
- {
- AddressingBuilder addrBuilder = SOAPAddressingBuilder.getAddressingBuilder();
- SOAPAddressingProperties replyProps = (SOAPAddressingProperties)addrBuilder.newAddressingProperties();
- replyProps.initializeAsReply(addrProps, false);
- replyProps.setAction(addrBuilder.newURI("http://fabrikam123.example/ReplyPO"));
-
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage wasMsg = factory.createMessage();
- replyProps.writeHeaders(wasMsg);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- wasMsg.writeTo(baos);
- String wasEnv = new String(baos.toByteArray());
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
- SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
- baos = new ByteArrayOutputStream();
- expMsg.writeTo(baos);
- String expEnv = new String(baos.toByteArray());
-
- assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
- }
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
+ }
+
+ public void testReplyToHeaders() throws Exception
+ {
+ AddressingBuilder addrBuilder = SOAPAddressingBuilder.getAddressingBuilder();
+ SOAPAddressingProperties replyProps = (SOAPAddressingProperties)addrBuilder.newAddressingProperties();
+ replyProps.initializeAsReply(addrProps, false);
+ replyProps.setAction(addrBuilder.newURI("http://fabrikam123.example/ReplyPO"));
+
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage wasMsg = factory.createMessage();
+ replyProps.writeHeaders(wasMsg);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
+ }
+
+ public void testReplyToWithoutAction() throws Exception
+ {
+ MessageFactory mf = MessageFactory.newInstance();
+ SOAPMessage message = mf.createMessage(null, new ByteArrayInputStream(ERRORNOUS_XML.getBytes()));
+
+ SOAPAddressingPropertiesImpl props = new SOAPAddressingPropertiesImpl();
+ try
+ {
+ props.readHeaders(message);
+ fail("ERRORNOUS_XML should cause a parsing exception due to missing wsa:Action value");
+ }
+ catch (AddressingException e)
+ {
+ // expected an exception
+ }
+
+ }
}
Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java 2007-06-12 12:18:39 UTC (rev 3549)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/replyto/AddressingReplyToTestCase.java 2007-06-12 12:40:13 UTC (rev 3550)
@@ -100,7 +100,8 @@
/** This sends a fault message to the FaultTo endpoint and verfies whether we can read it of again.
*/
- public void testFaultToMessage() throws Exception
+
+ public void testFaultToMessage() throws Exception
{
String reqEnv =
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
@@ -141,15 +142,15 @@
public void testFaultTo() throws Exception
{
String lastFault = faultto.getLastFault();
-
+
/* JAX-WS 10.2.2.3: the fields of the fault message are populated according to
- * the following rules of precedence:
- *
+ * the following rules of precedence:
+ *
* faultstring
* 1. SOAPFaultException.getFault().getFaultString()
* 2. Exception.getMessage()
- * 3. Exception.toString()
- *
+ * 3. Exception.toString()
+ *
* this test used to expect the value returned by toString() */
assertEquals("Invalid Value", lastFault);
}
Modified: trunk/jbossws-core/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/jboss-client.xml
===================================================================
--- trunk/jbossws-core/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/jboss-client.xml 2007-06-12 12:18:39 UTC (rev 3549)
+++ trunk/jbossws-core/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/jboss-client.xml 2007-06-12 12:40:13 UTC (rev 3550)
@@ -5,8 +5,7 @@
<jboss-client>
<jndi-name>replyto-client</jndi-name>
<service-ref>
- <service-ref-name>service/ReplyToService</service-ref-name>
- <config-name>Standard WSAddressing Client</config-name>
+ <service-ref-name>service/ReplyToService</service-ref-name>
<wsdl-override>http://@jboss.bind.address@:8080/jaxws-wsaddressing-replyto/ReplyToService?wsdl</wsdl-override>
</service-ref>
</jboss-client>
More information about the jbossws-commits
mailing list