1   /*
2    * $Id: DefaultMuleContext.java 11517 2008-03-31 21:34:19Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.context;
12  
13  import org.mule.api.MuleContext;
14  import org.mule.api.MuleException;
15  import org.mule.tck.AbstractMuleTestCase;
16  
17  public class DefaultMuleContextTestCase extends AbstractMuleTestCase
18  {
19  
20      public void testDisposal() throws MuleException, InterruptedException
21      {
22          int threadsBeforeStart = Thread.activeCount();
23          MuleContext ctx = new DefaultMuleContextFactory().createMuleContext();
24          ctx.start();
25          assertTrue(Thread.activeCount() > threadsBeforeStart);
26          ctx.stop();
27          ctx.dispose();
28          // Check that workManager ("MuleServer") thread no longer exists.
29          assertTrue(Thread.activeCount() == threadsBeforeStart);
30          assertTrue(ctx.isDisposed());
31          assertFalse(ctx.isInitialised());
32          assertFalse(ctx.isStarted());
33      }
34  
35      // @Override
36      protected MuleContext createMuleContext() throws Exception
37      {
38          return null;
39      }
40  
41      // @Override
42      protected void disposeManager()
43      {
44      }
45  
46  }