Author: veithen
Date: Tue Jun 3 18:47:45 2014
New Revision: 1599747
URL: http://svn.apache.org/r1599747
Log:
AXIOM-447 - Iteration 4 - Tests:
* Make it possible to select the Axiom implementation.
* Added test cases for DOOM (not working yet).
Added:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java
(with props)
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java
(with props)
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
- copied, changed from r1599604,
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java
Removed:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java
Modified:
webservices/axiom/trunk/axiom-spring-ws/pom.xml
webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MessageFactoryConfigurator.java
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SimpleMessageFactoryConfigurator.java
webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/axiom-message-factory.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=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/pom.xml (original)
+++ webservices/axiom/trunk/axiom-spring-ws/pom.xml Tue Jun 3 18:47:45 2014
@@ -116,7 +116,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>**/SpringWSTest.java</include>
+ <include>**/LLOMSpringWSTest.java</include>
</includes>
</configuration>
</plugin>
Modified:
webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java?rev=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
Tue Jun 3 18:47:45 2014
@@ -38,18 +38,30 @@ import org.springframework.ws.soap.SoapV
import org.springframework.ws.transport.TransportConstants;
import org.springframework.ws.transport.TransportInputStream;
-public class AxiomSoapMessageFactory implements SoapMessageFactory,
InitializingBean {
+public final class AxiomSoapMessageFactory implements SoapMessageFactory,
InitializingBean {
+ private String feature = "default";
private SoapVersion soapVersion = SoapVersion.SOAP_11;
private OMMetaFactory metaFactory;
private SOAPFactory soapFactory;
+ /**
+ * Set the feature to request when looking up the {@link OMMetaFactory}.
This effectively
+ * selects the Axiom implementation that will be used. By default, Axiom
supports
+ * {@link OMAbstractFactory#FEATURE_DEFAULT} and {@link
OMAbstractFactory#FEATURE_DOM}.
+ *
+ * @param feature
+ * the feature to pass to {@link
OMAbstractFactory#getMetaFactory(String)}
+ */
+ public void setFeature(String feature) {
+ this.feature = feature;
+ }
+
public void setSoapVersion(SoapVersion soapVersion) {
this.soapVersion = soapVersion;
}
public void afterPropertiesSet() throws Exception {
- // TODO: make the implementation configurable
- metaFactory = OMAbstractFactory.getMetaFactory();
+ metaFactory = OMAbstractFactory.getMetaFactory(feature);
if (soapVersion == SoapVersion.SOAP_11) {
soapFactory = metaFactory.getSOAP11Factory();
} else if (soapVersion == SoapVersion.SOAP_12) {
Added:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java?rev=1599747&view=auto
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java
(added)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java
Tue Jun 3 18:47:45 2014
@@ -0,0 +1,42 @@
+/*
+ * 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.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.mock.env.MockPropertySource;
+
+public final class AxiomMessageFactoryConfigurator extends
MessageFactoryConfigurator {
+ private final String feature;
+
+ public AxiomMessageFactoryConfigurator(String feature) {
+ super("axiom-" + feature);
+ this.feature = feature;
+ }
+
+ @Override
+ public void configure(GenericApplicationContext context) {
+ MockPropertySource propertySource = new
MockPropertySource("axiom-properties");
+ propertySource.setProperty("axiom.feature", feature);
+ context.getEnvironment().getPropertySources().addLast(propertySource);
+ new XmlBeanDefinitionReader(context).loadBeanDefinitions(new
ClassPathResource(
+ "axiom-message-factory.xml",
AxiomMessageFactoryConfigurator.class));
+ }
+}
Propchange:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/AxiomMessageFactoryConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java?rev=1599747&view=auto
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java
(added)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java
Tue Jun 3 18:47:45 2014
@@ -0,0 +1,32 @@
+/*
+ * 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.om.OMAbstractFactory;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class DOOMSpringWSTest extends TestCase {
+ public static TestSuite suite() {
+ SpringWSTestSuiteBuilder builder = new SpringWSTestSuiteBuilder(new
AxiomMessageFactoryConfigurator(OMAbstractFactory.FEATURE_DOM),
MessageFactoryConfigurator.SAAJ);
+
+ return builder.build();
+ }
+}
Propchange:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/DOOMSpringWSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
(from r1599604,
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/LLOMSpringWSTest.java?p2=webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java&p1=webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java&r1=1599604&r2=1599747&rev=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTest.java
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/LLOMSpringWSTest.java
Tue Jun 3 18:47:45 2014
@@ -18,12 +18,14 @@
*/
package org.apache.axiom.spring.ws.test;
+import org.apache.axiom.om.OMAbstractFactory;
+
import junit.framework.TestCase;
import junit.framework.TestSuite;
-public class SpringWSTest extends TestCase {
+public class LLOMSpringWSTest extends TestCase {
public static TestSuite suite() {
- SpringWSTestSuiteBuilder builder = new
SpringWSTestSuiteBuilder(MessageFactoryConfigurator.AXIOM,
MessageFactoryConfigurator.SAAJ);
+ SpringWSTestSuiteBuilder builder = new SpringWSTestSuiteBuilder(new
AxiomMessageFactoryConfigurator(OMAbstractFactory.FEATURE_DEFAULT),
MessageFactoryConfigurator.SAAJ);
return builder.build();
}
Modified:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MessageFactoryConfigurator.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MessageFactoryConfigurator.java?rev=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MessageFactoryConfigurator.java
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/MessageFactoryConfigurator.java
Tue Jun 3 18:47:45 2014
@@ -25,11 +25,18 @@ import org.springframework.ws.soap.SoapV
/**
* Defines a particular {@link SoapMessageFactory} configuration.
*/
-public interface MessageFactoryConfigurator {
- MessageFactoryConfigurator SAAJ = new
SimpleMessageFactoryConfigurator("saaj", new
ClassPathResource("saaj-message-factory.xml",
MessageFactoryConfigurator.class));
- MessageFactoryConfigurator AXIOM = new
SimpleMessageFactoryConfigurator("axiom", new
ClassPathResource("axiom-message-factory.xml",
MessageFactoryConfigurator.class));
+public abstract class MessageFactoryConfigurator {
+ public static final MessageFactoryConfigurator SAAJ = new
SimpleMessageFactoryConfigurator("saaj", new
ClassPathResource("saaj-message-factory.xml",
MessageFactoryConfigurator.class));
- String getName();
+ private final String name;
+
+ public MessageFactoryConfigurator(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
/**
* Configure a {@link SoapMessageFactory} in the given application
context. The method must
@@ -43,5 +50,5 @@ public interface MessageFactoryConfigura
*
* @param context
*/
- void configure(GenericApplicationContext context);
+ public abstract void configure(GenericApplicationContext context);
}
Modified:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java?rev=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
Tue Jun 3 18:47:45 2014
@@ -75,7 +75,7 @@ public abstract class ScenarioTestCase e
server.start();
context = new GenericXmlApplicationContext();
- MockPropertySource propertySource = new MockPropertySource();
+ MockPropertySource propertySource = new
MockPropertySource("client-properties");
propertySource.setProperty("port", connector.getLocalPort());
context.getEnvironment().getPropertySources().replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
propertySource);
configureContext(context,
config.getClientMessageFactoryConfigurator(), "client.xml");
Modified:
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SimpleMessageFactoryConfigurator.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SimpleMessageFactoryConfigurator.java?rev=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SimpleMessageFactoryConfigurator.java
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SimpleMessageFactoryConfigurator.java
Tue Jun 3 18:47:45 2014
@@ -22,19 +22,14 @@ import org.springframework.beans.factory
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.Resource;
-public final class SimpleMessageFactoryConfigurator implements
MessageFactoryConfigurator {
- private final String name;
+public final class SimpleMessageFactoryConfigurator extends
MessageFactoryConfigurator {
private final Resource resource;
public SimpleMessageFactoryConfigurator(String name, Resource resource) {
- this.name = name;
+ super(name);
this.resource = resource;
}
- public final String getName() {
- return name;
- }
-
public void configure(GenericApplicationContext context) {
new XmlBeanDefinitionReader(context).loadBeanDefinitions(resource);
}
Modified:
webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/axiom-message-factory.xml
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/axiom-message-factory.xml?rev=1599747&r1=1599746&r2=1599747&view=diff
==============================================================================
---
webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/axiom-message-factory.xml
(original)
+++
webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/axiom-message-factory.xml
Tue Jun 3 18:47:45 2014
@@ -27,6 +27,7 @@
<property name="soapVersion">
<util:constant
static-field="org.springframework.ws.soap.SoapVersion.${soapVersion}"/>
</property>
+ <property name="feature" value="${axiom.feature}"/>
</bean>
<bean class="org.apache.axiom.spring.ws.AxiomOptimizationEnabler"/>
</beans>