1   /*
2    * $Id: InOnlyTestCase.java 11889 2008-06-02 11:12:59Z 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.integration.messaging.meps;
11  
12  import org.mule.tck.FunctionalTestCase;
13  import org.mule.tck.functional.FunctionalTestNotificationListener;
14  import org.mule.module.client.MuleClient;
15  import org.mule.api.context.notification.ServerNotification;
16  import org.mule.util.concurrent.Latch;
17  
18  import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
19  
20  // START SNIPPET: full-class
21  public class InOnlyTestCase extends FunctionalTestCase
22  {
23      public static final long TIMEOUT = 3000;
24  
25      protected String getConfigResources()
26      {
27          return "org/mule/test/integration/messaging/meps/pattern_In-Only.xml";
28      }
29  
30      public void testExchange() throws Exception
31      {
32          MuleClient client = new MuleClient();
33  
34          final Latch latch = new Latch();
35          client.getMuleContext().registerListener(new FunctionalTestNotificationListener()
36          {
37              public void onNotification(ServerNotification notification)
38              {
39                  latch.countDown();
40              }
41          });
42  
43          client.dispatch("inboundEndpoint", "some data", null);
44          assertTrue(latch.await(TIMEOUT, TimeUnit.MILLISECONDS));
45      }
46  }
47  // END SNIPPET: full-class