View Javadoc

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