Author: bimargulies
Date: Fri Jan 18 06:33:34 2008
New Revision: 613174
URL: http://svn.apache.org/viewvc?rev=613174&view=rev
Log:
Work on the state of MTOM in Aegis.
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
(with props)
incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml (with
props)
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AbstractAegisIoImpl.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AbstractAegisIoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AbstractAegisIoImpl.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AbstractAegisIoImpl.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AbstractAegisIoImpl.java
Fri Jan 18 06:33:34 2008
@@ -24,7 +24,6 @@
import javax.xml.validation.Schema;
-import org.apache.cxf.common.util.SOAPConstants;
import org.apache.cxf.databinding.DataReader;
import org.apache.cxf.interceptor.Fault;
@@ -57,13 +56,7 @@
/** [EMAIL PROTECTED]/
public void setProperty(String prop, Object value) {
- if (SOAPConstants.MTOM_ENABLED.equals(prop)) {
- if (value instanceof String) {
- context.setMtomEnabled(Boolean.valueOf((String)value));
- } else if (value instanceof Boolean) {
- context.setMtomEnabled((Boolean)value);
- }
- } else if (DataReader.FAULT.equals(prop)) {
+ if (DataReader.FAULT.equals(prop)) {
context.setFault((Fault)value);
}
}
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
Fri Jan 18 06:33:34 2008
@@ -81,6 +81,7 @@
private Set<Type> rootTypes;
private Map<Class<?>, String> beanImplementationMap;
private Configuration configuration;
+ private boolean mtomEnabled;
/**
* Construct a context.
@@ -319,6 +320,18 @@
public void setRootClasses(Set<Class<?>> rootClasses) {
this.rootClasses = rootClasses;
+ }
+
+ /**
+ * Is MTOM enabled in this context?
+ * @return
+ */
+ public boolean isMtomEnabled() {
+ return mtomEnabled;
+ }
+
+ public void setMtomEnabled(boolean mtomEnabled) {
+ this.mtomEnabled = mtomEnabled;
}
}
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
Fri Jan 18 06:33:34 2008
@@ -37,7 +37,6 @@
private AegisContext globalContext;
private Collection<Attachment> attachments;
private Fault fault;
- private boolean mtomEnabled;
private Map<Class<?>, Object> properties;
public Context(AegisContext aegisContext) {
@@ -78,13 +77,9 @@
}
public boolean isMtomEnabled() {
- return mtomEnabled;
+ return globalContext.isMtomEnabled();
}
- public void setMtomEnabled(boolean isMtomEnabled) {
- this.mtomEnabled = isMtomEnabled;
- }
-
// bus-style properties for internal state management.
public <T> T getProperty(Class<T> key) {
return key.cast(properties.get(key));
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Fri Jan 18 06:33:34 2008
@@ -101,6 +101,7 @@
private boolean isInitialized;
private Set<String> overrideTypes;
private Configuration configuration;
+ private boolean mtomEnabled;
public AegisDatabinding() {
super();
@@ -121,6 +122,9 @@
if (configuration != null) {
aegisContext.setConfiguration(configuration);
}
+ if (mtomEnabled) {
+ aegisContext.setMtomEnabled(true);
+ }
aegisContext.initialize();
}
isInitialized = true;
@@ -553,5 +557,13 @@
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
+ }
+
+ public boolean isMtomEnabled() {
+ return mtomEnabled;
+ }
+
+ public void setMtomEnabled(boolean mtomEnabled) {
+ this.mtomEnabled = mtomEnabled;
}
}
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
Fri Jan 18 06:33:34 2008
@@ -95,12 +95,6 @@
attachments.add(att);
- String contentType = getContentType(object, context);
- if (contentType != null) {
- MessageWriter mt = writer.getAttributeWriter(XML_MIME_TYPE);
- mt.writeValue(contentType);
- }
-
MessageWriter include = writer.getElementWriter(XOP_INCLUDE);
MessageWriter href = include.getAttributeWriter(XOP_HREF);
href.writeValue("cid:" + id);
Modified:
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java
(original)
+++
incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java
Fri Jan 18 06:33:34 2008
@@ -29,7 +29,7 @@
import org.junit.Test;
/**
- * This test ensures that we're handling inheritance of itnerfaces correctly.
+ * This test ensures that we're handling inheritance of interfaces correctly.
* Since we can't do multiple parent inheritance in XML schema, which
interfaces
* require, we just don't allow interface inheritance period.
*
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java?rev=613174&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
Fri Jan 18 06:33:34 2008
@@ -0,0 +1,79 @@
+/**
+ * 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.cxf.systest.aegis.mtom;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.systest.aegis.mtom.fortest.DataHandlerBean;
+import org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl;
+import org.junit.Test;
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+/**
+ *
+ */
+public class MtomTest extends AbstractDependencyInjectionSpringContextTests {
+
+ private org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl impl;
+ private org.apache.cxf.systest.aegis.mtom.fortest.MtomTest client;
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[] {"classpath:mtomTestBeans.xml"};
+ }
+
+ private void getClient() throws Exception {
+ AegisDatabinding aegisBinding = new AegisDatabinding();
+ aegisBinding.setMtomEnabled(true);
+ ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+ proxyFac.setDataBinding(aegisBinding);
+ proxyFac.setAddress("http://localhost:9002/mtom");
+
proxyFac.setServiceClass(org.apache.cxf.systest.aegis.mtom.fortest.MtomTest.class);
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put("mtom-enabled", Boolean.TRUE);
+ proxyFac.setProperties(props);
+ proxyFac.getOutInterceptors().add(new LoggingOutInterceptor());
+ client =
(org.apache.cxf.systest.aegis.mtom.fortest.MtomTest)proxyFac.create();
+ impl = (MtomTestImpl)applicationContext.getBean("mtomImpl");
+ }
+
+ @Test
+ public void testAcceptDataHandler() throws Exception {
+ getClient();
+ DataHandlerBean dhBean = new DataHandlerBean();
+ dhBean.setName("some name");
+ // some day, we might need this to be higher than some threshold.
+ String someData = "This is the cereal shot from guns.";
+ DataHandler dataHandler = new DataHandler(someData,
"text/plain;charset=utf-8");
+ dhBean.setDataHandler(dataHandler);
+ client.acceptDataHandler(dhBean);
+ DataHandlerBean accepted = impl.getLastDhBean();
+ assertNotNull(accepted);
+ String data = (String) accepted.getDataHandler().getContent();
+ assertNotNull(data);
+ }
+
+}
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java
Fri Jan 18 06:33:34 2008
@@ -34,6 +34,8 @@
import org.apache.cxf.BusFactory;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsClientProxy;
import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
@@ -104,7 +106,7 @@
}
}
- @org.junit.Ignore
+ @org.junit.Ignore // see CXF-1395
@Test
public void testMtoMString() throws Exception {
TestMtom mtomPort = createPort(MTOM_SERVICE, MTOM_PORT,
TestMtom.class, true, false);
@@ -141,6 +143,9 @@
jaxwsEndpoint.getBinding().getInInterceptors().add(new
TestMultipartMessageInterceptor());
jaxwsEndpoint.getBinding().getOutInterceptors().add(new
TestAttachmentOutInterceptor());
}
+
+ jaxwsEndpoint.getBinding().getInInterceptors().add(new
LoggingInInterceptor());
+ jaxwsEndpoint.getBinding().getOutInterceptors().add(new
LoggingOutInterceptor());
Client client = new ClientImpl(bus, jaxwsEndpoint);
InvocationHandler ih = new JaxWsClientProxy(client,
jaxwsEndpoint.getJaxwsBinding());
Added: incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml?rev=613174&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml (added)
+++ incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml Fri Jan
18 06:33:34 2008
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:simple="http://cxf.apache.org/simple"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
+http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/simple
+http://cxf.apache.org/schemas/simple.xsd
+http://cxf.apache.org/jaxws
+http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"
/>
+
+ <bean id="mtomImpl"
+ class="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl"
/>
+
+ <simple:server address="http://localhost:9002/mtom"
+
serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTest">
+ <simple:dataBinding>
+ <bean
+
class="org.apache.cxf.aegis.databinding.AegisDatabinding">
+ <property name="mtomEnabled" value="true" />
+ </bean>
+ </simple:dataBinding>
+ <simple:serviceBean>
+ <ref bean="mtomImpl" />
+ </simple:serviceBean>
+ <simple:serviceFactory>
+ <bean
+
class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
+ <property name="properties">
+ <map>
+ <entry key="mtom-enabled">
+ <list>
+
<value>true</value>
+ </list>
+ </entry>
+ </map>
+ </property>
+ </bean>
+ </simple:serviceFactory>
+ </simple:server>
+
+</beans>
\ No newline at end of file
Propchange: incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl?rev=613174&r1=613173&r2=613174&view=diff
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl
(original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/mtom_xop.wsdl Fri Jan
18 06:33:34 2008
@@ -36,7 +36,7 @@
<complexType name="XopStringType">
<sequence>
<element name="name" type="xsd:string" />
- <element name="attachinfo" type="xsd:base64Binary"
xmime:expectedContentTypes="text/plain"/>
+ <element name="attachinfo" type="xsd:base64Binary"
xmime:expectedContentTypes="text/plain; charset=utf-8"/>
</sequence>
</complexType>
<element name="testXop" type="types:XopType" />