View Javadoc

1   /*
2    * $Id: TestTransactionManagerFactory.java 19191 2010-08-25 21:05:23Z tcarlson $
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.tck.testmodels.mule;
12  
13  import org.mule.api.config.MuleConfiguration;
14  import org.mule.transaction.lookup.GenericTransactionManagerLookupFactory;
15  
16  import java.lang.reflect.InvocationHandler;
17  import java.lang.reflect.Method;
18  import java.lang.reflect.Proxy;
19  
20  import javax.transaction.TransactionManager;
21  
22  /**
23   * <code>TestTransactionManagerFactory</code> TODO
24   */
25  public class TestTransactionManagerFactory extends GenericTransactionManagerLookupFactory
26  {
27      public TransactionManager create(MuleConfiguration config) throws Exception
28      {
29          return (TransactionManager) Proxy.newProxyInstance(getClass().getClassLoader(),
30                                                             new Class[] {TransactionManager.class},
31                                                             new InternalInvocationHandler());
32      }
33  
34      public void initialise()
35      {
36          // shortcut super's implementation
37      }
38  
39      public class InternalInvocationHandler implements InvocationHandler
40      {
41          public TestTransactionManagerFactory getParent()
42          {
43              return TestTransactionManagerFactory.this;
44          }
45  
46          public Object invoke (Object proxy, Method method, Object[] args) throws Throwable
47          {
48              return null;
49          }
50  
51      }
52  }