View Javadoc

1   /*
2    * $Id: ExceptionStrategyConfigTestCase.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.exceptions;
12  
13  import org.mule.api.service.Service;
14  import org.mule.exception.DefaultServiceExceptionStrategy;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class ExceptionStrategyConfigTestCase extends FunctionalTestCase
18  {
19      protected String getConfigResources()
20      {
21          return "org/mule/test/integration/exceptions/exception-strategy-config.xml";
22      }
23  
24      public void testConfig() throws Exception
25      {
26          Service service = muleContext.getRegistry().lookupService("testService1");
27          assertNotNull(service);
28          assertNotNull(service.getExceptionListener());
29          assertTrue(service.getExceptionListener() instanceof DefaultServiceExceptionStrategy);
30  
31          DefaultServiceExceptionStrategy es = (DefaultServiceExceptionStrategy)service.getExceptionListener();
32          assertFalse(es.isEnableNotifications());
33          assertNotNull(es.getCommitTxFilter());
34          assertEquals("java.io.*", es.getCommitTxFilter().getPattern());
35  
36          assertNotNull(es.getRollbackTxFilter());
37          assertEquals("org.mule.*, javax.*", es.getRollbackTxFilter().getPattern());
38  
39      }
40  }