You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by bs...@apache.org on 2007/02/23 20:14:39 UTC

svn commit: r511056 - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src: main/java/org/apache/servicemix/http/endpoints/ test/java/org/apache/servicemix/http/endpoints/

Author: bsnyder
Date: Fri Feb 23 11:14:38 2007
New Revision: 511056

URL: http://svn.apache.org/viewvc?view=rev&rev=511056
Log:
Building out the SerializedMarshalerTest for SM-856 - made the PersonImpl output XML instead of a string.

Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/SerializedMarshaler.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/PersonImpl.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/SerializedMarshaler.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/SerializedMarshaler.java?view=diff&rev=511056&r1=511055&r2=511056
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/SerializedMarshaler.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/SerializedMarshaler.java Fri Feb 23 11:14:38 2007
@@ -31,8 +31,8 @@
         	context.getDeliveryChannel().createExchangeFactory().createExchange(inOnlyMepUri);
         NormalizedMessage in = me.createMessage();
 
-		String xmlRequest = marshal(request.getInputStream());
-		System.out.println("XML: " + xmlRequest);
+        InputStream is = request.getInputStream();
+		String xmlRequest = marshal(is);
 		in.setContent(new StringSource(xmlRequest));
         me.setMessage(in, "in");
         return me;

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/PersonImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/PersonImpl.java?view=diff&rev=511056&r1=511055&r2=511056
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/PersonImpl.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/PersonImpl.java Fri Feb 23 11:14:38 2007
@@ -1,5 +1,11 @@
 package org.apache.servicemix.http.endpoints;
 
+import java.io.StringWriter;
+import java.io.Writer;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
 public class PersonImpl implements Person {
 	
 	protected String givenName; 
@@ -37,7 +43,12 @@
 	}
 
 	public String toString() {
-		return "Person: " + 
-			"surName [" + surName + "], givenName [" + givenName + "], age [" + age + "]";
+		Writer w = new StringWriter();
+		XStream xstream = new XStream(new DomDriver());
+		xstream.alias("person", PersonImpl.class);
+		xstream.aliasField("given-name", PersonImpl.class, "givenName");
+		xstream.aliasField("sur-name", PersonImpl.class, "surName");
+		xstream.toXML(this, w);
+		return w.toString();
 	}
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java?view=diff&rev=511056&r1=511055&r2=511056
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java Fri Feb 23 11:14:38 2007
@@ -75,7 +75,7 @@
         client.sendSync(inout);
         long t1 = System.currentTimeMillis();
         System.out.println("%%%%%%%%%%%%%%% Exchange: " + inout);
-        System.out.println("Error: " + inout.getError());
+        System.out.println("Fault: " + inout.getFault());
         assertTrue(inout.getStatus() == ExchangeStatus.ACTIVE);
         
         System.err.println("Executed in " + (t1 - t0) + "ms");