View Javadoc

1   /*
2    * $Id: AxisConnectorLifecycleTestCase.java 19841 2010-10-05 23:17:20Z dzapata $
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.transport.soap.axis;
12  
13  import org.mule.api.MuleException;
14  import org.mule.tck.DynamicPortTestCase;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class AxisConnectorLifecycleTestCase extends DynamicPortTestCase
18  {
19  
20      private static String SERVICE_NAME = "mycomponent";
21      private static String PROTOCOL_SERVICE_NAME = AxisConnector.AXIS_SERVICE_PROPERTY + "connector.axis.0";
22  
23      @Override
24      protected String getConfigResources()
25      {
26          return "axis-http-mule-config.xml";
27      }
28  
29      /**
30       * MULE-4570, MULE-4573
31       * 
32       * @throws MuleException
33       */
34      public void testStopService() throws MuleException
35      {
36          muleContext.getRegistry().lookupService(SERVICE_NAME).stop();
37          assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
38          assertFalse(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
39  
40      }
41  
42      /**
43       * MULE-4570, MULE-4573
44       * 
45       * @throws MuleException
46       */
47      public void testDisposeService() throws MuleException
48      {
49          muleContext.getRegistry().lookupService(SERVICE_NAME).dispose();
50          assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
51          assertNull(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME));
52  
53      }
54  
55      /**
56       * MULE-4569, MULE-4573
57       * 
58       * @throws MuleException
59       */
60      public void testRestartService() throws MuleException
61      {
62          muleContext.getRegistry().lookupService(SERVICE_NAME).stop();
63          assertFalse(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
64          assertFalse(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
65          muleContext.getRegistry().lookupService(SERVICE_NAME).start();
66          assertTrue(muleContext.getRegistry().lookupService(SERVICE_NAME).isStarted());
67          assertTrue(muleContext.getRegistry().lookupService(PROTOCOL_SERVICE_NAME).isStarted());
68  
69      }
70  
71      @Override
72      protected int getNumPortsToFind()
73      {
74          return 3;
75      }
76  
77  }