1
2
3
4
5
6
7
8
9
10 package org.mule.test.integration.transport;
11
12 import org.mule.api.MuleContext;
13 import org.mule.api.MuleException;
14 import org.mule.api.endpoint.OutboundEndpoint;
15 import org.mule.api.lifecycle.InitialisationException;
16 import org.mule.api.processor.MessageProcessor;
17 import org.mule.transport.AbstractConnector;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22
23
24
25 public class ConnectorLifecycleTracker extends AbstractConnector
26 {
27 private final List<String> tracker = new ArrayList<String>();
28
29 private String property1;
30
31 boolean connected = false;
32
33 public ConnectorLifecycleTracker(MuleContext context)
34 {
35 super(context);
36 }
37
38 public List<String> getTracker() {
39 return tracker;
40 }
41
42 public String getProtocol()
43 {
44 return "test";
45 }
46
47 public void doConnect() throws Exception
48 {
49 connected = true;
50 getTracker().add("connect");
51 }
52
53 public void doDisconnect() throws Exception
54 {
55 connected = false;
56 getTracker().add("disconnect");
57 }
58
59
60
61 public void setProperty(final String value) {
62 tracker.add("setProperty");
63 }
64
65 public void doInitialise() throws InitialisationException
66 {
67 tracker.add("initialise");
68 }
69
70 public void doStart() throws MuleException
71 {
72 tracker.add("start");
73 }
74
75 public void doStop() throws MuleException {
76 tracker.add("stop");
77 }
78
79 public void doDispose() {
80 tracker.add("dispose");
81 }
82
83
84 public String getProperty1()
85 {
86 return property1;
87 }
88
89 public void setProperty1(String property1)
90 {
91 tracker.add("setProperty");
92 this.property1 = property1;
93 }
94
95 public MessageProcessor getOutboundEndpointMessageProcessor(OutboundEndpoint endpoint)
96 throws MuleException
97 {
98 return null;
99 }
100 }