View Javadoc

1   /*
2    * $Id: TestCorrelationAggregator.java 22506 2011-07-21 16:30:40Z stephen.fenech $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tck.testmodels.mule;
12  
13  import org.mule.DefaultMuleEvent;
14  import org.mule.DefaultMuleMessage;
15  import org.mule.api.MuleEvent;
16  import org.mule.api.store.ObjectStoreException;
17  import org.mule.routing.AbstractCorrelationAggregator;
18  import org.mule.routing.AggregationException;
19  import org.mule.routing.EventGroup;
20  
21  /**
22   * <code>TestResponseAggregator</code> is a mock response Agrregator object used for
23   * testing configuration
24   */
25  public class TestCorrelationAggregator extends AbstractCorrelationAggregator
26  {
27      private String testProperty;
28  
29      @Override
30      protected MuleEvent aggregateEvents(EventGroup events) throws AggregationException
31      {
32          try
33          {
34              return new DefaultMuleEvent(new DefaultMuleMessage("test", events.toMessageCollection()
35                  .getMuleContext()), events.getMessageCollectionEvent());
36          }
37          catch (ObjectStoreException e)
38          {
39              throw new AggregationException(events,null);
40          }
41      }
42  
43      public String getTestProperty()
44      {
45          return testProperty;
46      }
47  
48      public void setTestProperty(String testProperty)
49      {
50          this.testProperty = testProperty;
51      }
52  }