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.module.client;
8   
9   import org.mule.api.MuleException;
10  
11  import org.junit.Test;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  import static org.junit.Assert.assertTrue;
16  
17  public class MuleClientTestCase extends AbstractMuleClientTestCase
18  {
19  
20      @Test
21      public void testCreateMuleClient() throws MuleException
22      {
23          assertNotNull(muleContext);
24          MuleClient muleClient = new MuleClient(muleContext);
25          assertEquals(muleContext, muleClient.getMuleContext());
26          assertTrue(muleContext.isInitialised());
27  
28          muleContext.start();
29  
30          assertTrue(muleContext.isStarted());
31          muleClient.dispatch("test://test", "message", null);
32          muleClient.send("test://test", "message", null);
33          muleClient.dispose();
34          assertTrue(muleClient.getMuleContext().isInitialised());
35          assertTrue(muleClient.getMuleContext().isStarted());
36      }
37  
38  }