1
2
3
4
5
6
7
8
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
30
31
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
43
44
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
56
57
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 }