synapse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hira...@apache.org
Subject svn commit: r1505547 - in /synapse/trunk/java/modules/integration/src/test: java/org/apache/synapse/samples/framework/ java/org/apache/synapse/samples/framework/tests/ java/org/apache/synapse/samples/framework/tests/transport/ resources/
Date Mon, 22 Jul 2013 00:16:30 GMT
Author: hiranya
Date: Mon Jul 22 00:16:29 2013
New Revision: 1505547

URL: http://svn.apache.org/r1505547
Log:
Adding sample 251 (HTTP to JMS) to the integration test suite.

Added:
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample250.java
      - copied, changed from r1505500, synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/Sample250.java
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample251.java
    synapse/trunk/java/modules/integration/src/test/resources/sample251.xml
Removed:
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/Sample250.java
Modified:
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
    synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java

Modified: synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java?rev=1505547&r1=1505546&r2=1505547&view=diff
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
(original)
+++ synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
Mon Jul 22 00:16:29 2013
@@ -37,6 +37,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
 
 /**
@@ -498,4 +499,14 @@ public abstract class SynapseTestCase ex
     protected void assertResponseReceived(SampleClientResult result) {
         assertTrue("Client did not receive the expected response", result.responseReceived());
     }
+
+    protected Axis2BackEndServerController getAxis2Server() {
+        List<BackEndServerController> servers = getBackendServerControllers();
+        for (BackEndServerController server : servers) {
+            if (server instanceof Axis2BackEndServerController) {
+                return (Axis2BackEndServerController) server;
+            }
+        }
+        return null;
+    }
 }

Modified: synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java?rev=1505547&r1=1505546&r2=1505547&view=diff
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
(original)
+++ synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
Mon Jul 22 00:16:29 2013
@@ -22,7 +22,7 @@ package org.apache.synapse.samples.frame
 import junit.framework.TestSuite;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.samples.framework.tests.Sample250;
+import org.apache.synapse.samples.framework.tests.transport.Sample250;
 import org.apache.synapse.samples.framework.tests.advanced.*;
 import org.apache.synapse.samples.framework.tests.endpoint.*;
 import org.apache.synapse.samples.framework.tests.message.*;
@@ -31,11 +31,12 @@ import org.apache.synapse.samples.framew
 import org.apache.synapse.samples.framework.tests.qos.Sample101;
 import org.apache.synapse.samples.framework.tests.rest.Sample10001;
 import org.apache.synapse.samples.framework.tests.rest.Sample800;
+import org.apache.synapse.samples.framework.tests.transport.Sample251;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 
-/*
+/**
  * This is executed by maven and handles which samples to run
  */
 public class TestSamplesHandlerSuite extends TestSuite {
@@ -206,6 +207,7 @@ public class TestSamplesHandlerSuite ext
 
         //Transport switching
         sampleClassRepo.put("250", Sample250.class);
+        sampleClassRepo.put("251", Sample251.class);
 
         //Advanced
         sampleClassRepo.put("350", Sample350.class);

Copied: synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample250.java
(from r1505500, synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/Sample250.java)
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample250.java?p2=synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample250.java&p1=synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/Sample250.java&r1=1505500&r2=1505547&rev=1505547&view=diff
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/Sample250.java
(original)
+++ synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample250.java
Mon Jul 22 00:16:29 2013
@@ -1,12 +1,9 @@
-package org.apache.synapse.samples.framework.tests;
+package org.apache.synapse.samples.framework.tests.transport;
 
 import org.apache.synapse.samples.framework.Axis2BackEndServerController;
-import org.apache.synapse.samples.framework.BackEndServerController;
 import org.apache.synapse.samples.framework.SynapseTestCase;
 import org.apache.synapse.samples.framework.clients.JMSSampleClient;
 
-import java.util.List;
-
 public class Sample250 extends SynapseTestCase {
 
     public Sample250() {
@@ -14,14 +11,7 @@ public class Sample250 extends SynapseTe
     }
 
     public void testPlaceOrder() throws Exception {
-        List<BackEndServerController> servers = getBackendServerControllers();
-        Axis2BackEndServerController axis2Server = null;
-        for (BackEndServerController server : servers) {
-            if (server instanceof Axis2BackEndServerController) {
-                axis2Server = (Axis2BackEndServerController) server;
-                break;
-            }
-        }
+        Axis2BackEndServerController axis2Server = getAxis2Server();
         if (axis2Server == null) {
             fail("Failed to load the Axis2BackEndServerController");
         }

Added: synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample251.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample251.java?rev=1505547&view=auto
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample251.java
(added)
+++ synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/transport/Sample251.java
Mon Jul 22 00:16:29 2013
@@ -0,0 +1,26 @@
+package org.apache.synapse.samples.framework.tests.transport;
+
+import org.apache.synapse.samples.framework.*;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample251 extends SynapseTestCase {
+
+    public Sample251() {
+        super(251);
+    }
+
+    public void testPlaceOrder() throws Exception {
+        Axis2BackEndServerController axis2Server = getAxis2Server();
+        if (axis2Server == null) {
+            fail("Failed to load the Axis2BackEndServerController");
+        }
+
+        assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
+        StockQuoteSampleClient client = getStockQuoteClient();
+        String trpUrl = "http://localhost:8280/services/StockQuoteProxy";
+        SampleClientResult result = client.placeOrder(null, trpUrl, null, "IBM");
+        assertResponseReceived(result);
+        Thread.sleep(2000);
+        assertEquals(1, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
+    }
+}

Added: synapse/trunk/java/modules/integration/src/test/resources/sample251.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/resources/sample251.xml?rev=1505547&view=auto
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/resources/sample251.xml (added)
+++ synapse/trunk/java/modules/integration/src/test/resources/sample251.xml Mon Jul 22 00:16:29
2013
@@ -0,0 +1,24 @@
+<synapseSample>
+    <sampleID>251</sampleID>
+    <sampleName>HTTP to JMS</sampleName>
+    <synapseConfig>
+        <!--if we don't specify the optional values, framework will use defaults-->
+        <axis2Repo>modules/integration/target/test_repos/synapse</axis2Repo>
+        <axis2Xml>modules/integration/target/test_repos/synapse/conf/axis2_jms.xml</axis2Xml>
+        <synapseXml>repository/conf/sample/synapse_sample_251.xml</synapseXml>
+    </synapseConfig>
+    <backEndServerConfig>
+        <jmsBroker id='0'>
+            <providerURL>tcp://localhost:61616</providerURL>
+            <initialNamingFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</initialNamingFactory>
+        </jmsBroker>
+        <axis2Server id='1'>
+            <axis2Repo>modules/integration/target/test_repos/axis2Server</axis2Repo>
+            <axis2Xml>modules/integration/target/test_repos/axis2Server/conf/axis2_jms.xml</axis2Xml>
+            <counterEnabled>true</counterEnabled>
+        </axis2Server>
+    </backEndServerConfig>
+    <clientConfig>
+        <clientRepo>modules/integration/target/test_repos/axis2Client</clientRepo>
+    </clientConfig>
+</synapseSample>



Mime
View raw message