DATAGRAPH-204 fixed issue with inheriting Spring 3.1, inheriting Spring config and co-variant return types

This commit is contained in:
Michael Hunger
2012-03-02 14:28:46 +01:00
parent 2f1ee279ed
commit b83ac96e0e
4 changed files with 14 additions and 28 deletions

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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>

View File

@@ -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"/>