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.lifecycle;
8   
9   import org.mule.api.MuleEvent;
10  import org.mule.api.MuleException;
11  import org.mule.api.component.Component;
12  import org.mule.api.construct.FlowConstruct;
13  import org.mule.api.construct.FlowConstructAware;
14  import org.mule.management.stats.ComponentStatistics;
15  
16  import org.mockito.Mockito;
17  
18  /**
19   * @author David Dossot (david@dossot.net)
20   */
21  public class LifecycleTrackerComponent extends AbstractLifecycleTracker implements FlowConstructAware, Component
22  {
23  
24      private FlowConstruct flowConstruct;
25  
26      public void springInitialize()
27      {
28          getTracker().add("springInitialize");
29      }
30  
31      public void springDestroy()
32      {
33          getTracker().add("springDestroy");
34      }
35  
36      public void setFlowConstruct(final FlowConstruct flowConstruct)
37      {
38          getTracker().add("setService");
39          this.flowConstruct = flowConstruct;
40      }
41  
42      public FlowConstruct getFlowConstruct()
43      {
44          return flowConstruct;
45      }
46  
47      public ComponentStatistics getStatistics()
48      {
49          return Mockito.mock(ComponentStatistics.class);
50      }
51  
52      public MuleEvent process(MuleEvent event) throws MuleException
53      {
54          return event;
55      }
56  }