Author: richard.opalka(a)jboss.com
Date: 2010-05-12 03:13:01 -0400 (Wed, 12 May 2010)
New Revision: 12209
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/AddNumbersImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
Log:
[JBWS-2960] fixing @Addressing.responses mapping to WSDL - updated test
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/AddNumbersImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/AddNumbersImpl.java 2010-05-12
06:35:06 UTC (rev 12208)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/AddNumbersImpl.java 2010-05-12
07:13:01 UTC (rev 12209)
@@ -27,11 +27,12 @@
import javax.xml.ws.FaultAction;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.AddressingFeature;
import javax.xml.ws.soap.SOAPBinding;
@WebService(name = "AddNumbers", portName = "AddNumbersPort",
targetNamespace = "http://foobar.org/", serviceName =
"AddNumbersService")
@BindingType(value = SOAPBinding.SOAP11HTTP_BINDING)
-@Addressing
+@Addressing(responses = AddressingFeature.Responses.NON_ANONYMOUS)
public class AddNumbersImpl
{
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2010-05-12
06:35:06 UTC (rev 12208)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2010-05-12
07:13:01 UTC (rev 12209)
@@ -50,10 +50,11 @@
{
private static final QName WSAM_ACTION_QNAME = new
QName("http://www.w3.org/2007/05/addressing/metadata", "Action");
private static final QName WSAM_ADDRESSING_QNAME = new
QName("http://www.w3.org/2007/05/addressing/metadata", "Addressing");
+ private static final QName WSAM_NON_ANONYMOUS_RESPONSES_QNAME = new
QName("http://www.w3.org/2007/05/addressing/metadata",
"NonAnonymousResponses");
private static final QName POLICY_QNAME = new
QName("http://www.w3.org/ns/ws-policy", "Policy");
private static final QName POLICY_REFERENCE_QNAME = new
QName("http://www.w3.org/ns/ws-policy", "PolicyReference");
private URL wsdlFile;
-
+
public static Test suite()
{
return new JBossWSTestSetup(JBWS2960TestCase.class,
"jaxws-jbws2960.war");
@@ -64,7 +65,7 @@
wsdlFile = new URL("http://" + getServerHost() +
":8080/jaxws-jbws2960/Endpoint?wsdl");
assertNotNull("WSDL not found", wsdlFile);
}
-
+
/*
<definitions
targetNamespace="http://foobar.org/"
@@ -76,7 +77,9 @@
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-w...
<wsp:Policy wsu:Id="GENERATED_ID">
<wsam:Addressing wsp:Optional="true">
- <wsp:Policy/>
+ <wsp:Policy>
+ <wsam:NonAnonymousResponses/>
+ </wsp:Policy>
</wsam:Addressing>
</wsp:Policy>
...
@@ -104,8 +107,12 @@
assertNotNull("Addressing element not found", addressingElement);
String optionalAttributeValue =
addressingElement.getAttributeNS("http://www.w3.org/ns/ws-policy",
"Optional");
assertEquals("Addressing should be optional", "true",
optionalAttributeValue);
+ Element nestedPolicyElement = DOMUtils.getFirstChildElement(addressingElement,
POLICY_QNAME);
+ assertNotNull("Nested Policy element not found", nestedPolicyElement);
+ Element nonAnonymousResponsesElement =
DOMUtils.getFirstChildElement(nestedPolicyElement, WSAM_NON_ANONYMOUS_RESPONSES_QNAME);
+ assertNotNull("NonAnonymousResponses element not found",
nonAnonymousResponsesElement);
}
-
+
public void testOperations() throws Exception
{
Definition wsdl = getWSDLDefinition(wsdlFile);
@@ -196,16 +203,16 @@
this.assertFault(operation,
"http://foobar.org/AddNumbers/addNumbersFault7/Fault/AddNumbersException",
"AddNumbersException");
this.assertFault(operation,
"http://foobar.org/AddNumbers/addNumbersFault7/Fault/TooBigNumbersException",
"TooBigNumbersException");
}
-
+
private Operation getOperation(final PortType port, final String operationName)
{
return port.getOperation(operationName, null, null);
}
-
+
private void assertInput(final Operation operation, final String expectedValue)
{
QName wsamValue =
(QName)operation.getInput().getExtensionAttribute(WSAM_ACTION_QNAME);
-
+
log.debug("Validating input of operation " + operation.getName());
Assert.assertNotNull("No WSAM attr", wsamValue);
Assert.assertEquals("Wrong WSAM attr. value", expectedValue,
wsamValue.getLocalPart());
@@ -214,7 +221,7 @@
private void assertOutput(final Operation operation, final String expectedValue)
{
QName wsamValue =
(QName)operation.getOutput().getExtensionAttribute(WSAM_ACTION_QNAME);
-
+
log.debug("Validating output of operation " + operation.getName());
Assert.assertNotNull("No WSAM attr", wsamValue);
Assert.assertEquals("Wrong WSAM attr. value", expectedValue,
wsamValue.getLocalPart());
@@ -223,7 +230,7 @@
private void assertFault(final Operation operation, final String expectedValue, final
String faultName)
{
QName wsamValue =
(QName)operation.getFault(faultName).getExtensionAttribute(WSAM_ACTION_QNAME);
-
+
log.debug("Validating fault '" + faultName + "' of operation
" + operation.getName());
Assert.assertNotNull("No WSAM attr", wsamValue);
Assert.assertEquals("Wrong WSAM attr. value", expectedValue,
wsamValue.getLocalPart());
@@ -236,13 +243,13 @@
return wsdlReader.readWSDL(null, wsdlLocation.toURI().toString());
}
-
+
@SuppressWarnings("unchecked")
private Element getRequiredElement(final List extElements, final QName elementQName)
{
assertNotNull("No extensibility elements found", extElements);
assertTrue("No extensibility elements found", extElements.size() >
0);
-
+
Element retVal = null;
for (int i = 0; i < extElements.size(); i++)
{
@@ -252,7 +259,7 @@
Element candidate =
((UnknownExtensibilityElement)extElements.get(i)).getElement();
boolean namespaceMatch =
candidate.getNamespaceURI().equals(elementQName.getNamespaceURI());
boolean nameMatch =
candidate.getLocalName().equals(elementQName.getLocalPart());
-
+
if (namespaceMatch && nameMatch)
{
retVal = candidate;
@@ -260,7 +267,7 @@
}
}
}
-
+
assertNotNull("Required element '" + elementQName + " ' not
found", retVal);
return retVal;
}