Skip to content
Permalink
Browse files
Remove the getDefinition(URL) call on WSDLManager... only used in tests.
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1565804 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
dkulp committed Feb 7, 2014
1 parent 2cf133d commit df3aa9d613db902539ebef5b0ef47122c86df034
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 161 deletions.
@@ -74,7 +74,7 @@ public void tearDown() {
protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
URL wsdlUrl = getClass().getResource(wsdl);
assertNotNull(wsdlUrl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));

Service service = f.create();
endpointInfo = service.getEndpointInfo(new QName(ns, portName));
@@ -409,7 +409,7 @@ public void onMessage(Message m) {
protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
URL wsdlUrl = getClass().getResource(wsdl);
assertNotNull(wsdlUrl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));

Service service = f.create();
endpointInfo = service.getEndpointInfo(new QName(ns, portName));
@@ -320,7 +320,7 @@ public void onMessage(Message m) {
protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
URL wsdlUrl = getClass().getResource(wsdl);
assertNotNull(wsdlUrl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));

Service service = f.create();
endpointInfo = service.getEndpointInfo(new QName(ns, portName));
@@ -50,7 +50,7 @@ public TestUtils() {
public EndpointInfo setupServiceInfo(String ns, String wsdl,
String serviceName, String portName) throws Exception {
URL wsdlUrl = getClass().getResource(wsdl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl,
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(),
new QName(ns, serviceName));

Service service = f.create();
@@ -132,7 +132,7 @@ protected void common(String wsdl, QName portName, Class<?>... jaxbClasses) thro
assertNotNull(bus.getExtension(WSDLManager.class));

WSDLServiceFactory factory =
new WSDLServiceFactory(bus, getClass().getResource(wsdl),
new WSDLServiceFactory(bus, getClass().getResource(wsdl).toString(),
new QName(portName.getNamespaceURI(), "XMLService"));

org.apache.cxf.service.Service service = factory.create();
@@ -190,7 +190,7 @@ public void testInterceptorOutbound() throws Exception {
private void setUpUsingHelloWorld() throws Exception {
String ns = "http://apache.org/hello_world_soap_http";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
.getResource("/wsdl/jaxb/hello_world.wsdl"),
.getResource("/wsdl/jaxb/hello_world.wsdl").toString(),
new QName(ns, "SOAPService"));

service = factory.create();
@@ -220,7 +220,7 @@ private void setUpUsingHelloWorld() throws Exception {
private void setUpUsingDocLit() throws Exception {
String ns = "http://apache.org/hello_world_doc_lit_bare";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
.getResource("/wsdl/jaxb/doc_lit_bare.wsdl"),
.getResource("/wsdl/jaxb/doc_lit_bare.wsdl").toString(),
new QName(ns, "SOAPService"));

service = factory.create();
@@ -173,7 +173,7 @@ public void testInterceptorInboundBareNoParameter() throws Exception {
private void setUpUsingHelloWorld() throws Exception {
String ns = "http://apache.org/hello_world_soap_http";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
.getResource("/wsdl/jaxb/hello_world.wsdl"), new QName(ns, "SOAPService"));
.getResource("/wsdl/jaxb/hello_world.wsdl").toString(), new QName(ns, "SOAPService"));

service = factory.create();
endpointInfo = service.getEndpointInfo(new QName(ns, "SoapPort"));
@@ -198,7 +198,7 @@ private void setUpUsingHelloWorld() throws Exception {
private void setUpUsingDocLit() throws Exception {
String ns = "http://apache.org/hello_world_doc_lit_bare";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
.getResource("/wsdl/jaxb/doc_lit_bare.wsdl"), new QName(ns, "SOAPService"));
.getResource("/wsdl/jaxb/doc_lit_bare.wsdl").toString(), new QName(ns, "SOAPService"));

service = factory.create();
endpointInfo = service.getEndpointInfo(new QName(ns, "SoapPort"));
@@ -91,7 +91,7 @@ public void setUp() throws Exception {

String ns = "http://apache.org/hello_world_soap_http";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
.getResource("/org/apache/cxf/jaxb/resources/wsdl/hello_world.wsdl"),
.getResource("/org/apache/cxf/jaxb/resources/wsdl/hello_world.wsdl").toString(),
new QName(ns, "SOAPService"));

service = factory.create();
@@ -95,7 +95,7 @@ public static void oneTimeSetUp() throws Exception {
String resourceName = "/attachment/wsdl11/test" + i + ".wsdl";
URL url = Wsdl11AttachmentPolicyProviderTest.class.getResource(resourceName);
try {
services[i] = builder.buildServices(manager.getDefinition(url)).get(0);
services[i] = builder.buildServices(manager.getDefinition(url.toString())).get(0);
} catch (WSDLException ex) {
ex.printStackTrace();
fail("Failed to build service from resource " + resourceName);
@@ -19,7 +19,6 @@

package org.apache.cxf.wsdl;

import java.net.URL;
import java.util.Map;

import javax.wsdl.Definition;
@@ -49,16 +48,6 @@ public interface WSDLManager {
* @return the WSDLFactory
*/
WSDLFactory getWSDLFactory();


/**
* Get the WSDL definition for the given URL. Implementations
* may return a copy from a local cache or load a new copy
* from the URL.
* @param url - the location of the WSDL to load
* @return the wsdl definition
*/
Definition getDefinition(URL url) throws WSDLException;

/**
* Get the WSDL definition for the given URL. Implementations

This file was deleted.

@@ -19,7 +19,6 @@

package org.apache.cxf.wsdl11;

import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -143,37 +142,6 @@ public ExtensionRegistry getExtensionRegistry() {
return registry;
}

/*
* (non-Javadoc)
*
* @see org.apache.cxf.wsdl.WSDLManager#getDefinition(java.net.URL)
*/
public Definition getDefinition(URL url) throws WSDLException {
String urlString = url.toString();
synchronized (definitionsMap) {
//This needs to use the exact URL object for the cache
//as the urlString object is not held onto strongly
//and thus, could cause the definition to be garbage
//collected.
if (definitionsMap.containsKey(url)) {
return definitionsMap.get(url);
}
if (definitionsMap.containsKey(urlString)) {
return definitionsMap.get(urlString);
}
}
Definition def = loadDefinition(urlString);
synchronized (definitionsMap) {
//see note about about the url
//The loadDefinition call will add it with the
//string form, we just need to add it with the
//url form (which Sonar will complain about,
//but we need to do it)
definitionsMap.put(url, def);
}
return def;
}

/*
* (non-Javadoc)
*
@@ -19,7 +19,6 @@

package org.apache.cxf.wsdl11;

import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -49,7 +48,8 @@ public class WSDLServiceFactory extends AbstractServiceFactoryBean {

private static final Logger LOG = LogUtils.getL7dLogger(WSDLServiceFactory.class);

private URL wsdlUrl;
protected final String wsdlUrl;

private QName serviceName;
private QName endpointName;
private Definition definition;
@@ -58,27 +58,17 @@ public class WSDLServiceFactory extends AbstractServiceFactoryBean {
public WSDLServiceFactory(Bus b, Definition d) {
setBus(b);
definition = d;
wsdlUrl = d.getDocumentBaseURI();
}

public WSDLServiceFactory(Bus b, Definition d, QName sn) {
this(b, d);
serviceName = sn;
}

public WSDLServiceFactory(Bus b, URL url) {
setBus(b);
wsdlUrl = url;

try {
// use wsdl manager to parse wsdl or get cached definition
definition = getBus().getExtension(WSDLManager.class).getDefinition(wsdlUrl);
} catch (WSDLException ex) {
throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG", LOG), ex);
}

}
public WSDLServiceFactory(Bus b, String url) {
setBus(b);
wsdlUrl = url;
try {
// use wsdl manager to parse wsdl or get cached definition
definition = getBus().getExtension(WSDLManager.class).getDefinition(url);
@@ -87,12 +77,9 @@ public WSDLServiceFactory(Bus b, String url) {
}
}

public WSDLServiceFactory(Bus b, URL url, QName sn) {
this(b, url);
serviceName = sn;
}
public WSDLServiceFactory(Bus b, String url, QName sn) {
setBus(b);
wsdlUrl = url;
try {
// use wsdl manager to parse wsdl or get cached definition
definition = getBus().getExtension(WSDLManager.class).getDefinition(url);

This file was deleted.

@@ -1,3 +1,2 @@
org.apache.cxf.wsdl11.WSDLManagerImpl:org.apache.cxf.wsdl.WSDLManager:true
org.apache.cxf.wsdl11.WSDLServiceFactoryImpl:org.apache.cxf.wsdl.WSDLServiceFactory:true

0 comments on commit df3aa9d

Please sign in to comment.