View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.test.integration.transport;
8   
9   import org.mule.api.MuleContext;
10  import org.mule.api.MuleException;
11  import org.mule.api.endpoint.OutboundEndpoint;
12  import org.mule.api.lifecycle.InitialisationException;
13  import org.mule.api.processor.MessageProcessor;
14  import org.mule.transport.AbstractConnector;
15  
16  import java.util.ArrayList;
17  import java.util.List;
18  
19  /**
20   * TODO
21   */
22  public class ConnectorLifecycleTracker extends AbstractConnector
23  {
24      private final List<String> tracker = new ArrayList<String>();
25  
26      private String property1;
27  
28      boolean connected = false;
29      
30      public ConnectorLifecycleTracker(MuleContext context)
31      {
32          super(context);
33      }
34      
35      public List<String> getTracker() {
36          return tracker;
37      }
38  
39      public String getProtocol()
40      {
41          return "test";
42      }
43  
44      public void doConnect() throws Exception
45      {
46          connected = true;
47          getTracker().add("connect");
48      }
49  
50      public void doDisconnect() throws Exception
51      {
52          connected = false;
53          getTracker().add("disconnect");
54      }
55  
56  
57  
58      public void setProperty(final String value) {
59          tracker.add("setProperty");
60      }
61  
62      public void doInitialise() throws InitialisationException
63      {
64          tracker.add("initialise");
65      }
66  
67      public void doStart() throws MuleException
68      {
69          tracker.add("start");
70      }
71  
72      public void doStop() throws MuleException {
73          tracker.add("stop");
74      }
75  
76      public void doDispose() {
77          tracker.add("dispose");
78      }
79  
80  
81      public String getProperty1()
82      {
83          return property1;
84      }
85  
86      public void setProperty1(String property1)
87      {
88          tracker.add("setProperty");
89          this.property1 = property1;
90      }
91  
92      public MessageProcessor getOutboundEndpointMessageProcessor(OutboundEndpoint endpoint)
93          throws MuleException
94      {
95          return null;
96      }
97  }