You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/01/21 03:28:42 UTC
svn commit: r613732 - in /incubator/cxf/trunk:
rt/core/src/main/java/org/apache/cxf/interceptor/
systests/src/test/java/org/apache/cxf/systest/aegis/mtom/
systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/
systests/src/test/resources/
Author: bimargulies
Date: Sun Jan 20 18:28:41 2008
New Revision: 613732
URL: http://svn.apache.org/viewvc?rev=613732&view=rev
Log:
Add aegis/mtom test for the other direction.
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java
incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java?rev=613732&r1=613731&r2=613732&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java Sun Jan 20 18:28:41 2008
@@ -43,8 +43,10 @@
public void handleMessage(Message message) {
- boolean mtomEnabled = MessageUtils.isTrue(
- message.getContextualProperty(org.apache.cxf.message.Message.MTOM_ENABLED));
+ // Make it possible to step into this process in spite of Eclipse
+ // by declaring the Object.
+ Object prop = message.getContextualProperty(org.apache.cxf.message.Message.MTOM_ENABLED);
+ boolean mtomEnabled = MessageUtils.isTrue(prop);
boolean writeAtts = MessageUtils.isTrue(message.getContextualProperty(WRITE_ATTACHMENTS));
if (!mtomEnabled && !writeAtts) {
Modified: 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=613732&r1=613731&r2=613732&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java Sun Jan 20 18:28:41 2008
@@ -35,6 +35,8 @@
import org.apache.cxf.aegis.type.mtom.AbstractXOPType;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.systest.aegis.mtom.fortest.DataHandlerBean;
import org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl;
@@ -72,11 +74,24 @@
props.put("mtom-enabled", Boolean.TRUE);
}
proxyFac.setProperties(props);
- proxyFac.getOutInterceptors().add(new LoggingOutInterceptor());
+ ServerFactoryBean server = (ServerFactoryBean)applicationContext.getBean("mtom-server");
+
+ server.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+ server.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+
client = (org.apache.cxf.systest.aegis.mtom.fortest.MtomTest)proxyFac.create();
impl = (MtomTestImpl)applicationContext.getBean("mtomImpl");
}
+
+ @Test
+ public void testMtomReply() throws Exception {
+ setupForTest(true);
+ DataHandlerBean dhBean = client.produceDataHandlerBean();
+ assertNotNull(dhBean);
+ assertEquals(MtomTestImpl.STRING_DATA, dhBean.getDataHandler().getContent());
+ }
+
@Test
public void testAcceptDataHandler() throws Exception {
setupForTest(true);
@@ -143,6 +158,4 @@
wsdl);
*/
}
-
-
}
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java?rev=613732&r1=613731&r2=613732&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java Sun Jan 20 18:28:41 2008
@@ -30,4 +30,5 @@
@MTOM
public interface MtomTest {
void acceptDataHandler(@WebParam(name = "inputDhBean") DataHandlerBean dhBean);
+ DataHandlerBean produceDataHandlerBean();
}
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java?rev=613732&r1=613731&r2=613732&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java Sun Jan 20 18:28:41 2008
@@ -19,6 +19,7 @@
package org.apache.cxf.systest.aegis.mtom.fortest;
+import javax.activation.DataHandler;
import javax.jws.WebService;
/**
@@ -28,6 +29,9 @@
@javax.xml.ws.soap.MTOM
public class MtomTestImpl implements MtomTest {
+ public static final String STRING_DATA = "What rough beast, its hour come at last,"
+ + " slouches toward Bethlehem to be born?";
+
private DataHandlerBean lastDhBean;
/** {@inheritDoc}*/
@@ -37,6 +41,15 @@
public DataHandlerBean getLastDhBean() {
return lastDhBean;
+ }
+
+ public DataHandlerBean produceDataHandlerBean() {
+ DataHandlerBean dhBean = new DataHandlerBean();
+ dhBean.setName("legion");
+ // since we know that the code has no lower threshold for using attachments,
+ // we can just return a fairly short string.
+ dhBean.setDataHandler(new DataHandler(STRING_DATA, "text/plain;charset=utf-8"));
+ return dhBean;
}
}
Modified: 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=613732&r1=613731&r2=613732&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml (original)
+++ incubator/cxf/trunk/systests/src/test/resources/mtomTestBeans.xml Sun Jan 20 18:28:41 2008
@@ -22,23 +22,31 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:cxf="http://cxf.apache.org/core"
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">
+http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.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" />
+
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
<bean id="mtomImpl"
class="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl" />
- <simple:server address="http://localhost:9002/mtom"
+ <simple:server id="mtom-server" address="http://localhost:9002/mtom"
serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTest">
<simple:dataBinding>
<bean
@@ -55,9 +63,7 @@
<property name="properties">
<map>
<entry key="mtom-enabled">
- <list>
- <value>true</value>
- </list>
+ <value>true</value>
</entry>
</map>
</property>