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