diff --git a/spring-data-neo4j-cross-store/src/main/java/org/springframework/data/neo4j/cross_store/config/CrossStoreNeo4jConfiguration.java b/spring-data-neo4j-cross-store/src/main/java/org/springframework/data/neo4j/cross_store/config/CrossStoreNeo4jConfiguration.java index 9eb672050..040f57af1 100644 --- a/spring-data-neo4j-cross-store/src/main/java/org/springframework/data/neo4j/cross_store/config/CrossStoreNeo4jConfiguration.java +++ b/spring-data-neo4j-cross-store/src/main/java/org/springframework/data/neo4j/cross_store/config/CrossStoreNeo4jConfiguration.java @@ -25,6 +25,7 @@ import org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEnt import org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityStateFactory; import org.springframework.data.neo4j.mapping.EntityInstantiator; import org.springframework.data.neo4j.support.node.NodeEntityInstantiator; +import org.springframework.data.neo4j.support.node.NodeEntityStateFactory; import org.springframework.data.neo4j.transaction.ChainedTransactionManager; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.transaction.PlatformTransactionManager; @@ -77,7 +78,7 @@ public class CrossStoreNeo4jConfiguration extends Neo4jAspectConfiguration { } @Bean - public CrossStoreNodeEntityStateFactory nodeEntityStateFactory() throws Exception { + public NodeEntityStateFactory nodeEntityStateFactory() throws Exception { final CrossStoreNodeEntityStateFactory nodeEntityStateFactory = new CrossStoreNodeEntityStateFactory(); nodeEntityStateFactory.setEntityManagerFactory(entityManagerFactory); return nodeEntityStateFactory; diff --git a/spring-data-neo4j-cross-store/src/test/java/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerCrossStoreTest.java b/spring-data-neo4j-cross-store/src/test/java/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerCrossStoreTest.java index 996d273e8..a22dab7f9 100644 --- a/spring-data-neo4j-cross-store/src/test/java/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerCrossStoreTest.java +++ b/spring-data-neo4j-cross-store/src/test/java/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerCrossStoreTest.java @@ -18,11 +18,13 @@ package org.springframework.data.neo4j.config; import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.kernel.EmbeddedGraphDatabase; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.data.neo4j.support.Neo4jTemplate; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.PlatformTransactionManager; /** @@ -30,33 +32,19 @@ import org.springframework.transaction.PlatformTransactionManager; * @since 31.01.11 */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest-cross-store-context.xml") public class DataGraphNamespaceHandlerCrossStoreTest { - static class Config { - @Autowired - GraphDatabaseService graphDatabaseService; - @Autowired - Neo4jTemplate template; - @Autowired - PlatformTransactionManager transactionManager; - } + @Autowired GraphDatabaseService graphDatabaseService; + @Autowired Neo4jTemplate template; + @Autowired PlatformTransactionManager transactionManager; - @Test - public void injectionForCrossStore() { - assertInjected("-cross-store"); - } - - private Config assertInjected(String testCase) { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest" + testCase + "-context.xml"); - Config config = ctx.getBean("config", Config.class); - Neo4jTemplate template = config.template; + @Test public void injectionForCrossStore() { Assert.assertNotNull("template", template); EmbeddedGraphDatabase graphDatabaseService = (EmbeddedGraphDatabase) template.getGraphDatabaseService(); Assert.assertTrue("store-dir", graphDatabaseService.getStoreDir().endsWith("target/config-test")); - Assert.assertNotNull("graphDatabaseService", config.graphDatabaseService); - Assert.assertNotNull("transactionManager", config.transactionManager); - config.graphDatabaseService.shutdown(); - return config; + Assert.assertNotNull("graphDatabaseService", graphDatabaseService); + Assert.assertNotNull("transactionManager", transactionManager); } - } diff --git a/spring-data-neo4j-cross-store/src/test/resources/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest-cross-store-context.xml b/spring-data-neo4j-cross-store/src/test/resources/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest-cross-store-context.xml index aa706a0f5..dd7bbb482 100644 --- a/spring-data-neo4j-cross-store/src/test/resources/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest-cross-store-context.xml +++ b/spring-data-neo4j-cross-store/src/test/resources/org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest-cross-store-context.xml @@ -9,6 +9,7 @@ http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> + @@ -24,6 +25,4 @@ - - \ No newline at end of file diff --git a/spring-data-neo4j/src/test/resources/unique-test-context.xml b/spring-data-neo4j/src/test/resources/unique-test-context.xml index aabec7253..bff4ac3c8 100644 --- a/spring-data-neo4j/src/test/resources/unique-test-context.xml +++ b/spring-data-neo4j/src/test/resources/unique-test-context.xml @@ -14,8 +14,6 @@ - -