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 ba...@apache.org on 2006/10/27 16:46:56 UTC
svn commit: r468396 [2/2] - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/description/
src/org/apache/axis2/jaxws/description/builder/
test/org/apache/axis2/jaxws/description/
test/org/apache/axis2/jaxws/description/builder...
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java?view=diff&rev=468396&r1=468395&r2=468396
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java Fri Oct 27 07:46:55 2006
@@ -21,8 +21,15 @@
import java.lang.reflect.Field;
import java.net.URL;
+import javax.jws.WebParam.Mode;
import javax.xml.ws.Service;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
+import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
+import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
+import org.apache.axis2.jaxws.description.builder.WebParamAnnot;
+import org.apache.axis2.jaxws.description.builder.WebServiceAnnot;
import org.apache.axis2.jaxws.spi.ServiceDelegate;
/**
@@ -69,5 +76,66 @@
return returnServiceDelegate;
}
-
+ static public DescriptionBuilderComposite buildDBCNoEndpointInterface() {
+
+ //Create a WebServiceAnnot
+ String WSName = "EchoServiceAnnotated";
+ String WSTargetNamespace = "http://description.jaxws.axis2.apache.org/";
+ String WSServiceName = "EchoServiceName";
+ //String WSWsdlLocation = "http://EchoService/wsdl";
+ String WSWsdlLocation = "";
+ String WSEndpointInterface = "";
+ String WSPortName = "EchoServiceAnnotatedPort";
+
+ WebServiceAnnot webServiceAnnot =
+ WebServiceAnnot.createWebServiceAnnotImpl(
+ WSName,
+ WSTargetNamespace,
+ WSServiceName,
+ WSWsdlLocation,
+ WSEndpointInterface,
+ WSPortName);
+
+ //Create a WebMethodAnnot
+ String operationName = "echoStringMethod";
+ String action = "urn:EchoStringMethod";
+ boolean exclude = false;
+
+ WebMethodAnnot webMethodAnnot = WebMethodAnnot.createWebMethodAnnotImpl();
+ webMethodAnnot.setOperationName(operationName);
+ webMethodAnnot.setAction(action);
+ webMethodAnnot.setExclude(exclude);
+
+ //Create the WebParamAnnot
+ String WPName = "arg0";
+ String WPPartName = "sku";
+ String WPTargetNamespace = "http://description.jaxws.axis2.apache.org/";
+ Mode WPMode = Mode.IN;
+ boolean WPHeader = true;
+
+ WebParamAnnot webParamAnnot = WebParamAnnot.createWebParamAnnotImpl();
+ webParamAnnot.setName(WPName);
+ webParamAnnot.setPartName(WPPartName);
+ webParamAnnot.setMode(WPMode);
+ webParamAnnot.setTargetNamespace(WPTargetNamespace);
+ webParamAnnot.setHeader(WPHeader);
+
+ //Build up the the DBC and all necessary composites
+ ParameterDescriptionComposite pdc = new ParameterDescriptionComposite();
+ pdc.setParameterType("java.lang.String");
+ pdc.setWebParamAnnot(webParamAnnot);
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setWebMethodAnnot(webMethodAnnot);
+ mdc.setMethodName(operationName);
+ mdc.addParameterDescriptionComposite(pdc,0);
+
+ DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
+ dbc.setClassName("org.apache.axis2.samples.EchoServiceAnnotated");
+ dbc.setWebServiceAnnot(webServiceAnnot);
+ dbc.addMethodDescriptionComposite(mdc);
+
+ return dbc;
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java?view=diff&rev=468396&r1=468395&r2=468396
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java Fri Oct 27 07:46:55 2006
@@ -18,6 +18,9 @@
package org.apache.axis2.jaxws.description.builder;
+import javax.jws.WebParam.Mode;
+import javax.xml.ws.WebServiceException;
+
import junit.framework.TestCase;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
@@ -37,9 +40,9 @@
* ServiceDescription Tests
* ========================================================================
*/
- public void testCreateWebServiceInputImpl() {
+ public void testCreateWebServiceAnnot() {
String name = "EchoServiceAnnotated";
- String targetNamespace = "echoTargetNamespace";
+ String targetNamespace = "http://description.jaxws.axis2.apache.org/";
String serviceName = "EchoServiceName";
String wsdlLocation = "http://EchoService/wsdl";
String endpointInterface = "EchoServiceEndpointInterface";
@@ -49,8 +52,7 @@
WebServiceAnnot.createWebServiceAnnotImpl();
WebServiceAnnot webServiceAnnotImpl2 =
- WebServiceAnnot.createWebServiceAnnotImpl(
- name,
+ WebServiceAnnot.createWebServiceAnnotImpl( name,
targetNamespace,
serviceName,
wsdlLocation,
@@ -67,12 +69,128 @@
descriptionBuilderComposite.getWebServiceAnnot();
assertNotNull("WebService name not set", webServiceAnnotImpl3.name());
- assertNotNull("WebService targetNamespace not set", webServiceAnnotImpl3.name());
- assertNotNull("WebService serviceName not set", webServiceAnnotImpl3.name());
- assertNotNull("WebService wsdlLocation not set", webServiceAnnotImpl3.name());
- assertNotNull("WebService endpointInterface not set", webServiceAnnotImpl3.name());
+ assertNotNull("WebService targetNamespace not set", webServiceAnnotImpl3.targetNamespace());
+ assertNotNull("WebService serviceName not set", webServiceAnnotImpl3.serviceName());
+ assertNotNull("WebService wsdlLocation not set", webServiceAnnotImpl3.wsdlLocation());
+ assertNotNull("WebService endpointInterface not set", webServiceAnnotImpl3.endpointInterface());
System.out.println("WebService name:" +webServiceAnnotImpl3.name());
+ }
+
+ public void testCreateWebServiceProviderAnnot() {
+ String name = "EchoServiceAnnotated";
+ String targetNamespace = "http://description.jaxws.axis2.apache.org/";
+ String serviceName = "EchoServiceName";
+ String wsdlLocation = "http://EchoService/wsdl";
+ String endpointInterface = "EchoServiceEndpointInterface";
+ String portName = "EchoServiceAnnotatedPort";
+
+ WebServiceProviderAnnot webServiceProviderAnnot = WebServiceProviderAnnot.createWebServiceAnnotImpl();
+
+ webServiceProviderAnnot.setPortName(portName);
+ webServiceProviderAnnot.setServiceName(serviceName);
+ webServiceProviderAnnot.setTargetNamespace(targetNamespace);
+ webServiceProviderAnnot.setWsdlLocation(wsdlLocation);
+
+ DescriptionBuilderComposite descriptionBuilderComposite =
+ new DescriptionBuilderComposite();
+
+ descriptionBuilderComposite.setWebServiceProviderAnnot(webServiceProviderAnnot);
+
+
+ WebServiceProviderAnnot webServiceProviderAnnot3 =
+ descriptionBuilderComposite.getWebServiceProviderAnnot();
+
+ assertEquals("WebServiceProvider port name not set properly", webServiceProviderAnnot3.portName(), portName);
+ assertEquals("WebServiceProvider targetNamespace not set properly", webServiceProviderAnnot3.targetNamespace(), targetNamespace);
+ assertEquals("WebServiceProvider serviceName not set properly", webServiceProviderAnnot3.serviceName(), serviceName);
+ assertEquals("WebServiceProvider wsdlLocation not set properly", webServiceProviderAnnot3.wsdlLocation(), wsdlLocation);
+ System.out.println("WebService name:" +webServiceProviderAnnot3.portName());
+ }
+
+ public void testCreateWebMethodAnnot() {
+ String operationName = "echoStringMethod";
+ String action = "urn:EchoStringMethod";
+ boolean exclude = true;
+
+
+ WebMethodAnnot webMethodAnnot = WebMethodAnnot.createWebMethodAnnotImpl();
+
+ webMethodAnnot.setOperationName(operationName);
+ webMethodAnnot.setAction(action);
+ webMethodAnnot.setExclude(exclude);
+
+ DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+
+ mdc.setWebMethodAnnot(webMethodAnnot);
+ mdc.setMethodName(operationName);
+ dbc.addMethodDescriptionComposite(mdc);
+
+ WebMethodAnnot webMethodAnnot3 = dbc.getMethodDescriptionComposite(operationName,1).getWebMethodAnnot();
+
+ assertEquals("WebMethod operation name not set properly", webMethodAnnot3.operationName(), operationName);
+ assertEquals("WebMethod action not set properly", webMethodAnnot3.action(), action);
+ assertEquals("WebMethod exclude flag not set properly", webMethodAnnot3.exclude(), exclude);
+ }
+
+ public void testCreateWebParamAnnot() {
+
+ String name = "arg0";
+ String partName = "sku";
+ String targetNamespace = "http://description.jaxws.axis2.apache.org/";
+ Mode mode = Mode.IN;
+ boolean header = true;
+
+ WebParamAnnot webParamAnnot = WebParamAnnot.createWebParamAnnotImpl();
+
+ webParamAnnot.setName(name);
+ webParamAnnot.setPartName(partName);
+ webParamAnnot.setMode(mode);
+ webParamAnnot.setTargetNamespace(targetNamespace);
+ webParamAnnot.setHeader(header);
+
+ DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
+
+ ParameterDescriptionComposite pdc = new ParameterDescriptionComposite();
+ pdc.setWebParamAnnot(webParamAnnot);
+ pdc.setParameterType("int");
+
+ MethodDescriptionComposite mdc = new MethodDescriptionComposite();
+ mdc.setMethodName("TestMethod1");
+
+ try {
+ //First test adds this pdc out of bounds
+ mdc.addParameterDescriptionComposite(pdc,1);
+ } catch (IndexOutOfBoundsException e) {
+ // Expected flow
+ }
+ catch (Exception e) {
+ fail("Caught unexpected exception" + e);
+ }
+
+ try {
+ //Now, add it at the proper position
+ mdc.addParameterDescriptionComposite(pdc,0);
+ } catch (IndexOutOfBoundsException e) {
+ // Expected flow
+ }
+ catch (Exception e) {
+ fail("Caught unexpected exception" + e);
+ }
+
+ dbc.addMethodDescriptionComposite(mdc);
+
+ WebParamAnnot webParamAnnot3 =
+ dbc.getMethodDescriptionComposite("TestMethod1", 1).getParameterDescriptionComposite(0).getWebParamAnnot();
+
+ assertEquals("WebMethod name not set properly", webParamAnnot3.name(), name);
+ assertEquals("WebMethod PartName not set properly", webParamAnnot3.partName(), partName);
+ assertEquals("WebMethod Mode flag not set properly", webParamAnnot3.mode(), mode);
+ assertEquals("WebMethod Target Namespace not set properly", webParamAnnot3.targetNamespace(), targetNamespace);
+ assertEquals("WebMethod Header not set properly", webParamAnnot3.header(), header);
+
+ assertEquals("Unable to convert string to parameterTypeClass", pdc.getParameterTypeClass().getName(), "int");
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=468396&r1=468395&r2=468396
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Fri Oct 27 07:46:55 2006
@@ -26,6 +26,7 @@
import org.apache.axis2.jaxws.description.AnnotationDescriptionTests;
import org.apache.axis2.jaxws.description.AnnotationProviderImplDescriptionTests;
import org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests;
+import org.apache.axis2.jaxws.description.AnnotationServiceImplWithDBCTests;
import org.apache.axis2.jaxws.description.ServiceAnnotationTests;
import org.apache.axis2.jaxws.description.ServiceDescriptionTests;
import org.apache.axis2.jaxws.description.WSDLDescriptionTests;
@@ -36,17 +37,21 @@
import org.apache.axis2.jaxws.handler.HandlerChainProcessorTests;
import org.apache.axis2.jaxws.i18n.JaxwsMessageBundleTests;
import org.apache.axis2.jaxws.message.BlockTests;
-import org.apache.axis2.jaxws.message.MessageTests;
import org.apache.axis2.jaxws.message.FaultTests;
+import org.apache.axis2.jaxws.message.MessageTests;
import org.apache.axis2.jaxws.message.SAAJConverterTests;
import org.apache.axis2.jaxws.message.SOAP12Tests;
import org.apache.axis2.jaxws.message.XMLStreamReaderSplitterTests;
import org.apache.axis2.jaxws.nonanonymous.complextype.NonAnonymousComplexTypeTests;
-import org.apache.axis2.jaxws.provider.*;
+import org.apache.axis2.jaxws.provider.JAXBProviderTests;
+import org.apache.axis2.jaxws.provider.SoapMessageProviderTests;
+import org.apache.axis2.jaxws.provider.SourceMessageProviderTests;
+import org.apache.axis2.jaxws.provider.SourceProviderTests;
+import org.apache.axis2.jaxws.provider.StringMessageProviderTests;
+import org.apache.axis2.jaxws.provider.StringProviderTests;
import org.apache.axis2.jaxws.sample.AddNumbersTests;
-import org.apache.axis2.jaxws.sample.FaultyWebServiceTests;
import org.apache.axis2.jaxws.sample.AddressBookTests;
-import org.apache.axis2.jaxws.sample.BareTests;
+import org.apache.axis2.jaxws.sample.FaultyWebServiceTests;
import org.apache.axis2.jaxws.sample.MtomSampleTests;
import org.apache.axis2.jaxws.sample.NonWrapTests;
import org.apache.axis2.jaxws.sample.WrapTests;
@@ -82,6 +87,7 @@
suite.addTestSuite(AnnotationDescriptionTests.class);
suite.addTestSuite(AnnotationServiceImplDescriptionTests.class);
suite.addTestSuite(AnnotationProviderImplDescriptionTests.class);
+ suite.addTestSuite(AnnotationServiceImplWithDBCTests.class);
suite.addTestSuite(HandlerChainProcessorTests.class);
suite.addTestSuite(JaxwsMessageBundleTests.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org