View Javadoc

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