Re: [mule-scm] [mule][25187] branches/mule-3.x/tests/integration/src/test: EE-3014: Added Message Processor notification' s test and made Node and RestrictedNode public for usage in EE tests

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [mule-scm] [mule][25187] branches/mule-3.x/tests/integration/src/test: EE-3014: Added Message Processor notification' s test and made Node and RestrictedNode public for usage in EE tests

Pablo Kraan

Luciano:


Don't commit any code in the CE repo referencing an EE issue. You have to create a CE issue and then link both. CE users have no way to access EE issues.

Also add the description of the issue in the commit message, otherwise we have to go to the issue to understand the problem.


There are many lines of commented code. Clean up that code. If some code was commented because was not working as expected, then also create an issue to track the problem.


Try to clean up MessageProcessorNotificationTestCase a bit, is really big and not easy to understand what is testing


Pablo



On Fri, Jan 11, 2013 at 1:54 PM, <[hidden email]> wrote:
Revision
25187
Author
luciano.gandini
Date
2013-01-11 10:54:29 -0600 (Fri, 11 Jan 2013)

Log Message

EE-3014: Added Message Processor notification's test and made Node and RestrictedNode public for usage in EE tests

Modified Paths

Diff

Modified: branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationPathTestCase.java (25186 => 25187)


--- branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationPathTestCase.java	2013-01-11 14:27:32 UTC (rev 25186)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationPathTestCase.java	2013-01-11 16:54:29 UTC (rev 25187)
@@ -38,19 +38,20 @@
     {
         testFlowPaths("singleMP", "/0");
         testFlowPaths("processorChain", "/0", "/0/0", "/0/1");
+        testFlowPaths("customProcessor", "/0", "/1");
     }
 
     @Test
     public void routers() throws Exception
     {
         testFlowPaths("choice", "/0", "/0/0", "/0/0/0", "/0/1", "/0/1/0", "/0/2", "/0/2/0");
-        testFlowPaths("all", "/0", "/0/0", "/0/0/0", "/0/1", "/0/1/0");
+        testFlowPaths("all", "/0", "/0/0", "/0/0/0", "/0/1", "/0/1/0", "/1");
     }
 
     @Test
     public void scopes() throws Exception
     {
-        testFlowPaths("foreach", "/0", "/0/0");
+        testFlowPaths("foreach", "/0", "/0/0", "/1");
         testFlowPaths("enricher", "/0", "/0/0", "/1", "/1/0", "/1/0/0", "/1/0/1");
         testFlowPaths("until-successful", "/0", "/0/0", "/0/0/0", "/0/0/1");
         testFlowPaths("async", "/0", "/0/0", "/0/1");
@@ -60,6 +61,8 @@
     public void filters() throws Exception
     {
         testFlowPaths("filters", "/0", "/1");
+        testFlowPaths("idempotent-msg-filter", "/0", "/1" );
+        testFlowPaths("idempotent-secure-hash-msg-filter", "/0", "/1" );
     }
 
     @Test
@@ -78,6 +81,36 @@
 
     }
 
