View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.issues;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.module.client.MuleClient;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  import static org.junit.Assert.assertNotNull;
18  
19  public class CustomFilterMule2437TestCase extends FunctionalTestCase
20  {
21  
22      private static final long TIMEOUT = 3000L;
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "issues/custom-filter-mule-2437-test.xml";
28      }
29  
30      @Test
31      public void testVowels() throws Exception
32      {
33          doTest("aei", "vm://vowels");
34      }
35  
36      @Test
37      public void testConsonants() throws Exception
38      {
39          doTest("zyx", "vm://consonants");
40      }
41  
42      protected void doTest(String message, String destination) throws Exception
43      {
44          MuleClient client = new MuleClient(muleContext);
45          client.dispatch("vm://in", new DefaultMuleMessage(message, muleContext));
46          MuleMessage response = client.request(destination, TIMEOUT);
47          assertNotNull(response);
48          assertEquals(message, response.getPayloadAsString());
49      }
50  
51  }