Permalink
Browse files

DATAGRAPH-204 fixed issue with inheriting Spring 3.1, inheriting Spri…

…ng config and co-variant return types
  • Loading branch information...
1 parent 2f1ee27 commit b83ac96e0e0b18a8e996ac6bfcde93d013dff2a0 @jexp jexp committed Mar 2, 2012
@@ -25,6 +25,7 @@
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 PlatformTransactionManager neo4jTransactionManager() {
}
@Bean
- public CrossStoreNodeEntityStateFactory nodeEntityStateFactory() throws Exception {
+ public NodeEntityStateFactory nodeEntityStateFactory() throws Exception {
final CrossStoreNodeEntityStateFactory nodeEntityStateFactory = new CrossStoreNodeEntityStateFactory();
nodeEntityStateFactory.setEntityManagerFactory(entityManagerFactory);
return nodeEntityStateFactory;
@@ -18,45 +18,33 @@
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;
/**
* @author mh
* @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;
- }
-
- @Test
- public void injectionForCrossStore() {
- assertInjected("-cross-store");
- }
+ @Autowired GraphDatabaseService graphDatabaseService;
+ @Autowired Neo4jTemplate template;
+ @Autowired PlatformTransactionManager transactionManager;
- 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);
}
-
}
@@ -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">
+ <context:spring-configured/>
<context:annotation-config/>
<neo4j:config storeDirectory="target/config-test" entityManagerFactory="entityManagerFactory"/>
@@ -24,6 +25,4 @@
<property name="password" value=""/>
</bean>
- <bean id="config" class="org.springframework.data.neo4j.config.DataGraphNamespaceHandlerCrossStoreTest$Config"/>
-
</beans>
@@ -14,8 +14,6 @@
<bean class="org.springframework.data.neo4j.config.Neo4jConfiguration"/>
- <neo4j:config graphDatabaseService="graphDatabaseService"/>
-
<bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>
<neo4j:repositories base-package="org.springframework.data.neo4j.unique.repository"/>

0 comments on commit b83ac96

Please sign in to comment.