use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class WSDL11ToAxisServiceBuilderTest method testVersion.
public void testVersion() {
XMLUnit.setIgnoreWhitespace(true);
File testResourceFile = new File(wsdlLocation);
try {
WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(new FileInputStream(testResourceFile));
AxisService axisService = builder.populateService();
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
axisConfig.addService(axisService);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
axisService.printWSDL(baos);
assertXMLEqual(new FileReader(testResourceFile), new StringReader(new String(baos.toByteArray())));
} catch (Exception e) {
System.out.println("Error in WSDL : " + testResourceFile.getName());
System.out.println("Exception: " + e.toString());
fail("Caught exception " + e.toString());
} finally {
XMLUnit.setIgnoreWhitespace(false);
}
}
use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class MetadataTestCachingClientContextFactory method testNoArgGeneratedServiceOverrideWsdlLocation.
/**
* Generated service constructor() with a composite that specifies a wsdlLocation override
*/
public void testNoArgGeneratedServiceOverrideWsdlLocation() {
DescriptionBuilderComposite composite = new DescriptionBuilderComposite();
WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, null, getWsdlLocation(overridenWsdl));
composite.setWebServiceClientAnnot(wsClientAnno);
ServiceDelegate.setServiceMetadata(composite);
Service service = new ClientMetadataGeneratedService();
assertNotNull(service);
assertNull(ServiceDelegate.getServiceMetadata());
ServiceDelegate serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
assertNotNull(serviceDelegate);
ServiceDescription serviceDesc = serviceDelegate.getServiceDescription();
assertNotNull(serviceDesc);
DescriptionBuilderComposite dbcInServiceDesc = DescriptionTestUtils2.getServiceDescriptionComposite(serviceDesc);
assertSame(composite, dbcInServiceDesc.getSparseComposite(serviceDelegate));
assertEquals(ClientMetadataGeneratedService.class, dbcInServiceDesc.getCorrespondingClass());
// There is WebServiceClient on the generated Service and it was overriden in the composite
// for this key, however the keyless composite should not have any overrides.
WebServiceClient wsClient = dbcInServiceDesc.getWebServiceClientAnnot();
assertNotNull(wsClient);
assertEquals(originalWsdl, wsClient.wsdlLocation());
assertEquals("originalTNS", wsClient.targetNamespace());
assertEquals("", wsClient.name());
WebServiceClient wsClientKeyed = dbcInServiceDesc.getWebServiceClientAnnot(serviceDelegate);
assertNotSame(wsClient, wsClientKeyed);
assertEquals(getWsdlLocation(overridenWsdl), wsClientKeyed.wsdlLocation());
assertEquals("originalTNS", wsClientKeyed.targetNamespace());
assertEquals("", wsClientKeyed.name());
// WSDL override specified in the composite
assertTrue("Wrong WSDL used", validatePort(service, overridenWsdl_portLocalPart));
}
use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class MetadataTestCachingClientContextFactory method test2ArgGeneratedServiceOverrideWsdlLocation.
/**
* Generated service constructor(URL, QName) with a composite that specifies a wsdlLocation override
*/
public void test2ArgGeneratedServiceOverrideWsdlLocation() {
DescriptionBuilderComposite composite = new DescriptionBuilderComposite();
WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, null, getWsdlLocation(overridenWsdl));
composite.setWebServiceClientAnnot(wsClientAnno);
ServiceDelegate.setServiceMetadata(composite);
Service service = new ClientMetadataGeneratedService(getWsdlURL(otherWsdl), new QName(namespaceURI, svcLocalPart));
assertNotNull(service);
assertNull(ServiceDelegate.getServiceMetadata());
ServiceDelegate serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
assertNotNull(serviceDelegate);
ServiceDescription serviceDesc = serviceDelegate.getServiceDescription();
assertNotNull(serviceDesc);
DescriptionBuilderComposite dbcInServiceDesc = DescriptionTestUtils2.getServiceDescriptionComposite(serviceDesc);
assertSame(composite, dbcInServiceDesc.getSparseComposite(serviceDelegate));
assertEquals(ClientMetadataGeneratedService.class, dbcInServiceDesc.getCorrespondingClass());
// There is WebServiceClient on the generated Service and it was overriden in the composite
// for this key, however the keyless composite should not have any overrides.
WebServiceClient wsClient = dbcInServiceDesc.getWebServiceClientAnnot();
assertNotNull(wsClient);
assertEquals(originalWsdl, wsClient.wsdlLocation());
assertEquals("originalTNS", wsClient.targetNamespace());
assertEquals("", wsClient.name());
WebServiceClient wsClientKeyed = dbcInServiceDesc.getWebServiceClientAnnot(serviceDelegate);
assertNotSame(wsClient, wsClientKeyed);
assertEquals(getWsdlLocation(overridenWsdl), wsClientKeyed.wsdlLocation());
assertEquals("originalTNS", wsClientKeyed.targetNamespace());
assertEquals("", wsClientKeyed.name());
// WSDL override specified in the composite
assertTrue("Wrong WSDL used", validatePort(service, overridenWsdl_portLocalPart));
}
use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class MetadataTestCachingClientContextFactory method test1ArgServiceOverrideWsdlLocation.
/**
* Service.create(QName) with a composite that specifies a wsdlLocation override
*/
public void test1ArgServiceOverrideWsdlLocation() {
QName serviceQName = new QName(namespaceURI, svcLocalPart);
DescriptionBuilderComposite composite = new DescriptionBuilderComposite();
WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, null, getWsdlLocation(overridenWsdl));
composite.setWebServiceClientAnnot(wsClientAnno);
// Use the proprietary SPI to create a service with additional metadata specified
ServiceDelegate.setServiceMetadata(composite);
Service service = Service.create(serviceQName);
assertNotNull(service);
// Verify that the composite has been reset so that it would not affect the next Service
assertNull(ServiceDelegate.getServiceMetadata());
ServiceDelegate serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
assertNotNull(serviceDelegate);
ServiceDescription serviceDesc = serviceDelegate.getServiceDescription();
assertNotNull(serviceDesc);
DescriptionBuilderComposite dbcInServiceDesc = DescriptionTestUtils2.getServiceDescriptionComposite(serviceDesc);
assertSame(composite, dbcInServiceDesc.getSparseComposite(serviceDelegate));
assertEquals(Service.class, dbcInServiceDesc.getCorrespondingClass());
// This is a generic Service with overrides, there will be WebServiceClient annotation
WebServiceClient wsClient = dbcInServiceDesc.getWebServiceClientAnnot();
assertNull(wsClient);
wsClient = dbcInServiceDesc.getWebServiceClientAnnot(serviceDelegate);
assertNotNull(wsClient);
assertEquals(getWsdlLocation(overridenWsdl), wsClient.wsdlLocation());
assertNull(wsClient.targetNamespace());
assertNull(wsClient.name());
// WSDL override specified in the composite
assertTrue("Wrong WSDL used", validatePort(service, overridenWsdl_portLocalPart));
}
use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.
the class MetadataTestCachingClientContextFactory method test2ArgGeneratedServiceOverrideTNS.
/**
* Generated service constructor(URL, QName) with a composite that specifies a
* target Namespace override. Most of the other tests are based on wsdlLocation since
* that is what JSR-109 DDs override. This test verifies that other members can also
* be override.
*/
public void test2ArgGeneratedServiceOverrideTNS() {
DescriptionBuilderComposite composite = new DescriptionBuilderComposite();
WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, "overrideTNS", getWsdlLocation(overridenWsdl));
composite.setWebServiceClientAnnot(wsClientAnno);
ServiceDelegate.setServiceMetadata(composite);
Service service = new ClientMetadataGeneratedService(getWsdlURL(otherWsdl), new QName(namespaceURI, svcLocalPart));
assertNotNull(service);
assertNull(ServiceDelegate.getServiceMetadata());
ServiceDelegate serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
assertNotNull(serviceDelegate);
ServiceDescription serviceDesc = serviceDelegate.getServiceDescription();
assertNotNull(serviceDesc);
DescriptionBuilderComposite dbcInServiceDesc = DescriptionTestUtils2.getServiceDescriptionComposite(serviceDesc);
assertSame(composite, dbcInServiceDesc.getSparseComposite(serviceDelegate));
assertEquals(ClientMetadataGeneratedService.class, dbcInServiceDesc.getCorrespondingClass());
// There is WebServiceClient on the generated Service and it was overriden in the composite
// for this key, however the keyless composite should not have any overrides.
WebServiceClient wsClient = dbcInServiceDesc.getWebServiceClientAnnot();
assertNotNull(wsClient);
assertEquals(originalWsdl, wsClient.wsdlLocation());
assertEquals("originalTNS", wsClient.targetNamespace());
assertEquals("", wsClient.name());
WebServiceClient wsClientKeyed = dbcInServiceDesc.getWebServiceClientAnnot(serviceDelegate);
assertNotSame(wsClient, wsClientKeyed);
assertEquals(getWsdlLocation(overridenWsdl), wsClientKeyed.wsdlLocation());
assertEquals("overrideTNS", wsClientKeyed.targetNamespace());
assertEquals("", wsClientKeyed.name());
// WSDL override specified in the composite
assertTrue("Wrong WSDL used", validatePort(service, overridenWsdl_portLocalPart));
}
Aggregations