Author: dkulp
Date: Mon Apr 7 11:36:25 2008
New Revision: 645641
URL: http://svn.apache.org/viewvc?rev=645641&view=rev
Log:
Get the 2.0.x tests passing with the ported caches.
Modified:
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstTest.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Modified:
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/ws/addressing/JAXWSAConstants.java
Mon Apr 7 11:36:25 2008
@@ -30,6 +30,7 @@
public static final String WSAW_PREFIX = "wsaw";
public static final String NS_WSAW =
"http://www.w3.org/2006/05/addressing/wsdl";
+ public static final String NS_WSAOLD =
"http://www.w3.org/2005/02/addressing/wsdl";
public static final QName WSAW_ACTION_QNAME = new QName(NS_WSAW,
"Action");
Modified:
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Mon Apr 7 11:36:25 2008
@@ -257,7 +257,8 @@
for (Object obj : metadata.getAny()) {
if (obj instanceof Element) {
Node node = (Element)obj;
- if (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ ||
node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAOLD))
&& node.getLocalName().equals("ServiceName")) {
String content = node.getTextContent();
String namespaceURI =
node.getFirstChild().getNamespaceURI();
@@ -296,7 +297,8 @@
for (Object obj : metadata.getAny()) {
if (obj instanceof Element) {
Node node = (Element)obj;
- if (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ ||
node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAOLD))
&& node.getNodeName().contains("ServiceName")) {
return
node.getAttributes().getNamedItem("EndpointName").getTextContent();
}
@@ -364,7 +366,8 @@
for (Object obj : metadata.getAny()) {
if (obj instanceof Element) {
Node node = (Element)obj;
- if (node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ if ((node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAW)
+ ||
node.getNamespaceURI().equals(JAXWSAConstants.NS_WSAOLD))
&& node.getNodeName().contains("InterfaceName")) {
String content = node.getTextContent();
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
Mon Apr 7 11:36:25 2008
@@ -28,6 +28,7 @@
import org.apache.cxf.binding.soap.SoapConstants;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.interceptor.Fault;
@@ -85,7 +86,7 @@
}
private void getAndSetOperation(SoapMessage message, String action) {
- if ("".equals(action)) {
+ if (StringUtils.isEmpty(action)) {
return;
}
@@ -95,9 +96,12 @@
BindingOperationInfo bindingOp = null;
Collection<BindingOperationInfo> bops =
ep.getBinding().getBindingInfo().getOperations();
+ if (bops == null) {
+ return;
+ }
for (BindingOperationInfo boi : bops) {
SoapOperationInfo soi = (SoapOperationInfo)
boi.getExtensor(SoapOperationInfo.class);
- if (soi != null && soi.getAction().equals(action)) {
+ if (soi != null && action.equals(soi.getAction())) {
if (bindingOp != null) {
//more than one op with the same action, will need to
parse normally
return;
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Mon Apr 7 11:36:25 2008
@@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -143,7 +144,7 @@
private Map<String, Object> marshallerProperties = Collections.emptyMap();
private boolean qualifiedSchemas;
-
+ private Service service;
public JAXBDataBinding() {
}
@@ -153,7 +154,7 @@
}
public JAXBDataBinding(Class<?>... classes) throws JAXBException {
- contextClasses = new HashSet<Class<?>>();
+ contextClasses = new LinkedHashSet<Class<?>>();
contextClasses.addAll(Arrays.asList(classes));
setContext(createJAXBContext(contextClasses));
}
@@ -237,7 +238,9 @@
return SUPPORTED_READER_FORMATS;
}
- public void initialize(Service service) {
+ @SuppressWarnings("unchecked")
+ public void initialize(Service aservice) {
+ this.service = aservice;
// context is already set, don't redo it
if (context != null) {
return;
@@ -245,10 +248,14 @@
CachedContextAndSchemas cachedContextAndSchemas = null;
- contextClasses = new HashSet<Class<?>>();
+ contextClasses = new LinkedHashSet<Class<?>>();
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
JAXBContextInitializer initializer = new
JAXBContextInitializer(serviceInfo, contextClasses);
initializer.walk();
+ if (serviceInfo.getProperty("extra.class") != null) {
+ Set<Class<?>> exClasses =
serviceInfo.getProperty("extra.class", Set.class);
+ contextClasses.addAll(exClasses);
+ }
}
@@ -592,5 +599,15 @@
*/
public void setMarshallerProperties(Map<String, Object>
marshallerProperties) {
this.marshallerProperties = marshallerProperties;
+ }
+
+
+ public static void clearCaches() {
+ synchronized (JAXBCONTEXT_CACHE) {
+ JAXBCONTEXT_CACHE.clear();
+ }
+ synchronized (OBJECT_FACTORY_CACHE) {
+ OBJECT_FACTORY_CACHE.clear();
+ }
}
}
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Mon Apr 7 11:36:25 2008
@@ -48,6 +48,7 @@
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.source.SourceDataBinding;
@@ -292,6 +293,13 @@
QName portQName = null;
if (portName != null && serviceQName != null) {
+ String ns = serviceQName.getNamespaceURI();
+ if (StringUtils.isEmpty(ns)) {
+ //try to workaround bug in xalan where namespace
+ //definitions are lost
+ ns = this.getServiceName().getNamespaceURI();
+ serviceQName = new QName(ns, serviceQName.getLocalPart());
+ }
portQName = new QName(serviceQName.getNamespaceURI(), portName);
}
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstTest.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstTest.java
Mon Apr 7 11:36:25 2008
@@ -25,15 +25,16 @@
import org.w3c.dom.Document;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.jaxws.service.EchoFoo;
import org.junit.Test;
public class SchemaFirstTest extends AbstractJaxWsTest {
-
@Test
public void testEndpoint() throws Exception {
-
+ JAXBDataBinding.clearCaches();
+
JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
svr.setBus(bus);
svr.setServiceBean(new EchoFoo());
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/SchemaFirstXmlConfigTest.java
Mon Apr 7 11:36:25 2008
@@ -23,6 +23,7 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
+import org.apache.cxf.jaxb.JAXBDataBinding;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -44,6 +45,7 @@
@Test
public void testEndpoint() throws Exception {
+ JAXBDataBinding.clearCaches();
JaxWsServerFactoryBean serverFB = (JaxWsServerFactoryBean)
ctx.getBean("helloServer");
Document d = getWSDLDocument(serverFB.getServer());
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
Mon Apr 7 11:36:25 2008
@@ -44,6 +44,7 @@
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.SOAPService;
+import org.junit.Before;
import org.junit.Test;
public class ServiceImplTest extends AbstractJaxWsTest {
@@ -60,6 +61,11 @@
private static final QName SOAP_PORT1 =
new QName("http://apache.org/hello_world_soap_http", "SoapPort1");
+ @Before
+ public void clearCaches() {
+ JAXBDataBinding.clearCaches();
+ }
+
@Test
public void testServiceImpl() throws Exception {
SOAPService service = new SOAPService();
Modified:
incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?rev=645641&r1=645640&r2=645641&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Mon Apr 7 11:36:25 2008
@@ -26,6 +26,7 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.jaxws.JaxwsServiceBuilder;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.ServiceInfo;
@@ -47,6 +48,7 @@
@Before
public void setUp() throws Exception {
super.setUp();
+ JAXBDataBinding.clearCaches();
builder.setBus(BusFactory.getDefaultBus());
generator.setBus(builder.getBus());
}