View Javadoc

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