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