You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/03/15 00:27:50 UTC
svn commit: r637302 - in /webservices/axis2/trunk/java/modules: jaxws/
jaxws/test-resources/ jaxws/test/org/apache/axis2/jaxws/client/
jaxws/test/org/apache/axis2/jaxws/client/dispatch/
jaxws/test/org/apache/axis2/jaxws/client/proxy/ metadata/ metadata...
Author: pradine
Date: Fri Mar 14 16:27:48 2008
New Revision: 637302
URL: http://svn.apache.org/viewvc?rev=637302&view=rev
Log:
Some unittests relating to AXIS2-3572.
Added:
webservices/axis2/trunk/java/modules/jaxws/build.xml (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java (with props)
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java (with props)
webservices/axis2/trunk/java/modules/metadata/build.xml (with props)
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java (with props)
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java (with props)
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java (with props)
Modified:
webservices/axis2/trunk/java/modules/jaxws/pom.xml
webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java
webservices/axis2/trunk/java/modules/metadata/pom.xml
Added: webservices/axis2/trunk/java/modules/jaxws/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/build.xml?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/build.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/build.xml Fri Mar 14 16:27:48 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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 name="itest" default="build-repo" basedir=".">
+
+ <target name="build-repo" unless="test.skip">
+
+ <!-- Standard repository -->
+ <mkdir dir="target/repository"/>
+ <mkdir dir="target/repository/conf"/>
+ <mkdir dir="target/repository/services"/>
+ <mkdir dir="target/repository/modules"/>
+ <copy file="../addressing/target/addressing-${addressing_version}.mar"
+ tofile="target/repository/modules/addressing-${addressing_version}.mar"/>
+ <copy file="../kernel/conf/axis2.xml"
+ tofile="target/repository/conf/axis2.xml"/>
+
+ </target>
+
+</project>
Propchange: webservices/axis2/trunk/java/modules/jaxws/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/pom.xml?rev=637302&r1=637301&r2=637302&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/pom.xml Fri Mar 14 16:27:48 2008
@@ -232,6 +232,9 @@
<include name="**/axis2.xml"/>
</fileset>
</copy>
+ <property name="addressing_version" value="${version}"/>
+ <ant antfile="build.xml" inheritall="true" inheritrefs="true"
+ dir="." target="build-repo"/>
</tasks>
</configuration>
<goals>
@@ -300,6 +303,10 @@
<property>
<name>org.apache.axis2.jaxws.config.path</name>
<value>./target/test-classes/axis2.xml</value>
+ </property>
+ <property>
+ <name>org.apache.axis2.jaxws.repo.path</name>
+ <value>./target/repository</value>
</property>
</systemProperties>
</configuration>
Modified: webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml?rev=637302&r1=637301&r2=637302&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/axis2.xml Fri Mar 14 16:27:48 2008
@@ -180,6 +180,12 @@
<order phase="Transport"/>
</handler>
</phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
@@ -193,10 +199,6 @@
<order phase="Dispatch"/>
</handler>
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
<order phase="Dispatch"/>
@@ -247,6 +249,12 @@
<phase name="Security"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
@@ -259,10 +267,6 @@
<order phase="Dispatch"/>
</handler>
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher">
<order phase="Dispatch"/>
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java?rev=637302&r1=637301&r2=637302&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java Fri Mar 14 16:27:48 2008
@@ -20,15 +20,14 @@
import org.apache.axis2.jaxws.core.controller.InvocationControllerFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
-
-import junit.framework.TestCase;
+import org.custommonkey.xmlunit.XMLTestCase;
/**
* This TestCase can be extended to write JAX-WS client side unit tests without
* having to have an end-to-end test. The <source>TestClientInvocationController</source>
* will be used to capture the request.
*/
-public class InterceptableClientTestCase extends TestCase {
+public class InterceptableClientTestCase extends XMLTestCase {
private InvocationControllerFactory oldFactory;
private TestClientInvocationControllerFactory newFactory;
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.client.dispatch;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.AddressingConstants.Final;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReferenceBuilder;
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+/**
+ * This suite of tests is for the AddressingFeature configuration that can
+ * be used on Dispatch clients.
+ */
+public class DispatchAddressingFeatureTest extends InterceptableClientTestCase {
+ private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
+ private static final QName ELEMENT200508 =
+ new QName(Final.WSA_NAMESPACE, "EndpointReference", "wsa");
+
+ private W3CEndpointReference w3cEPR;
+ private SubmissionEndpointReference subEPR;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ W3CEndpointReferenceBuilder w3cBuilder = new W3CEndpointReferenceBuilder();
+ w3cBuilder = w3cBuilder.address("http://somewhere.com/somehow");
+ w3cBuilder = w3cBuilder.serviceName(new QName("http://test", "TestService"));
+ w3cBuilder = w3cBuilder.endpointName(new QName("http://test", "TestPort"));
+ w3cEPR = w3cBuilder.build();
+
+ SubmissionEndpointReferenceBuilder subBuilder = new SubmissionEndpointReferenceBuilder();
+ subBuilder = subBuilder.address("http://somewhere.com/somehow");
+ subBuilder = subBuilder.serviceName(new QName("http://test", "TestService"));
+ subBuilder = subBuilder.endpointName(new QName("http://test", "TestPort"));
+ subEPR = subBuilder.build();
+ }
+
+ /*
+ * Make sure Addressing is not enabled by default.
+ */
+ public void testNoAddressingFeature() {
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(w3cEPR, Source.class, Service.Mode.PAYLOAD);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertNull(version);
+ assertNull(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the AddressingFeature.
+ */
+ public void testDefaultAddressingFeature() throws Exception {
+ // Use the default feature config
+ AddressingFeature feature = new AddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(w3cEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200508, Final.WSA_NAMESPACE);
+ assertXMLEqual(w3cEPR.toString(), omElement.toString());
+ }
+
+ /*
+ * Test disabling the Addressing feature.
+ */
+ public void testDisabledAddressingFeature() {
+ // Set the feature to be disabled.
+ AddressingFeature feature = new AddressingFeature(false);
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(w3cEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertTrue(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ // Test configurations that are not allowed with the AddressingFeature
+ public void testInvalidAddressingFeature() {
+ // Use the default feature config
+ AddressingFeature feature = new AddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(subEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ try {
+ d.invoke(null);
+ fail("An exception should have been thrown");
+ }
+ catch (WebServiceException wse) {
+ //pass
+ }
+ catch (Exception e) {
+ fail("The wrong exception type was thrown.");
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.client.dispatch;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.AddressingConstants.Submission;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReferenceBuilder;
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+/**
+ * This suite of tests is for the SubmissionAddressingFeature configuration that can
+ * be used on Dispatch clients.
+ */
+public class DispatchSubmissionAddressingFeatureTest extends InterceptableClientTestCase {
+ private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
+ private static final QName ELEMENT200408 =
+ new QName(Submission.WSA_NAMESPACE, "EndpointReference", "wsa");
+
+ private W3CEndpointReference w3cEPR;
+ private SubmissionEndpointReference subEPR;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ W3CEndpointReferenceBuilder w3cBuilder = new W3CEndpointReferenceBuilder();
+ w3cBuilder = w3cBuilder.address("http://somewhere.com/somehow");
+ w3cBuilder = w3cBuilder.serviceName(new QName("http://test", "TestService"));
+ w3cBuilder = w3cBuilder.endpointName(new QName("http://test", "TestPort"));
+ w3cEPR = w3cBuilder.build();
+
+ SubmissionEndpointReferenceBuilder subBuilder = new SubmissionEndpointReferenceBuilder();
+ subBuilder = subBuilder.address("http://somewhere.com/somehow");
+ subBuilder = subBuilder.serviceName(new QName("http://test", "TestService"));
+ subBuilder = subBuilder.endpointName(new QName("http://test", "TestPort"));
+ subEPR = subBuilder.build();
+ }
+
+ /*
+ * Make sure SubmissionAddressing is not enabled by default.
+ */
+ public void testNoSubmissionAddressingFeature() {
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(subEPR, Source.class, Service.Mode.PAYLOAD);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertNull(version);
+ assertNull(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the SubmissionAddressingFeature.
+ */
+ public void testDefaultSubmissionAddressingFeature() throws Exception {
+ // Use the default feature config
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(subEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200408, Submission.WSA_NAMESPACE);
+ assertXMLEqual(subEPR.toString(), omElement.toString());
+ }
+
+ /*
+ * Test disabling the SubmissionAddressing feature.
+ */
+ public void testDisabledSubmissionAddressingFeature() {
+ // Set the feature to be disabled.
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature(false);
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(subEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertTrue(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ // Test configurations that are not allowed with the SubmissionAddressingFeature
+ public void testInvalidSubmissionAddressingFeature() {
+ // Use the default feature config
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(w3cEPR, Source.class, Service.Mode.PAYLOAD, feature);
+
+ try {
+ d.invoke(null);
+ fail("An exception should have been thrown");
+ }
+ catch (WebServiceException wse) {
+ //pass
+ }
+ catch (Exception e) {
+ fail("The wrong exception type was thrown.");
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.client.proxy;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.AddressingConstants.Final;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReferenceBuilder;
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+/**
+ * This suite of tests is for the AddressingFeature configuration that can
+ * be used on Proxy clients.
+ */
+public class ProxyAddressingFeatureTest extends InterceptableClientTestCase {
+ private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
+ private static final QName ELEMENT200508 =
+ new QName(Final.WSA_NAMESPACE, "EndpointReference", "wsa");
+
+ private W3CEndpointReference w3cEPR;
+ private SubmissionEndpointReference subEPR;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ W3CEndpointReferenceBuilder w3cBuilder = new W3CEndpointReferenceBuilder();
+ w3cBuilder = w3cBuilder.address("http://somewhere.com/somehow");
+ w3cBuilder = w3cBuilder.serviceName(new QName("http://test", "ProxyAddressingService"));
+ w3cBuilder = w3cBuilder.endpointName(new QName("http://test", "TestPort"));
+ w3cEPR = w3cBuilder.build();
+
+ SubmissionEndpointReferenceBuilder subBuilder = new SubmissionEndpointReferenceBuilder();
+ subBuilder = subBuilder.address("http://somewhere.com/somehow");
+ subBuilder = subBuilder.serviceName(new QName("http://test", "ProxyAddressingService"));
+ subBuilder = subBuilder.endpointName(new QName("http://test", "TestPort"));
+ subEPR = subBuilder.build();
+ }
+
+ /*
+ * Make sure Addressing is not enabled by default.
+ */
+ public void testNoAddressingFeature() {
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(ProxyAddressingService.class);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertNull(version);
+ assertNull(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the AddressingFeature.
+ */
+ public void testDefaultAddressingFeature() throws Exception {
+ // Use the default feature config
+ AddressingFeature feature = new AddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(w3cEPR, ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200508, Final.WSA_NAMESPACE);
+ assertXMLEqual(w3cEPR.toString(), omElement.toString());
+ }
+
+ /*
+ * Test disabling the Addressing feature.
+ */
+ public void testDisabledAddressingFeature() {
+ // Use the default feature config
+ AddressingFeature feature = new AddressingFeature(false);
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(w3cEPR, ProxyAddressingService.class, feature);
+ assertTrue("Proxy instance was null", proxy != null);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertTrue(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the AddressingFeature.
+ */
+ public void testInvalidAddressingFeature() {
+ // Use the default feature config
+ AddressingFeature feature = new AddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(subEPR, ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ try {
+ proxy.doSomething("12345");
+ fail("An exception should have been thrown");
+ }
+ catch (WebServiceException wse) {
+ //pass
+ }
+ catch (Exception e) {
+ fail("The wrong exception type was thrown.");
+ }
+ }
+
+ @WebService()
+ public interface ProxyAddressingService {
+
+ public String doSomething(String id);
+
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.client.proxy;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.AddressingConstants.Submission;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
+import org.apache.axis2.jaxws.addressing.SubmissionEndpointReferenceBuilder;
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+/**
+ * This suite of tests is for the SubmissionAddressingFeature configuration that can
+ * be used on Proxy clients.
+ */
+public class ProxySubmissionAddressingFeatureTest extends InterceptableClientTestCase {
+ private static final OMFactory OMF = OMAbstractFactory.getOMFactory();
+ private static final QName ELEMENT200408 =
+ new QName(Submission.WSA_NAMESPACE, "EndpointReference", "wsa");
+
+ private W3CEndpointReference w3cEPR;
+ private SubmissionEndpointReference subEPR;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder = builder.address("http://somewhere.com/somehow");
+ builder = builder.serviceName(new QName("http://test", "ProxyAddressingService"));
+ builder = builder.endpointName(new QName("http://test", "TestPort"));
+ w3cEPR = builder.build();
+
+ SubmissionEndpointReferenceBuilder subBuilder = new SubmissionEndpointReferenceBuilder();
+ subBuilder = subBuilder.address("http://somewhere.com/somehow");
+ subBuilder = subBuilder.serviceName(new QName("http://test", "ProxyAddressingService"));
+ subBuilder = subBuilder.endpointName(new QName("http://test", "TestPort"));
+ subEPR = subBuilder.build();
+ }
+
+ /*
+ * Make sure SubmissionAddressing is not enabled by default.
+ */
+ public void testNoSubmissionAddressingFeature() {
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(ProxyAddressingService.class);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertNull(version);
+ assertNull(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the SubmissionAddressingFeature.
+ */
+ public void testDefaultSubmissionAddressingFeature() throws Exception {
+ // Use the default feature config
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(subEPR, ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200408, Submission.WSA_NAMESPACE);
+ assertXMLEqual(subEPR.toString(), omElement.toString());
+ }
+
+ /*
+ * Test disabling the SubmissionAddressing feature.
+ */
+ public void testDisabledSubmissionAddressingFeature() {
+ // Use the default feature config
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature(false);
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(subEPR, ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController = getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertTrue(disabled);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ assertNull(epr);
+ }
+
+ /*
+ * Test the default configuration of the SubmissionAddressingFeature.
+ */
+ public void testInvalidSubmissionAddressingFeature() {
+ // Use the default feature config
+ SubmissionAddressingFeature feature = new SubmissionAddressingFeature();
+
+ Service svc = Service.create(new QName("http://test", "ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(w3cEPR, ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ try {
+ proxy.doSomething("12345");
+ fail("An exception should have been thrown");
+ }
+ catch (WebServiceException wse) {
+ //pass
+ }
+ catch (Exception e) {
+ fail("The wrong exception type was thrown.");
+ }
+ }
+
+ @WebService()
+ public interface ProxyAddressingService {
+
+ public String doSomething(String id);
+
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/metadata/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/build.xml?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/build.xml (added)
+++ webservices/axis2/trunk/java/modules/metadata/build.xml Fri Mar 14 16:27:48 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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 name="itest" default="build-repo" basedir=".">
+
+ <target name="build-repo" unless="test.skip">
+
+ <!-- Standard repository -->
+ <mkdir dir="target/repository"/>
+ <mkdir dir="target/repository/conf"/>
+ <mkdir dir="target/repository/services"/>
+ <mkdir dir="target/repository/modules"/>
+ <copy file="../addressing/target/addressing-${addressing_version}.mar"
+ tofile="target/repository/modules/addressing-${addressing_version}.mar"/>
+ <copy file="../kernel/conf/axis2.xml"
+ tofile="target/repository/conf/axis2.xml"/>
+
+ </target>
+
+</project>
Propchange: webservices/axis2/trunk/java/modules/metadata/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/metadata/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/pom.xml?rev=637302&r1=637301&r2=637302&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/metadata/pom.xml Fri Mar 14 16:27:48 2008
@@ -164,6 +164,9 @@
<include name="org/apache/axis2/jaxws/description/HandlerConfigFile.xml"/>
</fileset>
</copy>
+ <property name="addressing_version" value="${version}"/>
+ <ant antfile="build.xml" inheritall="true" inheritrefs="true"
+ dir="." target="build-repo"/>
</tasks>
</configuration>
<goals>
@@ -199,6 +202,12 @@
<includes>
<include>**/*Tests.java</include>
</includes>
+ <systemProperties>
+ <property>
+ <name>org.apache.axis2.jaxws.repo.path</name>
+ <value>./target/repository</value>
+ </property>
+ </systemProperties>
</configuration>
</plugin>
</plugins>
Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.description.feature;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.jaxws.description.DescriptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.util.Utils;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.Addressing;
+
+import junit.framework.TestCase;
+
+public class AddressingFeatureTests extends TestCase {
+
+ private static final String ns = "http://jaxws.axis2.apache.org/metadata/feature/addressing";
+
+ private static final String defaultServicePortName = "DefaultServicePort";
+ private static final String plainServicePortName = "PlainServicePort";
+ private static final String disabledServicePortName = "DisabledServicePort";
+ private static final String requiredServicePortName = "RequiredServicePort";
+
+ public void testNoAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DefaultService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, defaultServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertNull(versionParam);
+ assertNull(disabledParam);
+ assertNull(requiredParam);
+ }
+
+ public void testPlainAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(PlainService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, plainServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Final.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testDisabled() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DisabledService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, disabledServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Submission.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testRequired() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(RequiredService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, requiredServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Final.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_REQUIRED, required);
+ }
+
+ @WebService(targetNamespace=ns, portName=defaultServicePortName)
+ class DefaultService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=plainServicePortName)
+ @Addressing
+ class PlainService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=disabledServicePortName)
+ @Addressing(enabled=false)
+ class DisabledService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=requiredServicePortName)
+ @Addressing(required=true)
+ class RequiredService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/AddressingFeatureTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.description.feature;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressing;
+import org.apache.axis2.jaxws.description.DescriptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.util.Utils;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.Addressing;
+
+import junit.framework.TestCase;
+
+public class BothAddressingFeaturesTests extends TestCase {
+
+ private static final String ns = "http://jaxws.axis2.apache.org/metadata/feature/addressing";
+
+ private static final String defaultServicePortName = "DefaultServicePort";
+ private static final String plainServicePortName = "PlainServicePort";
+ private static final String disabledServicePortName = "DisabledServicePort";
+ private static final String requiredServicePortName = "RequiredServicePort";
+ private static final String mixedServicePortName = "mixedServicePort";
+
+ public void testNoAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DefaultService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, defaultServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertNull(versionParam);
+ assertNull(disabledParam);
+ assertNull(requiredParam);
+ }
+
+ public void testPlainAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(PlainService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, plainServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertNull(version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testDisabled() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DisabledService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, disabledServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertNull(version);
+ assertEquals("true", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testRequired() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(RequiredService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, requiredServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertNull(version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_REQUIRED, required);
+ }
+
+ public void testMixed() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(MixedService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, mixedServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Final.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_REQUIRED, required);
+ }
+
+ @WebService(targetNamespace=ns, portName=defaultServicePortName)
+ class DefaultService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=plainServicePortName)
+ @Addressing
+ @SubmissionAddressing
+ class PlainService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=disabledServicePortName)
+ @Addressing(enabled=false)
+ @SubmissionAddressing(enabled=false)
+ class DisabledService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=requiredServicePortName)
+ @Addressing(required=true)
+ @SubmissionAddressing(required=true)
+ class RequiredService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=mixedServicePortName)
+ @Addressing(required=true)
+ @SubmissionAddressing(enabled=false)
+ class MixedService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/BothAddressingFeaturesTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java?rev=637302&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java Fri Mar 14 16:27:48 2008
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.description.feature;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressing;
+import org.apache.axis2.jaxws.description.DescriptionFactory;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.util.Utils;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public class SubmissionAddressingFeatureTests extends TestCase {
+
+ private static final String ns = "http://jaxws.axis2.apache.org/metadata/feature/addressing";
+
+ private static final String defaultServicePortName = "DefaultServicePort";
+ private static final String plainServicePortName = "PlainServicePort";
+ private static final String disabledServicePortName = "DisabledServicePort";
+ private static final String requiredServicePortName = "RequiredServicePort";
+
+ public void testNoAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DefaultService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, defaultServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertNull(versionParam);
+ assertNull(disabledParam);
+ assertNull(requiredParam);
+ }
+
+ public void testPlainAnnotation() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(PlainService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, plainServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Submission.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testDisabled() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(DisabledService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, disabledServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Final.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_UNSPECIFIED, required);
+ }
+
+ public void testRequired() {
+ ServiceDescription sd = DescriptionFactory.createServiceDescription(RequiredService.class);
+ EndpointDescription ed = sd.getEndpointDescription(new QName(ns, requiredServicePortName));
+ assertNotNull(ed);
+
+ AxisService axisService = ed.getAxisService();
+ Parameter versionParam = axisService.getParameter(AddressingConstants.WS_ADDRESSING_VERSION);
+ Parameter disabledParam = axisService.getParameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES);
+ Parameter requiredParam = axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ String version = Utils.getParameterValue(versionParam);
+ String disabled = Utils.getParameterValue(disabledParam);
+ String required = Utils.getParameterValue(requiredParam);
+
+ assertEquals(AddressingConstants.Submission.WSA_NAMESPACE, version);
+ assertEquals("false", disabled);
+ assertEquals(AddressingConstants.ADDRESSING_REQUIRED, required);
+ }
+
+ @WebService(targetNamespace=ns, portName=defaultServicePortName)
+ class DefaultService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=plainServicePortName)
+ @SubmissionAddressing
+ class PlainService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=disabledServicePortName)
+ @SubmissionAddressing(enabled=false)
+ class DisabledService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+
+ @WebService(targetNamespace=ns, portName=requiredServicePortName)
+ @SubmissionAddressing(required=true)
+ class RequiredService {
+ public double getQuote(String symbol) {
+ return 101.01;
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/feature/SubmissionAddressingFeatureTests.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org