/**
* Generated service constructor(URL, QName) with a composite that specifies a wsdlLocation override
* where the override is a fully specifed URL to a file.
*/
public void test2ArgGeneratedServiceOverrideWsdlLocationWithProtocol() {
DescriptionBuilderComposite composite = new DescriptionBuilderComposite();
// If the wsdlLocation in the composite specifies a protocol (like file: or http:) then
// it should be used as-is. Otherwise (as shown by the other tests), it is treated as
// a path on the local filesystem.
String wsdlLocation = getWsdlLocation(overridenWsdl);
// This check is necessary because Unix/Linux file paths begin
// with a '/'. When adding the prefix 'jar:file:/' we may end
// up with '//' after the 'file:' part. This causes the URL
// object to treat this like a remote resource
if(wsdlLocation.indexOf("/") == 0) {
wsdlLocation = wsdlLocation.substring(1, wsdlLocation.length());
}
String fullWsdlLocation = "file:/" + wsdlLocation;
WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, null, fullWsdlLocation);
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 the key. The annotation with no key should be unchanged.
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(fullWsdlLocation, wsClientKeyed.wsdlLocation());
assertEquals("originalTNS", wsClientKeyed.targetNamespace());
assertEquals("", wsClientKeyed.name());