You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by sa...@apache.org on 2006/01/04 15:49:40 UTC
svn commit: r365921 - in /incubator/synapse/trunk/java: ./ repository/
test/org/apache/synapse/ test/org/apache/synapse/spi/injection/
test/org/apache/synapse/util/ test/rules/
Author: saminda
Date: Wed Jan 4 06:49:27 2006
New Revision: 365921
URL: http://svn.apache.org/viewcvs?rev=365921&view=rev
Log:
Added test case to test mediation between HTTP and TCP transports.
Corrected complie errors.
Added:
incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java
incubator/synapse/trunk/java/test/rules/synapse-httptcp.xml
Modified:
incubator/synapse/trunk/java/maven.xml
incubator/synapse/trunk/java/repository/axis2.xml
incubator/synapse/trunk/java/test/org/apache/synapse/TestSynapseMessage.java
incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java
Modified: incubator/synapse/trunk/java/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/maven.xml?rev=365921&r1=365920&r2=365921&view=diff
==============================================================================
--- incubator/synapse/trunk/java/maven.xml (original)
+++ incubator/synapse/trunk/java/maven.xml Wed Jan 4 06:49:27 2006
@@ -126,6 +126,30 @@
<copy file="repository/axis2.xml"
tofile="target/synapse-repository-sendonAxis2/axis2.xml"/>
+ <echo message="-----------Creating Testing Repository - SendonAxis2Tcp ----------"/>
+ <mkdir dir="target/synapse-repository-sendonAxis2"/>
+
+ <copy file="target/npe.aar"
+ tofile="target/synapse-repository-sendonAxis2Tcp/services/npe.aar"/>
+ <copy file="synapse-test-resources/axis2/modules/addressing.mar"
+ tofile="target/synapse-repository-sendonAxis2Tcp/modules/addressing.mar"/>
+ <copy file="repository/axis2.xml"
+ tofile="target/synapse-repository-sendonAxis2Tcp/axis2.xml"/>
+
+ <echo message="-----------Creating Testing Repository - HttpTcp ----------"/>
+ <mkdir dir="target/synapse-repository-httptcp"/>
+
+ <copy file="target/emptymediator.aar"
+ tofile="target/synapse-repository-httptcp/services/emptymediator.aar"/>
+ <copy file="target/synapse.aar"
+ tofile="target/synapse-repository-httptcp/services/synapse.aar"/>
+ <copy file="synapse-test-resources/axis2/modules/addressing.mar"
+ tofile="target/synapse-repository-httptcp/modules/addressing.mar"/>
+ <copy file="synapse-test-resources/axis2/axis2.xml"
+ tofile="target/synapse-repository-httptcp/axis2.xml"/>
+ <copy file="test/rules/synapse-httptcp.xml"
+ tofile="target/synapse-repository-httptcp/synapse.xml"/>
+
<echo message="-----------Creating Testing Repository - EnvironmentAware ----------"/>
<mkdir dir="target/synapse-repository-environmentaware"/>
Modified: incubator/synapse/trunk/java/repository/axis2.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/repository/axis2.xml?rev=365921&r1=365920&r2=365921&view=diff
==============================================================================
--- incubator/synapse/trunk/java/repository/axis2.xml (original)
+++ incubator/synapse/trunk/java/repository/axis2.xml Wed Jan 4 06:49:27 2006
@@ -92,7 +92,7 @@
<!-- Global Modules -->
<!-- ================================================= -->
<!-- Comment this to disable Addressing -->
- <!--<module ref="addressing"/>-->
+ <module ref="addressing"/>
<!--Configuring module , providing parameters for modules whether they refer or not-->
Modified: incubator/synapse/trunk/java/test/org/apache/synapse/TestSynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/TestSynapseMessage.java?rev=365921&r1=365920&r2=365921&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/TestSynapseMessage.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/TestSynapseMessage.java Wed Jan 4 06:49:27 2006
@@ -29,7 +29,7 @@
ConfigurationContextFactory conFac =
new ConfigurationContextFactory();
ConfigurationContext configCtx = conFac
- .buildConfigurationContext(testingRepository);
+ .createConfigurationContextFromFileSystem(testingRepository);
msgCtx = new MessageContext(configCtx);
msgCtx.setServerSide(true);
Added: incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java?rev=365921&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java Wed Jan 4 06:49:27 2006
@@ -0,0 +1,61 @@
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.transport.tcp.TCPServer;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EvnSetup;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*
+*/
+
+public class HTTPToTCPMessageMediationTest extends TestCase {
+ private SimpleHTTPServer synapseServer;
+ private TCPServer axis2TcpServer;
+ private EndpointReference targetEpr = new EndpointReference(
+ "http://127.0.0.1:5043/axis2/services/anonymous");
+
+ public void setUp() throws Exception {
+ synapseServer = new SimpleHTTPServer("target/synapse-repository-httptcp",
+ 5043);
+ /**
+ * axis2TcpServer is the one who holds the actual service
+ */
+ axis2TcpServer =
+ new TCPServer(8090,"target/synapse-repository-sendonAxis2Tcp");
+ synapseServer.start();
+ axis2TcpServer.start();
+ }
+
+ protected void tearDown() throws Exception {
+ synapseServer.stop();
+ axis2TcpServer.stop();
+ }
+
+ public void testSendProcessor() throws Exception {
+ ServiceClient serviceClient = new ServiceClient();
+ Options options = new Options();
+ options.setTo(targetEpr);
+ serviceClient.setOptions(options);
+ OMElement response = serviceClient.sendReceive(Axis2EvnSetup.payload());
+ assertEquals("Synapse Testing String_Response", response.getText());
+
+ }
+
+}
Modified: incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java?rev=365921&r1=365920&r2=365921&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java Wed Jan 4 06:49:27 2006
@@ -41,7 +41,7 @@
throws AxisFault {
ConfigurationContextFactory conFac = new ConfigurationContextFactory();
ConfigurationContext configCtx = conFac
- .buildConfigurationContext(testingRepository);
+ .createConfigurationContextFromFileSystem(testingRepository);
MessageContext msgCtx = new MessageContext(configCtx);
msgCtx.setEnvelope(testEnvSetup());
msgCtx.setServerSide(true);
Added: incubator/synapse/trunk/java/test/rules/synapse-httptcp.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/rules/synapse-httptcp.xml?rev=365921&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/rules/synapse-httptcp.xml (added)
+++ incubator/synapse/trunk/java/test/rules/synapse-httptcp.xml Wed Jan 4 06:49:27 2006
@@ -0,0 +1,13 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+ <stage name="xpath">
+ <xpath expr="//ns:response_text" xmlns:ns="urn:text-body">
+ <send/>
+ </xpath>
+ <xpath expr="//ns:text" xmlns:ns="urn:text-body">
+ <engage-addressing-in/>
+ <header type="to" value="tcp://localhost:8090/axis2/services/npe"/>
+ <header type="action" value="urn:synapse/sendon"/>
+ <send/>
+ </xpath>
+ </stage>
+</synapse>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org