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 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
31
32
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
44
45
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
57
58
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 }