Permalink
Browse files

Intermediate push

  • Loading branch information...
1 parent 6e1902d commit 1710a37eaa414609affdcdf001fa79ee803dd573 Chris Gioran committed Feb 25, 2011
View
13 sampleCode/pom.xml
@@ -170,6 +170,19 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.neo4j.jta</groupId>
+ <artifactId>spring-service-provider</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.experlog</groupId>
+ <artifactId>xapool</artifactId>
+ <version>1.4</version>
</dependency>
</dependencies>
View
11 sampleCode/src/test/java/org/neo4j/integration/spring/BaseTMIntegrationTest.java
@@ -15,16 +15,22 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.NotFoundException;
+import org.neo4j.jta.spring.SpringServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.jta.JtaTransactionManager;
+@RunWith(SpringJUnit4ClassRunner.class)
public abstract class BaseTMIntegrationTest
{
+ @Autowired
private ApplicationContext ctx;
public abstract void testLoadConfig() throws SystemException,
@@ -42,11 +48,12 @@ public BaseTMIntegrationTest()
@Before
public void setUp() throws Exception
{
- ctx = new ClassPathXmlApplicationContext( getConfigName() );
+// ctx = new ClassPathXmlApplicationContext( getConfigName() );
+ ctx.getBean(SpringServiceImpl.class).begin();
+ tm = ctx.getBean( "JtaTransactionManager", JtaTransactionManager.class );
gds = ctx.getBean( GraphDatabaseService.class );
ds = ctx.getBean( "dataSource", XADataSource.class );
- tm = ctx.getBean( "JtaTransactionManager", JtaTransactionManager.class );
// StandardXADataSource xa = (StandardXADataSource) ds;
// ds.setTransactionManager( tm.getTransactionManager() );
}
View
1 sampleCode/src/test/java/org/neo4j/integration/spring/JOTMIntegrationTest.java
@@ -16,6 +16,7 @@
import org.springframework.transaction.jta.JtaTransactionManager;
import org.springframework.transaction.jta.ManagedTransactionAdapter;
+@ContextConfiguration(locations={"classpath:spring-jotm-tx-test-context.xml"})
public class JOTMIntegrationTest extends BaseTMIntegrationTest
{
@Override
View
19 sampleCode/src/test/resources/spring-jotm-tx-test-context.xml
@@ -13,30 +13,25 @@
<context:annotation-config />
<context:spring-configured />
- <bean id="jotm" class="org.neo4j.spring_tx.JotmFactoryBean" />
+ <bean id="jotm" class="org.neo4j.integration.spring.JotmFactoryBean" />
<bean id="JtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="jotm" />
- <property name="allowCustomIsolationLevels" value="true"/>
+ <property name="allowCustomIsolationLevels" value="true" />
</bean>
-
- <bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
+
+ <bean id="dataSource" class="org.enhydra.jdbc.standard.StandardXADataSource">
+ <property name="driverName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/sample" />
<property name="user" value="root" />
<property name="password" value="1" />
- <property name="connection.autoCommit" value="false"/>
- </bean>
-
- <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <property name="dataSource" ref="dataSource"/>
</bean>
- <bean id="TestServices" class="org.neo4j.spring_tx.TestServices">
- </bean>
+ <bean class="org.neo4j.jta.spring.SpringServiceImpl" depends-on="JtaTransactionManager" />
<bean class="org.neo4j.kernel.EmbeddedGraphDatabase"
- destroy-method="shutdown">
+ destroy-method="shutdown" depends-on="JtaTransactionManager">
<constructor-arg value="target/test-db" />
<constructor-arg>
<map>
View
4 txModule/src/main/java/org/neo4j/jta/spring/SpringServiceImpl.java
@@ -39,9 +39,9 @@
* @author Chris Gioran
*/
@Configurable
-class SpringServiceImpl extends AbstractTransactionManager
+public class SpringServiceImpl extends AbstractTransactionManager
{
- @Autowired
+ @Autowired(required = true)
private JtaTransactionManager jtaTransactionManager;
private TransactionManager delegate;
View
2 .../resources/META-INF/services/org.neo4j.kernel.impl.transaction.TransactionManagerProvider
@@ -1 +1 @@
-org.neo4j.spring_tx.SpringProvider
+org.neo4j.jta.spring.SpringProvider

0 comments on commit 1710a37

Please sign in to comment.