+    @Test
+    public void requestReply() throws Exception
+    {
+        testFlowPaths("request-reply", "/0", "/1" );
+    }
+
+    @Test
+    public void multipleEndpoints() throws Exception
+    {
+        testFlowPaths("composite-source", "/0" );
+        testFlowPaths("first-successful", "/0", "/1", "/1/0", "/1/1", "/1/2", "/1/3" );
+        testFlowPaths("round-robin", "/0", "/0/0", "/0/1", "/0/2", "/1");
+    }
+
+    @Test
+    public void collections() throws Exception
+    {
+        testFlowPaths("collectionAggregator", "/0", "/1", "/2");
+        testFlowPaths("customAggregator", "/0", "/1", "/2");
+        testFlowPaths("chunkAggregator", "/0", "/1", "/2", "/3");
+        testFlowPaths("combineCollections", "/0", "/1");
+    }
+
+    @Test
+    public void wireTap() throws Exception
+    {
+        testFlowPaths("wire-tap", "/0", "/0/0", "/1");
+    }
+
+
     private void testFlowPaths(String flowName, String... nodes) throws Exception
     {
         String[] expectedPaths = generatePaths(flowName, nodes);

Modified: branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationTestCase.java (25186 => 25187)


--- branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationTestCase.java	2013-01-11 14:27:32 UTC (rev 25186)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/MessageProcessorNotificationTestCase.java	2013-01-11 16:54:29 UTC (rev 25187)
@@ -15,6 +15,7 @@
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 
 import org.junit.runners.Parameterized;
 
@@ -36,19 +37,36 @@
     @Override
     public void doTest() throws Exception
     {
+        List<String> testList = Arrays.asList("test", "with", "collection");
+
         MuleClient client = new MuleClient(muleContext);
         assertNotNull(client.send("vm://in-single", "test", null));
         assertNotNull(client.send("vm://in-processorChain", "test", null));
+        assertNotNull(client.send("vm://customProcessor", "test", null));
         assertNotNull(client.send("vm://in-choice", "test", null));
         assertNotNull(client.send("vm://in-all", "test", null));
         assertNotNull(client.send("vm://in-foreach", "test", null));
         assertNotNull(client.send("vm://in-enricher", "test", null));
-        assertNotNull(client.send("vm://in-async", "test", null));
+        //assertNotNull(client.send("vm://in-async", "test", null));
         assertNotNull(client.send("vm://in-filter", "test", null));
+        assertNotNull(client.send("vm://idem-msg-filter", "test", null));
+        assertNotNull(client.send("vm://idem-sh-msg-filter", "test", null));
         assertNotNull(client.send("vm://in-subflow", "test", null));
         assertNotNull(client.send("vm://in-catch", "test", null));
         assertNotNull(client.send("vm://in-rollback", "test", null));
         assertNotNull(client.send("vm://in-choice-es", "test", null));
+        assertNotNull(client.send("vm://request-reply", "test", null));
+        assertNotNull(client.send("vm://cs1", "test", null));
+        assertNotNull(client.send("vm://cs2", "test", null));
+        assertNotNull(client.send("vm://cs3", "test", null));
+        assertNotNull(client.send("vm://cs4", "test" , null));
+        assertNotNull(client.send("vm://fsucc", "test", null));
+        assertNotNull(client.send("vm://round-robin", "test", null));
+        assertNotNull(client.send("vm://recipient-list", "recipient", null));
+        assertNotNull(client.send("vm://collection-agg", testList, null));
+        assertNotNull(client.send("vm://custom-agg", testList, null));
+        assertNotNull(client.send("vm://chunk-agg", "test", null));
+        assertNotNull(client.send("vm://wire-tap", "test", null));
     }
 
     @Override
@@ -62,6 +80,10 @@
                 .serial(prePost()) //logger-1
                 .serial(prePost()) //logger-2
 
+                //custom-processor
+                .serial(prePost())
+                .serial(prePost())
+
                 //choice
                 .serial(pre()) //choice
                 .serial(prePost())    //otherwise-logger
@@ -72,12 +94,14 @@
                 .serial(prePost())
                 .serial(prePost())
                 .serial(post())
+                .serial(prePost())    //MP after the Scope
 
                 //foreach
                 .serial(pre()) //foreach
                 .serial(prePost())    //logger-loop-1
                 .serial(prePost())    //logger-loop-2
                 .serial(post())
+                .serial(prePost())    //MP after the Scope
 
                 //enricher
                 .serial(prePost()) //append-string
@@ -86,16 +110,26 @@
                 .serial(prePost())
                 .serial(post())
 
-                //async
-                .serial(prePost())
-                .serial(prePost())
-                .serial(prePost())
+                ////async             //This is unstable
+                //.serial(prePost())
+                //.serial(prePost())
+                //.serial(prePost())
 
                 //filter
                 .serial(pre())
                 .serial(prePost())
                 .serial(post())
 
+                //idempotent-message-filter
+                .serial(pre())          //open message filter
+                .serial(prePost())      //message processor
+                .serial(post())         //close mf
+
+                //idempotent-secure-hash-message-filter
+                .serial(pre())          //open message filter
+                .serial(prePost())      //message processor
+                .serial(post())         //close mf
+
                 //subflow
                 .serial(prePost())
                 .serial(pre())
@@ -115,9 +149,70 @@
                 //choice-es
                 .serial(prePost())
                 .serial(prePost())
+
+                //request-reply
+                .serial(pre())
+                .serial(prePost())
+                .serial(post())
+                .serial(prePost())
+
+                //composite-source
+                .serial(prePost()) //call throw cs1
+                .serial(prePost())
+                .serial(prePost())
+                .serial(prePost()) //call throw cs4
+
+                //first-successful
+                .serial(prePost())
+                .serial(prePost())
+
+                //round-robin
+                .serial(prePost())
+                .serial(prePost())
+
+                //recipient-list
+                .serial(prePost())  //send message to the requested endpoint
+                .serial(prePost())  //log message
+
+                //collection-aggregator
+                .serial(pre())      //open Splitter, unpacks three messages
+                .serial(prePost())  //1st message on Logger
+                .serial(prePost())  //gets to Aggregator
+                .serial(prePost())  //2nd message on Logger
+                .serial(prePost())  //gets to Aggregator
+                .serial(prePost())  //3rd message on Logger
+                .serial(prePost())  //gets to Aggregator and packs the three messages, then close
+                .serial(post())     //close Splitter
+
+                //custom-aggregator
+                .serial(pre())      //open Splitter, unpacks three messages
+                .serial(prePost())  //1st message, open Aggregator
+                .serial(prePost())  //2nd message
+                .serial(pre())      //3rd message, packs the three messages
+                .serial(prePost())  //Logger process packed message
+                .serial(post())     //close Aggregator
+                .serial(post())     //close Splitter
+
+                //chunk-aggregator
+                .serial(pre())      //start Splitter
+                .serial(prePost())  //1st message on Logger
+                .serial(prePost())  //gets to Aggregator
+                .serial(prePost())  //2nd message on Logger
+                .serial(prePost())  //gets to Aggregator
+                .serial(prePost())  //3rd message on Logger
+                .serial(prePost())  //gets to Aggregator
+                .serial(prePost())  //4th message on Logger
+                .serial(pre())      //gets to Aggregator and packs four messages
+                .serial(prePost())  //packed message get to the second Logger
+                .serial(post())     //close Aggregator
+                .serial(post())     //close Splitter
+
+                //wire-tap
+                .serial(prePost())
+                .serial(prePost())
+
                 ;
     }
