1   /*
2    * $Id: InterceptorAdapterTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $
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  
11  package org.mule.config.spring;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class InterceptorAdapterTestCase extends FunctionalTestCase
18  {
19  
20      public static final String MESSAGE = "squeak";
21  
22      protected String getConfigResources()
23      {
24          return "org/mule/config/spring/interceptor-adapter-test.xml";
25      }
26  
27      public void testInterceptor() throws Exception
28      {
29          MuleClient client = new MuleClient();
30          MuleMessage response = client.send("vm://in", MESSAGE, null);
31          assertEquals(MESSAGE, response.getPayloadAsString());
32          TimingInterceptor timer = (TimingInterceptor) muleContext.getRegistry().lookupObject("timer");
33          assertNotNull(timer);
34          long ms = timer.getInterval();
35          assertTrue(TimingInterceptor.UNCALLED != ms);
36      }
37  
38  }