Changed xsd namespace to be more conformant to other Spring projects.

This commit is contained in:
Arjen Poutsma
2007-12-03 16:20:35 +00:00
parent 51de169c8e
commit 84e13da493
9 changed files with 21 additions and 130 deletions

View File

@@ -18,19 +18,20 @@ package org.springframework.ws.config;
import java.util.Map;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter;
import org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter;
import junit.framework.TestCase;
public class SwsNamespaceHandlerTigerTest extends TestCase {
public class WebServicesNamespaceHandlerTigerTest extends TestCase {
private ApplicationContext applicationContext;
protected void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("swsNamespaceHandlerTest-tiger.xml", getClass());
applicationContext =
new ClassPathXmlApplicationContext("webServicesNamespaceHandlerTest-tiger.xml", getClass());
}
public void testMarshallingEndpoints() throws Exception {

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sws="http://www.springframework.org/spring-ws/schema/sws" xsi:schemaLocation="
xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/beans/spring-tx-2.0.xsd
http://www.springframework.org/spring-ws/schema/sws http://www.springframework.org/spring-ws/schema/sws/spring-ws-1.5.xsd">
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-1.5.xsd">
<sws:marshalling-endpoints/>
@@ -13,7 +12,7 @@
<sws:xpath-endpoints>
<sws:namespace prefix="sws" uri="http://www.springframework.org/spring-ws"/>
</sws:xpath-endpoints>
</beans>

View File

@@ -20,12 +20,12 @@ import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* {@link NamespaceHandler} for the '<code>sws</code>' namespace.
* {@link NamespaceHandler} for the '<code>web-services</code>' namespace.
*
* @author Arjen Poutsma
* @since 1.5.0
*/
public class SwsNamespaceHandler extends NamespaceHandlerSupport {
public class WebServicesNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
registerBeanDefinitionParser("marshalling-endpoints", new MarshallingEndpointsBeanDefinitionParser());

View File

@@ -1 +1 @@
http\://www.springframework.org/spring-ws/schema/sws=org.springframework.ws.config.SwsNamespaceHandler
http\://www.springframework.org/schema/web-services=org.springframework.ws.config.WebServicesNamespaceHandler

View File

@@ -1 +1 @@
http\://www.springframework.org/spring-ws/schema/sws/spring-ws-1.5.xsd=/org/springframework/ws/config/spring-ws-1.5.xsd
http\://www.springframework.org/schema/web-services/web-services-1.5.xsd=/org/springframework/ws/config/web-services-1.5.xsd

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.springframework.org/spring-ws/schema/sws" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsd:schema xmlns="http://www.springframework.org/schema/web-services" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://www.springframework.org/spring-ws/schema/sws" elementFormDefault="qualified"
targetNamespace="http://www.springframework.org/schema/web-services" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
@@ -13,7 +13,7 @@
Defines the configuration elements for Spring Web Services.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="marshalling-endpoints">
<xsd:annotation>
<xsd:documentation
@@ -83,6 +83,4 @@
</xsd:element>
</xsd:schema>

View File

@@ -18,18 +18,18 @@ package org.springframework.ws.config;
import java.util.Map;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter;
import junit.framework.TestCase;
public class SwsNamespaceHandlerTest extends TestCase {
public class WebServiceNamespaceHandlerTest extends TestCase {
private ApplicationContext applicationContext;
protected void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("swsNamespaceHandlerTest.xml", getClass());
applicationContext = new ClassPathXmlApplicationContext("webServiceNamespaceHandlerTest.xml", getClass());
}
public void testMarshallingMethods() throws Exception {

View File

@@ -1,107 +0,0 @@
/*
* Copyright 2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ws.transport.http;
import java.io.File;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.ws.transport.TransportConstants;
public class MessageDispatcherServletIntegrationTest extends TestCase {
private Server jettyServer;
private HttpClient client;
private static final String CONTENT_TYPE = "Content-Type";
protected final void setUp() throws Exception {
jettyServer = new Server(8888);
Context jettyContext = new Context(jettyServer, "/");
File dir = new File(getClass().getResource(".").toURI());
jettyContext.setResourceBase(dir.getAbsolutePath());
ServletHolder servletHolder = new ServletHolder(new MessageDispatcherServlet());
servletHolder.setName("spring-ws");
jettyContext.addServlet(servletHolder, "/*");
jettyServer.start();
client = new HttpClient();
}
protected void tearDown() throws Exception {
jettyServer.stop();
}
public void testNoResponse() throws IOException {
PostMethod postMethod = new PostMethod("http://localhost:8888/service");
postMethod.addRequestHeader(CONTENT_TYPE, "text/xml");
postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION,
"http://springframework.org/spring-ws/NoResponse");
Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class);
postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream()));
client.executeMethod(postMethod);
assertEquals("Invalid Response Code", HttpStatus.SC_ACCEPTED, postMethod.getStatusCode());
assertEquals("Response retrieved", 0, postMethod.getResponseContentLength());
}
public void testResponse() throws IOException {
PostMethod postMethod = new PostMethod("http://localhost:8888/service");
postMethod.addRequestHeader(CONTENT_TYPE, "text/xml");
postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION,
"http://springframework.org/spring-ws/Response");
Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class);
postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream()));
client.executeMethod(postMethod);
assertEquals("Invalid Response Code", HttpStatus.SC_OK, postMethod.getStatusCode());
assertTrue("No Response retrieved", postMethod.getResponseContentLength() > 0);
}
public void testNoEndpoint() throws IOException {
PostMethod postMethod = new PostMethod("http://localhost:8888/service");
postMethod.addRequestHeader(CONTENT_TYPE, "text/xml");
postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION,
"http://springframework.org/spring-ws/NoEndpoint");
Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class);
postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream()));
client.executeMethod(postMethod);
assertEquals("Invalid Response Code", HttpStatus.SC_NOT_FOUND, postMethod.getStatusCode());
assertEquals("Response retrieved", 0, postMethod.getResponseContentLength());
}
public void testFault() throws IOException {
PostMethod postMethod = new PostMethod("http://localhost:8888/service");
postMethod.addRequestHeader(CONTENT_TYPE, "text/xml");
postMethod
.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION, "http://springframework.org/spring-ws/Fault");
Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class);
postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream()));
client.executeMethod(postMethod);
assertEquals("Invalid Response Code", HttpStatus.SC_INTERNAL_SERVER_ERROR, postMethod.getStatusCode());
assertTrue("No Response retrieved", postMethod.getResponseContentLength() > 0);
}
}

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sws="http://www.springframework.org/spring-ws/schema/sws" xsi:schemaLocation="
xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/beans/spring-tx-2.0.xsd
http://www.springframework.org/spring-ws/schema/sws http://www.springframework.org/spring-ws/schema/sws/spring-ws-1.5.xsd">
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-1.5.xsd">
<sws:marshalling-endpoints/>