View Javadoc

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