use of org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite in project axis-axis2-java-core by apache.
the class OperationDescriptionImplTests method testDetermineOperationQName.
public void testDetermineOperationQName() {
String wsdlRelativeLocation = "test-resources/wsdl/";
String wsdlFileName = "BindingNamespaceDefaults.wsdl";
String targetNamespace = "http://nonanonymous.complextype.test.org";
String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
// Build up a DBC, including the WSDL Definition and the annotation information for
// the impl class.
DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
assertNotNull(wsdlDefn);
WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
assertNotNull(webServiceAnnot);
webServiceAnnot.setWsdlLocation(wsdlLocation);
webServiceAnnot.setTargetNamespace(targetNamespace);
webServiceAnnot.setServiceName("EchoMessageService");
webServiceAnnot.setPortName("EchoMessagePort");
MethodDescriptionComposite mdc = new MethodDescriptionComposite();
mdc.setMethodName("echoMessage");
mdc.setReturnType("java.lang.String");
ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
pdc1.setParameterType("java.lang.String");
mdc.addParameterDescriptionComposite(pdc1);
dbc.addMethodDescriptionComposite(mdc);
dbc.setWebServiceAnnot(webServiceAnnot);
dbc.setClassName(BindingNSImpl.class.getName());
dbc.setWsdlDefinition(wsdlDefn);
dbc.setwsdlURL(wsdlURL);
HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
dbcMap.put(dbc.getClassName(), dbc);
List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
ServiceDescription sd = serviceDescList.get(0);
EndpointInterfaceDescription eid = new EndpointInterfaceDescriptionImpl(dbc, new EndpointDescriptionImpl(null, new QName(targetNamespace, "EchoMessagePort"), (ServiceDescriptionImpl) sd));
assertEquals(new QName(targetNamespace, "echoMessage"), OperationDescriptionImpl.determineOperationQName(eid, mdc));
}
use of org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite in project axis-axis2-java-core by apache.
the class WSDLGeneratorImpl method testPartialWSDL2.
/**
* Tests the binding, service, and port not specified in the WSDL.
* <p/>
* This test is based on the FVT test AddNumbersImplPartial2
*/
public void testPartialWSDL2() {
String wsdlRelativeLocation = "test-resources/wsdl/";
String wsdlFileName = "PartialWSDL2.wsdl";
String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
// Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
assertNotNull(wsdlDefn);
WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
assertNotNull(webServiceAnnot);
webServiceAnnot.setWsdlLocation(wsdlLocation);
webServiceAnnot.setTargetNamespace(targetNamespace);
MethodDescriptionComposite mdc = new MethodDescriptionComposite();
mdc.setMethodName("addTwoNumbers");
mdc.setReturnType("int");
ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
mdc.addParameterDescriptionComposite(pdc1);
mdc.addParameterDescriptionComposite(pdc2);
dbc.addMethodDescriptionComposite(mdc);
dbc.setWebServiceAnnot(webServiceAnnot);
dbc.setClassName(AddNumbersImplPartial1.class.getName());
dbc.setWsdlDefinition(wsdlDefn);
dbc.setwsdlURL(wsdlURL);
dbc.setCustomWsdlGenerator(new WSDLGeneratorImpl(wsdlDefn));
HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
dbcMap.put(AddNumbersImplPartial1.class.getName(), dbc);
List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
assertEquals(1, serviceDescList.size());
ServiceDescription sd = serviceDescList.get(0);
assertNotNull(sd);
EndpointDescription[] edArray = sd.getEndpointDescriptions();
assertNotNull(edArray);
assertEquals(1, edArray.length);
EndpointDescription ed = edArray[0];
assertNotNull(ed);
// Test for presence of generated WSDL
AxisService as = ed.getAxisService();
assertNotNull(as);
Parameter compositeParam = as.getParameter(MDQConstants.WSDL_COMPOSITE);
assertNotNull(compositeParam);
assertNotNull(compositeParam.getValue());
EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
assertNotNull(eid);
OperationDescription[] odArray = eid.getOperations();
assertNotNull(odArray);
assertEquals(1, odArray.length);
OperationDescription od = odArray[0];
}
use of org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite in project axis-axis2-java-core by apache.
the class WSDLGeneratorImpl method testPartialWSDL1.
/**
* Tests the binding, service, and port not specified in the WSDL.
* <p/>
* This test is based on the FVT test AddNumbersImplPartial1
*/
public void testPartialWSDL1() {
String wsdlRelativeLocation = "test-resources/wsdl/";
String wsdlFileName = "PartialWSDL1.wsdl";
String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
// Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
assertNotNull(wsdlDefn);
WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
assertNotNull(webServiceAnnot);
webServiceAnnot.setWsdlLocation(wsdlLocation);
webServiceAnnot.setTargetNamespace(targetNamespace);
MethodDescriptionComposite mdc = new MethodDescriptionComposite();
mdc.setMethodName("addTwoNumbers");
mdc.setReturnType("int");
ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
mdc.addParameterDescriptionComposite(pdc1);
mdc.addParameterDescriptionComposite(pdc2);
dbc.addMethodDescriptionComposite(mdc);
dbc.setWebServiceAnnot(webServiceAnnot);
dbc.setClassName(AddNumbersImplPartial1.class.getName());
dbc.setWsdlDefinition(wsdlDefn);
dbc.setwsdlURL(wsdlURL);
dbc.setCustomWsdlGenerator(new WSDLGeneratorImpl(wsdlDefn));
HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
dbcMap.put(AddNumbersImplPartial1.class.getName(), dbc);
List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
assertEquals(1, serviceDescList.size());
ServiceDescription sd = serviceDescList.get(0);
assertNotNull(sd);
EndpointDescription[] edArray = sd.getEndpointDescriptions();
assertNotNull(edArray);
assertEquals(1, edArray.length);
EndpointDescription ed = edArray[0];
assertNotNull(ed);
// Test for presence of generated WSDL
AxisService as = ed.getAxisService();
assertNotNull(as);
Parameter compositeParam = as.getParameter(MDQConstants.WSDL_COMPOSITE);
assertNotNull(compositeParam);
assertNotNull(compositeParam.getValue());
EndpointInterfaceDescription eid = ed.getEndpointInterfaceDescription();
assertNotNull(eid);
OperationDescription[] odArray = eid.getOperations();
assertNotNull(odArray);
assertEquals(1, odArray.length);
OperationDescription od = odArray[0];
}
use of org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite in project axis-axis2-java-core by apache.
the class ValidateWSDLImpl2 method testValidatePortType.
/**
* The SEI used by the service impl does not contain all the methods defined on the PortType
*/
public void testValidatePortType() {
String wsdlRelativeLocation = System.getProperty("basedir", ".") + "/" + "test-resources/wsdl/";
String wsdlFileName = "ValidateWSDL1.wsdl";
String targetNamespace = "http://serverPartial1.checkexception.webfault.annotations/";
String wsdlLocation = wsdlRelativeLocation + wsdlFileName;
// Build up a DBC, including the WSDL Definition and the annotation information for the impl class.
DescriptionBuilderComposite dbc = new DescriptionBuilderComposite();
URL wsdlURL = DescriptionTestUtils.getWSDLURL(wsdlFileName);
Definition wsdlDefn = DescriptionTestUtils.createWSDLDefinition(wsdlURL);
assertNotNull(wsdlDefn);
WebServiceAnnot webServiceAnnot = WebServiceAnnot.createWebServiceAnnotImpl();
assertNotNull(webServiceAnnot);
webServiceAnnot.setWsdlLocation(wsdlLocation);
webServiceAnnot.setTargetNamespace(targetNamespace);
MethodDescriptionComposite mdc = new MethodDescriptionComposite();
mdc.setMethodName("addTwoNumbers");
mdc.setReturnType("int");
ParameterDescriptionComposite pdc1 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
ParameterDescriptionComposite pdc2 = new ParameterDescriptionComposite();
pdc1.setParameterType("int");
mdc.addParameterDescriptionComposite(pdc1);
mdc.addParameterDescriptionComposite(pdc2);
dbc.addMethodDescriptionComposite(mdc);
dbc.setWebServiceAnnot(webServiceAnnot);
dbc.setClassName(ValidateWSDLImpl1.class.getName());
dbc.setWsdlDefinition(wsdlDefn);
dbc.setwsdlURL(wsdlURL);
HashMap<String, DescriptionBuilderComposite> dbcMap = new HashMap<String, DescriptionBuilderComposite>();
dbcMap.put(ValidateWSDLImpl1.class.getName(), dbc);
try {
List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap);
// Removing the fail() call here as we removed the Valdiation Error from
// EndpointInterfaceDescriptionValidator.
// Expected code path
} catch (WebServiceException e) {
// Expected code path
}
}
use of org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite in project axis-axis2-java-core by apache.
the class AbstractService method testImplParams.
public static void testImplParams() {
assertNotNull(implDBC);
List<MethodDescriptionComposite> mdcList = sortList(implDBC.getMethodDescriptionsList());
assertNotNull(mdcList);
assertEquals(mdcList.size(), 5);
MethodDescriptionComposite mdc = mdcList.get(0);
assertNotNull(mdc);
List<ParameterDescriptionComposite> pdcList = mdc.getParameterDescriptionCompositeList();
assertNotNull(pdcList);
assertEquals(0, pdcList.size());
mdc = mdcList.get(1);
assertNotNull(mdc);
pdcList = mdc.getParameterDescriptionCompositeList();
assertNotNull(pdcList);
assertEquals(pdcList.size(), 1);
ParameterDescriptionComposite pdc = pdcList.get(0);
assertEquals("java.util.List<java.lang.String>", pdc.getParameterType());
mdc = mdcList.get(2);
pdcList = mdc.getParameterDescriptionCompositeList();
assertNotNull(pdcList);
assertEquals(pdcList.size(), 2);
pdc = pdcList.get(0);
assertEquals("int", pdc.getParameterType());
pdc = pdcList.get(1);
assertNotNull(pdc);
assertEquals("int", pdc.getParameterType());
}
Aggregations