You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/05/17 22:50:18 UTC
svn commit: r407370 - in /incubator/servicemix/trunk/servicemix-itests: ./
src/test/java/org/apache/servicemix/itests/
src/test/resources/org/apache/servicemix/itests/
Author: gnodet
Date: Wed May 17 13:50:17 2006
New Revision: 407370
URL: http://svn.apache.org/viewvc?rev=407370&view=rev
Log:
Add a simple test using http, jms, jsr181 and eip components
Added:
incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/itests/HttpJmsRoundtripTest.java
incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/httpjms.xml
incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/soap-request.xml
Modified:
incubator/servicemix/trunk/servicemix-itests/pom.xml
Modified: incubator/servicemix/trunk/servicemix-itests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-itests/pom.xml?rev=407370&r1=407369&r2=407370&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-itests/pom.xml (original)
+++ incubator/servicemix/trunk/servicemix-itests/pom.xml Wed May 17 13:50:17 2006
@@ -59,6 +59,11 @@
<artifactId>servicemix-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>servicemix-eip</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Added: incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/itests/HttpJmsRoundtripTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/itests/HttpJmsRoundtripTest.java?rev=407370&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/itests/HttpJmsRoundtripTest.java (added)
+++ incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/itests/HttpJmsRoundtripTest.java Wed May 17 13:50:17 2006
@@ -0,0 +1,36 @@
+package org.apache.servicemix.itests;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.servicemix.jbi.util.FileUtil;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class HttpJmsRoundtripTest extends SpringTestSupport {
+
+ @Override
+ protected AbstractXmlApplicationContext createBeanFactory() {
+ return new ClassPathXmlApplicationContext("org/apache/servicemix/itests/httpjms.xml");
+ }
+
+ public void test() throws Exception {
+ URLConnection connection = new URL("http://localhost:8192/Service/").openConnection();
+ connection.setDoOutput(true);
+ connection.setDoInput(true);
+ OutputStream os = connection.getOutputStream();
+ // Post the request file.
+ InputStream fis = getClass().getResourceAsStream("soap-request.xml");
+ FileUtil.copyInputStream(fis, os);
+ // Read the response.
+ InputStream is = connection.getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ FileUtil.copyInputStream(is, baos);
+ System.err.println(baos.toString());
+ }
+
+}
Added: incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/httpjms.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/httpjms.xml?rev=407370&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/httpjms.xml (added)
+++ incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/httpjms.xml Wed May 17 13:50:17 2006
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+ xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
+ xmlns:http="http://servicemix.apache.org/http/1.0"
+ xmlns:eip="http://servicemix.apache.org/eip/1.0"
+ xmlns:jms="http://servicemix.apache.org/jms/1.0"
+ xmlns:amq="http://activemq.org/config/1.0"
+ xmlns:test="http://servicemix.org/test">
+
+ <sm:container id="jbi" embedded="true" depends-on="broker">
+ <sm:activationSpecs>
+
+ <sm:activationSpec id="echo">
+ <sm:component>
+ <jsr181:component>
+ <jsr181:endpoints>
+ <jsr181:endpoint
+ pojoClass="org.apache.servicemix.itests.beans.Echo"
+ service="test:Hello"
+ endpoint="endpoint" />
+ </jsr181:endpoints>
+ </jsr181:component>
+ </sm:component>
+ </sm:activationSpec>
+
+ <sm:activationSpec>
+ <sm:component>
+ <jms:component>
+ <jms:endpoints>
+ <jms:endpoint
+ service="test:Jms"
+ endpoint="endpoint"
+ role="provider"
+ soap="false"
+ destinationStyle="queue"
+ jmsProviderDestinationName="queue/A"
+ connectionFactory="#connectionFactory" />
+ </jms:endpoints>
+ </jms:component>
+ </sm:component>
+ </sm:activationSpec>
+
+ <sm:activationSpec id="routing-slip">
+ <sm:component>
+ <eip:component>
+ <eip:endpoints>
+ <eip:static-routing-slip
+ service="test:RoutingSlip"
+ endpoint="endpoint">
+ <eip:targets>
+ <eip:exchange-target service="test:Hello" />
+ <eip:exchange-target service="test:Jms" />
+ </eip:targets>
+ </eip:static-routing-slip>
+ </eip:endpoints>
+ </eip:component>
+ </sm:component>
+ </sm:activationSpec>
+
+ <sm:activationSpec id="hello-http">
+ <sm:component>
+ <http:component>
+ <http:endpoints>
+ <http:endpoint
+ service="test:HelloHttp"
+ endpoint="endpoint"
+ targetService="test:RoutingSlip"
+ role="consumer"
+ locationURI="http://localhost:8192/Service/"
+ defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
+ soap="true" />
+ </http:endpoints>
+ </http:component>
+ </sm:component>
+ </sm:activationSpec>
+
+ </sm:activationSpecs>
+ </sm:container>
+
+ <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+ <property name="brokerURL" value="tcp://localhost:61216" />
+ </bean>
+
+ <amq:broker id="broker" persistent="false">
+ <amq:transportConnectors>
+ <amq:transportConnector uri="tcp://localhost:61216" />
+ </amq:transportConnectors>
+ </amq:broker>
+
+ <!-- Simulate the target jms endpoint -->
+ <sm:container id="external" embedded="true" useMBeanServer="false">
+ <sm:activationSpecs>
+ <sm:activationSpec id="jms">
+ <sm:component>
+ <jms:component>
+ <jms:endpoints>
+ <jms:endpoint
+ service="test:ExternalJms"
+ endpoint="endpoint"
+ targetService="test:ExternalEcho"
+ role="consumer"
+ soap="false"
+ defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
+ destinationStyle="queue"
+ jmsProviderDestinationName="queue/A"
+ connectionFactory="#connectionFactory" />
+ </jms:endpoints>
+ </jms:component>
+ </sm:component>
+ </sm:activationSpec>
+ <sm:activationSpec id="echo" service="test:ExternalEcho">
+ <sm:component>
+ <bean class="org.apache.servicemix.components.util.EchoComponent" />
+ </sm:component>
+ </sm:activationSpec>
+ </sm:activationSpecs>
+ </sm:container>
+
+</beans>
Added: incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/soap-request.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/soap-request.xml?rev=407370&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/soap-request.xml (added)
+++ incubator/servicemix/trunk/servicemix-itests/src/test/resources/org/apache/servicemix/itests/soap-request.xml Wed May 17 13:50:17 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:tns="http://servicemix.org/test/">
+ <env:Body>
+ <tns:echo>
+ <tns:msg>world</tns:msg>
+ </tns:echo>
+ </env:Body>
+</env:Envelope>