You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2013/07/27 17:06:58 UTC

svn commit: r1507659 - in /webservices/axiom/trunk/axiom-spring-ws: ./ src/test/java/org/apache/axiom/spring/ws/test/ src/test/java/org/apache/axiom/spring/ws/test/jdom/ src/test/resources/org/apache/axiom/spring/ws/test/jdom/

Author: veithen
Date: Sat Jul 27 15:06:58 2013
New Revision: 1507659

URL: http://svn.apache.org/r1507659
Log:
AXIOM-447 - Iteration 2: Execute the test case from iteration 1 also with SOAP 1.2.

Added:
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java   (with props)
Modified:
    webservices/axiom/trunk/axiom-spring-ws/pom.xml
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/beans.xml
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/spring-ws-servlet.xml

Modified: webservices/axiom/trunk/axiom-spring-ws/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/pom.xml?rev=1507659&r1=1507658&r2=1507659&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/pom.xml (original)
+++ webservices/axiom/trunk/axiom-spring-ws/pom.xml Sat Jul 27 15:06:58 2013
@@ -113,6 +113,14 @@
                 </configuration>
             </plugin>
             <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>**/SpringWSTest.java</include>
+                    </includes>
+                </configuration>
+            </plugin>
+            <plugin>
                 <artifactId>maven-site-plugin</artifactId>
                 <configuration>
                     <skip>true</skip>

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java?rev=1507659&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java Sat Jul 27 15:06:58 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.axiom.spring.ws.test;
+
+import org.apache.axiom.testutils.suite.MatrixTestCase;
+import org.springframework.core.env.PropertySource;
+
+public class MatrixTestCasePropertySource extends PropertySource<MatrixTestCase> {
+    public static final String TEST_PARAMETERS_PROPERTY_SOURCE_NAME = "testParameters";
+    
+    public MatrixTestCasePropertySource(MatrixTestCase source) {
+        super(TEST_PARAMETERS_PROPERTY_SOURCE_NAME, source);
+    }
+
+    @Override
+    public Object getProperty(String name) {
+        return source.getTestParameters().get(name);
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MatrixTestCasePropertySource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java?rev=1507659&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java Sat Jul 27 15:06:58 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.axiom.spring.ws.test;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class SpringWSTest extends TestCase {
+    public static TestSuite suite() {
+        SpringWSTestSuiteBuilder builder = new SpringWSTestSuiteBuilder();
+        
+        return builder.build();
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java?rev=1507659&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java Sat Jul 27 15:06:58 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.axiom.spring.ws.test;
+
+import org.apache.axiom.spring.ws.test.jdom.ClientServerTest;
+import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+
+public class SpringWSTestSuiteBuilder extends MatrixTestSuiteBuilder {
+    @Override
+    protected void addTests() {
+        addTest(new ClientServerTest("SOAP_11"));
+        addTest(new ClientServerTest("SOAP_12"));
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java?rev=1507659&r1=1507658&r2=1507659&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java Sat Jul 27 15:06:58 2013
@@ -18,8 +18,8 @@
  */
 package org.apache.axiom.spring.ws.test.jdom;
 
-import static org.junit.Assert.assertEquals;
-
+import org.apache.axiom.spring.ws.test.MatrixTestCasePropertySource;
+import org.apache.axiom.testutils.suite.MatrixTestCase;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
@@ -28,28 +28,39 @@ import org.eclipse.jetty.servlet.Servlet
 import org.jdom2.input.SAXBuilder;
 import org.jdom2.transform.JDOMResult;
 import org.jdom2.transform.JDOMSource;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import org.springframework.context.support.GenericXmlApplicationContext;
 import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
 import org.springframework.core.env.StandardEnvironment;
 import org.springframework.mock.env.MockPropertySource;
+import org.springframework.web.context.ConfigurableWebApplicationContext;
 import org.springframework.ws.client.core.WebServiceTemplate;
 import org.springframework.ws.transport.http.MessageDispatcherServlet;
 
-public class ClientServerTest {
-    private static Server server;
-    private static GenericXmlApplicationContext context;
+public class ClientServerTest extends MatrixTestCase {
+    private Server server;
+    private GenericXmlApplicationContext context;
+    
+    public ClientServerTest(String soapVersion) {
+        addTestParameter("soapVersion", soapVersion);
+    }
     
-    @BeforeClass
-    public static void setUp() throws Exception {
+    @Override
+    @SuppressWarnings("serial")
+    protected void setUp() throws Exception {
+        final MatrixTestCasePropertySource testParameters = new MatrixTestCasePropertySource(this);
+        
         server = new Server();
         Connector connector = new SelectChannelConnector();
         connector.setPort(0);
         server.setConnectors(new Connector[] { connector });
         ServletContextHandler handler = new ServletContextHandler(server, "/");
-        ServletHolder servlet = new ServletHolder(MessageDispatcherServlet.class);
+        ServletHolder servlet = new ServletHolder(new MessageDispatcherServlet() {
+            @Override
+            protected void postProcessWebApplicationContext(ConfigurableWebApplicationContext wac) {
+                wac.getEnvironment().getPropertySources().addFirst(testParameters);
+            }
+        });
         servlet.setName("spring-ws");
         servlet.setInitParameter("contextConfigLocation", ClientServerTest.class.getResource("spring-ws-servlet.xml").toString());
         servlet.setInitOrder(1);
@@ -60,20 +71,24 @@ public class ClientServerTest {
         ConfigurableEnvironment environment = context.getEnvironment();
         MockPropertySource propertySource = new MockPropertySource();
         propertySource.setProperty("port", connector.getLocalPort());
-        environment.getPropertySources().replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
+        MutablePropertySources propertySources = environment.getPropertySources();
+        propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
+        propertySources.addFirst(testParameters);
         context.load(ClientServerTest.class, "beans.xml");
         context.refresh();
     }
     
-    @AfterClass
-    public static void tearDown() throws Exception {
+    @Override
+    protected void tearDown() throws Exception {
         context.close();
+        context = null;
         
         server.stop();
+        server = null;
     }
     
-    @Test
-    public void test() throws Exception {
+    @Override
+    protected void runTest() throws Throwable {
         JDOMSource source = new JDOMSource(new SAXBuilder().build(ClientServerTest.class.getResourceAsStream("request.xml")).getRootElement());
         JDOMResult result = new JDOMResult();
         context.getBean(WebServiceTemplate.class).sendSourceAndReceiveToResult(source, result);

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/beans.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/beans.xml?rev=1507659&r1=1507658&r2=1507659&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/beans.xml (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/beans.xml Sat Jul 27 15:06:58 2013
@@ -18,14 +18,20 @@
   ~ under the License.
   -->
 <beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:util="http://www.springframework.org/schema/util"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
 
     <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
     
     <bean class="org.springframework.ws.client.core.WebServiceTemplate">
         <constructor-arg>
-            <bean class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory"/>
+            <bean class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory">
+                <property name="soapVersion">
+                    <util:constant static-field="org.springframework.ws.soap.SoapVersion.${soapVersion}"/>
+                </property>
+            </bean>
         </constructor-arg>
         <property name="defaultUri" value="http://localhost:${port}/"/>
     </bean>

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/spring-ws-servlet.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/spring-ws-servlet.xml?rev=1507659&r1=1507658&r2=1507659&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/spring-ws-servlet.xml (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/jdom/spring-ws-servlet.xml Sat Jul 27 15:06:58 2013
@@ -19,16 +19,24 @@
   -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
        xmlns:sws="http://www.springframework.org/schema/web-services"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
          http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
     
+    <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
+    
     <context:component-scan base-package="org.apache.axiom.spring.ws.test.jdom"/>
     
-    <bean name="messageFactory" class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory"/>
+    <bean name="messageFactory" class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory">
+        <property name="soapVersion">
+            <util:constant static-field="org.springframework.ws.soap.SoapVersion.${soapVersion}"/>
+        </property>
+    </bean>
     <bean class="org.apache.axiom.spring.ws.AxiomOptimizationEnabler"/>
     
     <sws:annotation-driven/>