View Javadoc

1   /*
2    * $Id: AutoTransformerTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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.test.transformers;
12  
13  import org.mule.tck.FunctionalTestCase;
14  import org.mule.tck.testmodels.fruit.FruitBasket;
15  import org.mule.tck.testmodels.fruit.FruitBowl;
16  import org.mule.tck.testmodels.fruit.Apple;
17  import org.mule.tck.testmodels.fruit.Banana;
18  import org.mule.module.client.MuleClient;
19  import org.mule.util.concurrent.Latch;
20  
21  import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
22  
23  public class AutoTransformerTestCase extends FunctionalTestCase
24  {
25      private static Latch latch;
26      protected String getConfigResources()
27      {
28          return "org/mule/test/integration/transformer/auto-transformer-test.xml";
29      }
30  
31      public void testInboundAutoTransform() throws Exception
32      {
33          latch = new Latch();
34          MuleClient client = new MuleClient(muleContext);
35          client.dispatch("vm://in", new FruitBowl(new Apple(), new Banana()), null);
36  
37          assertTrue(latch.await(3000, TimeUnit.MILLISECONDS));
38      }
39  
40      public static class FruitBasketComponent
41      {
42          public void process(FruitBasket fb)
43          {
44              assertTrue(fb.hasApple());
45              assertTrue(fb.hasBanana());
46              latch.countDown();
47          }
48      }
49  }