Author: bsnyder
Date: Fri Feb 23 10:51:20 2007
New Revision: 511046

URL: http://svn.apache.org/viewvc?view=rev&rev=511046
Log:
Building out the SerializedMarshalerTest for SM-856.

Modified:
    
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/pom.xml
    
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/SerializedMarshalerTest.java

Modified: 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/pom.xml?view=diff&rev=511046&r1=511045&r2=511046
==============================================================================
--- 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/pom.xml
 (original)
+++ 
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/pom.xml
 Fri Feb 23 10:51:20 2007
@@ -192,6 +192,12 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>${spring-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>xstream</groupId>
       <artifactId>xstream</artifactId>
       <version>1.1.3</version>

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=511046&r1=511045&r2=511046
==============================================================================
--- 
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 10:51:20 2007
@@ -32,6 +32,7 @@
         NormalizedMessage in = me.createMessage();
 
                String xmlRequest = marshal(request.getInputStream());
+               System.out.println("XML: " + xmlRequest);
                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/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=511046&r1=511045&r2=511046
==============================================================================
--- 
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 10:51:20 2007
@@ -5,17 +5,22 @@
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOut;
+import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
 
 import junit.framework.TestCase;
 
 import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.components.util.EchoComponent;
 import org.apache.servicemix.http.HttpComponent;
 import org.apache.servicemix.http.HttpEndpointType;
+import org.apache.servicemix.jbi.container.ActivationSpec;
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.springframework.mock.web.MockHttpServletRequest;
+import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
+import org.w3c.dom.DocumentFragment;
 
 public class SerializedMarshalerTest extends TestCase {
        
@@ -41,6 +46,7 @@
                ep.setService(new QName("urn:httpconsumer", "HttpConsumer"));
                ep.setEndpoint("HttpConsumer");
                ep.setLocationURI("http://localhost:8192/service";);
+               ep.setTargetService(new 
QName("http://http.servicemix.org/Test";, "ConsumerInOut"));
                
                SerializedMarshaler marshaler = new SerializedMarshaler();
                ep.setMarshaler(marshaler);
@@ -49,17 +55,27 @@
         component.setEndpoints(new HttpEndpointType[] { ep });
                container.activateComponent(component, "HttpConsumer");
                
+               EchoComponent echo = new EchoComponent();
+        ActivationSpec asReceiver = new ActivationSpec("echo", echo);
+        asReceiver.setService(new QName("http://http.servicemix.org/Test";, 
"ConsumerInOut"));
+        container.activateComponent(asReceiver);
+               
                container.start();
                
                DefaultServiceMixClient client = new 
DefaultServiceMixClient(container);
         InOut inout = client.createInOutExchange();
-        inout.setInterfaceName(new QName("urn:httpconsumer", "HttpConsumer"));
+        inout.setService(new QName("urn:httpconsumer", "HttpConsumer"));
+        DocumentFragment epr = 
URIResolver.createWSAEPR("http://localhost:8192/service";);
+        ServiceEndpoint se = client.getContext().resolveEndpointReference(epr);
+        inout.setEndpoint(se);
         inout.getInMessage().setContent(
                 new StreamSource(new 
ByteArrayInputStream(createRequestMessage())));
         
         long t0 = System.currentTimeMillis();
         client.sendSync(inout);
         long t1 = System.currentTimeMillis();
+        System.out.println("%%%%%%%%%%%%%%% Exchange: " + inout);
+        System.out.println("Error: " + inout.getError());
         assertTrue(inout.getStatus() == ExchangeStatus.ACTIVE);
         
         System.err.println("Executed in " + (t1 - t0) + "ms");
@@ -77,6 +93,32 @@
         System.err.println("Msg Sent [" + inputMesage + "]");
         System.err.println("Msg Recieved [" + reply + "]");
         
System.err.println("##################################################");
+       }
+       
+       public void XtestUsingSpringHttpRemoting() throws Exception {
+               HttpConsumerEndpoint ep = new HttpConsumerEndpoint();
+               ep.setService(new QName("urn:httpconsumer", "HttpConsumer"));
+               ep.setEndpoint("HttpConsumer");
+               ep.setLocationURI("http://localhost:8192/service";);
+               ep.setTargetService(new 
QName("http://http.servicemix.org/Test";, "ConsumerInOut"));
+               
+               SerializedMarshaler marshaler = new SerializedMarshaler();
+               ep.setMarshaler(marshaler);
+               
+               HttpComponent component = new HttpComponent();
+        component.setEndpoints(new HttpEndpointType[] { ep });
+               container.activateComponent(component, "HttpConsumer");
+               
+               EchoComponent echo = new EchoComponent();
+        ActivationSpec asReceiver = new ActivationSpec("echo", echo);
+        asReceiver.setService(new QName("http://http.servicemix.org/Test";, 
"ConsumerInOut"));
+        container.activateComponent(asReceiver);
+               
+               container.start();
+               
+               HttpInvokerProxyFactoryBean pfb = new 
HttpInvokerProxyFactoryBean();
+               pfb.setServiceInterface(Person.class);
+               pfb.setServiceUrl("http://localhost:8192/service";);
        }
 
        private byte[] createRequestMessage() {


Reply via email to