Author: epbernard
Date: 2010-07-30 06:11:48 -0400 (Fri, 30 Jul 2010)
New Revision: 20089
Modified:
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/DataSourceProvider.java
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/JBossTSStandaloneTransactionManagerLookup.java
Log:
HSEARCH-562 Add JTA test with JBoss TS: Make TM lookup class using reflection
Hibernate TM lookups need to use reflection to avoid hard dependencies
Modified:
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/DataSourceProvider.java
===================================================================
---
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/DataSourceProvider.java 2010-07-30
10:11:13 UTC (rev 20088)
+++
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/DataSourceProvider.java 2010-07-30
10:11:48 UTC (rev 20089)
@@ -10,7 +10,7 @@
*
* @author Emmanuel Bernard
*/
-class DataSourceProvider implements DynamicClass {
+public class DataSourceProvider implements DynamicClass {
private static String DATASOURCE_NAME = "datasource";
private static DynamicClass dynamicClass;
Modified:
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/JBossTSStandaloneTransactionManagerLookup.java
===================================================================
---
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/JBossTSStandaloneTransactionManagerLookup.java 2010-07-30
10:11:13 UTC (rev 20088)
+++
search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/integration/jbossjta/infra/JBossTSStandaloneTransactionManagerLookup.java 2010-07-30
10:11:48 UTC (rev 20089)
@@ -4,18 +4,26 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-
import org.hibernate.HibernateException;
import org.hibernate.transaction.TransactionManagerLookup;
/**
+ * Return a standalone JTA transaction manager for JBoss Transactions
+ *
* @author Emmanuel Bernard
*/
public class JBossTSStandaloneTransactionManagerLookup implements
TransactionManagerLookup {
+
public TransactionManager getTransactionManager(Properties props) throws
HibernateException {
- //TODO use reflection
- return new TransactionManagerImple();
+ try {
+ @SuppressWarnings( "unchecked" )
+ Class<? extends TransactionManager> clazz = (Class<? extends
TransactionManager>)
+ Class.forName("com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple");
+ return clazz.newInstance();
+ }
+ catch (Exception e) {
+ throw new HibernateException( "Could not obtain JBoss Transactions transaction
manager instance", e );
+ }
}
public String getUserTransactionName() {