View Javadoc

1   /*
2    * $Id: AsynchronousSslMule1854TestCase.java 22450 2011-07-19 08:20:41Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.ssl.issues;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.junit4.FunctionalTestCase;
16  import org.mule.tck.junit4.rule.DynamicPort;
17  
18  import org.junit.Rule;
19  import org.junit.Test;
20  
21  import static org.junit.Assert.assertEquals;
22  import static org.junit.Assert.assertNotNull;
23  
24  public class AsynchronousSslMule1854TestCase extends FunctionalTestCase
25  {
26  
27      @Rule
28      public DynamicPort dynamicPort1 = new DynamicPort("port1");
29  
30      @Rule
31      public DynamicPort dynamicPort2 = new DynamicPort("port2");
32  
33      @Rule
34      public DynamicPort dynamicPort3 = new DynamicPort("port3");
35  
36      @Override
37      protected String getConfigResources()
38      {
39          return "ssl-functional-test.xml";
40      }
41  
42      @Test
43      public void testAsynchronous() throws Exception
44      {
45          MuleClient client = new MuleClient(muleContext);
46          client.dispatch("asyncEndpoint", TEST_MESSAGE, null);
47          // MULE-2757
48          Thread.sleep(100);
49          MuleMessage response = client.request("asyncEndpoint", 5000);
50          assertNotNull("Response is null", response);
51          assertEquals(TEST_MESSAGE + " Received Async", response.getPayloadAsString());
52      }
53  
54  }