Author: steve.ebersole(a)jboss.com
Date: 2010-06-30 10:35:26 -0400 (Wed, 30 Jun 2010)
New Revision: 19874
Modified:
core/branches/gradle2/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java
Log:
got infinispan module tests passing
Modified:
core/branches/gradle2/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java
===================================================================
---
core/branches/gradle2/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java 2010-06-30
13:46:13 UTC (rev 19873)
+++
core/branches/gradle2/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/tm/JBossStandaloneJtaExampleTest.java 2010-06-30
14:35:26 UTC (rev 19874)
@@ -33,6 +33,9 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.stat.Statistics;
import org.hibernate.test.cache.infinispan.functional.Item;
+import org.hibernate.util.ConfigHelper;
+import org.hibernate.util.PropertiesHelper;
+
import org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
@@ -50,6 +53,8 @@
import javax.transaction.Status;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
+import java.io.IOException;
+import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Iterator;
@@ -218,12 +223,20 @@
bind("UserTransaction", lookup.getUserTransaction(),
lookup.getUserTransaction().getClass(), ctx);
}
- private void bindDataSource() throws Exception {
- ExtendedXADataSource xads = new ExtendedXADataSource();
- xads.setDriverName("org.hsqldb.jdbcDriver");
- xads.setUrl("jdbc:hsqldb:mem:/test");
- ctx.bind("java:/MyDatasource", xads);
- }
+ private void bindDataSource() throws Exception {
+ Properties properties = new Properties();
+ InputStream stream = ConfigHelper.getResourceAsStream(
"/hibernate.properties" );
+ try {
+ properties.load( stream );
+ }
+ finally {
+ stream.close();
+ }
+ ExtendedXADataSource xads = new ExtendedXADataSource();
+ xads.setDriverName( properties.getProperty( Environment.DRIVER ) );
+ xads.setUrl( properties.getProperty( Environment.URL ) );
+ ctx.bind( "java:/MyDatasource", xads );
+ }
/**
* Helper method that binds the a non serializable object to the JNDI tree.
Show replies by date