-
     private RestrictedNode pre()
     {
         return new Node(MessageProcessorNotification.class, MessageProcessorNotification.MESSAGE_PROCESSOR_PRE_INVOKE);

Modified: branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/Node.java (25186 => 25187)


--- branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/Node.java	2013-01-11 14:27:32 UTC (rev 25186)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/Node.java	2013-01-11 16:54:29 UTC (rev 25187)
@@ -34,7 +34,7 @@
  * <p>More exactly, we specify a tree and a traversal - the traversal is hardcoded below, and implicit in
  * the instructions above.
  */
-class Node implements RestrictedNode
+public class Node implements RestrictedNode
 {
 
     // enumeration describing result of checking at this node

Modified: branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/RestrictedNode.java (25186 => 25187)


--- branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/RestrictedNode.java	2013-01-11 14:27:32 UTC (rev 25186)
+++ branches/mule-3.x/tests/integration/src/test/java/org/mule/context/notification/RestrictedNode.java	2013-01-11 16:54:29 UTC (rev 25187)
@@ -16,7 +16,7 @@
  * An implementation detail - this enforces the guarantee that once
  * {@link Node#serial(RestrictedNode)} is called, {@link Node#parallel(RestrictedNode)} cannot be.
  */
-interface RestrictedNode 
+public interface RestrictedNode
 {
 
     public RestrictedNode serial(RestrictedNode node);

Modified: branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/notifications/message-processor-notification-test-flow.xml (25186 => 25187)


--- branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/notifications/message-processor-notification-test-flow.xml	2013-01-11 14:27:32 UTC (rev 25186)
+++ branches/mule-3.x/tests/integration/src/test/resources/org/mule/test/integration/notifications/message-processor-notification-test-flow.xml	2013-01-11 16:54:29 UTC (rev 25187)
@@ -3,12 +3,14 @@
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
+      xmlns:http="http://www.mulesoft.org/schema/mule/http"
       xmlns:test="http://www.mulesoft.org/schema/mule/test"
       xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
                http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
                http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/current/mule-test.xsd
-               http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd">
+               http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
+               http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
 
     <notifications>
         <notification event="MESSAGE-PROCESSOR"/>
@@ -35,6 +37,12 @@
         </processor-chain>
     </flow>
 
+    <flow name="customProcessor">
+        <vm:inbound-endpoint path="customProcessor" exchange-pattern="request-response"/>
+        <custom-processor class="org.mule.tck.testmodels.mule.TestMessageProcessor" />
+        <logger level="INFO"/>
+    </flow>
+
     <flow name="choice">
         <vm:inbound-endpoint path="in-choice" exchange-pattern="request-response"/>
         <choice>
@@ -60,6 +68,7 @@
                 <logger/>
             </processor-chain>
         </all>
+        <logger message="Log after a scope" />
     </flow>
 
     <flow name="foreach">
@@ -67,6 +76,7 @@
         <foreach collection="#[{'one','two'}]">
             <logger/>
         </foreach>
+        <logger message="Log after a scope" />
     </flow>
 
     <flow name="enricher">
@@ -111,6 +121,22 @@
         </or-filter>
     </flow>
 
+    <flow name="idempotent-msg-filter">
+        <vm:inbound-endpoint path="idem-msg-filter" exchange-pattern="request-response"/>
+        <idempotent-message-filter idExpression="#[message:id]">
+            <in-memory-store entryTTL="1000" expirationInterval="2000" maxEntries="3000"/>
+        </idempotent-message-filter>
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="idempotent-secure-hash-msg-filter">
+        <vm:inbound-endpoint path="idem-sh-msg-filter" exchange-pattern="request-response"/>
+        <idempotent-secure-hash-message-filter idExpression="#[message:id]">
+            <in-memory-store entryTTL="1000" expirationInterval="2000" maxEntries="3000"/>
+        </idempotent-secure-hash-message-filter>
+        <logger level="INFO"/>
+    </flow>
+
     <flow name="subflow">
         <vm:inbound-endpoint path="in-subflow" exchange-pattern="request-response"/>
         <echo-component/>
@@ -168,4 +194,92 @@
         <exception-strategy ref="Global_Exception_Strategy"/>
     </flow>
 
+    <flow name="request-reply">
+        <vm:inbound-endpoint path="request-reply" exchange-pattern="request-response"/>
+        <request-reply storePrefix="mainFlow">
+            <vm:outbound-endpoint path="request"/>
+            <vm:inbound-endpoint path="reply"/>
+        </request-reply>
+        <logger message="ProcessReqReplyOrder"/>
+    </flow>
+
+    <flow name="handle-request-reply">
+        <vm:inbound-endpoint path="request"/>
+        <logger message="GenerateReqReplyOrder"/>
+    </flow>
+
+    <flow name="composite-source">
+        <composite-source>
+            <vm:inbound-endpoint path="cs1" exchange-pattern="request-response"/>
+            <vm:inbound-endpoint path="cs2" exchange-pattern="request-response"/>
+            <vm:inbound-endpoint path="cs3" exchange-pattern="request-response"/>
+            <vm:inbound-endpoint path="cs4" exchange-pattern="request-response"/>
+        </composite-source>
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="first-successful">
+        <vm:inbound-endpoint path="fsucc" exchange-pattern="request-response"/>
+        <logger level="INFO"/>
+        <first-successful>
+            <http:outbound-endpoint address="http://localhost:6090/weather-forecast" />
+            <http:outbound-endpoint address="http://localhost:6091/weather-forecast" />
+            <http:outbound-endpoint address="http://localhost:6092/weather-forecast" />
+            <vm:outbound-endpoint path="dead-letter-queue" />
+        </first-successful>
+    </flow>
+
+    <flow name="round-robin">
+        <vm:inbound-endpoint path="round-robin" exchange-pattern="request-response"/>
+        <round-robin>
+            <logger message="First-RRMP"/>
+            <logger message="Second-RRMP"/>
+            <logger message="Third-RRMP"/>
+        </round-robin>
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="recipient-list">
+        <vm:inbound-endpoint path="recipient-list" exchange-pattern="request-response"/>
+        <recipient-list enableCorrelation="ALWAYS" evaluator="payload"  expression=""/>
+        <logger level="INFO"/>
+    </flow>
+
+    <vm:endpoint name="recipient" path="recipient" />
+    
+    <flow name="collectionAggregator">
+        <vm:inbound-endpoint path="collection-agg" exchange-pattern="request-response"/>
+        <collection-splitter />
+        <logger level="INFO"/>
+        <collection-aggregator failOnTimeout="false" timeout="3600" />
+    </flow>
+    
+    <flow name="customAggregator">
+        <vm:inbound-endpoint path="custom-agg" exchange-pattern="request-response"/>
+        <collection-splitter />
+        <custom-aggregator class="org.mule.routing.outbound.AggregationTestCase$Aggregator" timeout="2000" failOnTimeout="false"/>
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="chunkAggregator">
+        <vm:inbound-endpoint path="chunk-agg" exchange-pattern="request-response"/>
+        <message-chunk-splitter messageSize="1"/>
+        <logger level="INFO"/>
+        <message-chunk-aggregator/>
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="combineCollections">
+        <vm:inbound-endpoint path="combine" exchange-pattern="request-response"/>
+        <combine-collections-transformer />
+        <logger level="INFO"/>
+    </flow>
+
+    <flow name="wire-tap">
+        <vm:inbound-endpoint path="wire-tap" exchange-pattern="request-response"/>
+        <wire-tap>
+            <vm:outbound-endpoint path="tapped.channel"/>
+        </wire-tap>
+        <logger level="INFO"/>
+    </flow>
 </mule>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email