Merge pull request #120 from jotomo/codebase-diving

Replace calls to deprecated APIs, remove some unused imports.
This commit is contained in:
Michael Hunger
2013-07-19 09:36:38 -07:00
25 changed files with 50 additions and 50 deletions

View File

@@ -21,7 +21,7 @@ import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterFactory;
import org.springframework.core.convert.converter.ConverterRegistry;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import java.util.Date;
@@ -32,7 +32,7 @@ public class Neo4jConversionServiceFactoryBean implements FactoryBean<Conversion
public ConversionService getObject() throws Exception {
GenericConversionService conversionService = new GenericConversionService();
addConverters(conversionService);
ConversionServiceFactory.addDefaultConverters(conversionService);
DefaultConversionService.addDefaultConverters(conversionService);
return conversionService;
}

View File

@@ -71,7 +71,7 @@ public class GraphDatabaseFactory implements FactoryBean<GraphDatabase> {
}
File file = new File( path );
// if (!file.isDirectory()) file=file.getParentFile();
return new DelegatingGraphDatabase(new EmbeddedGraphDatabase(file.getAbsolutePath()));
return new DelegatingGraphDatabase(new org.neo4j.graphdb.factory.GraphDatabaseFactory().newEmbeddedDatabase(file.getAbsolutePath()));
}
private GraphDatabase createRestGraphDatabase(String url, String username, String password) throws Exception {

View File

@@ -30,7 +30,7 @@ import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.matchers.JUnitMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.neo4j.helpers.collection.IteratorUtil.first;
import static org.springframework.data.neo4j.SetHelper.asSet;
import static org.springframework.data.neo4j.annotation.RelationshipDelegates.getRelationshipNames;

View File

@@ -18,7 +18,7 @@ package org.springframework.data.neo4j.config;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -41,7 +41,7 @@ public class Neo4jRepositoriesRegistrarIntegrationTests {
@Bean
public GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -33,7 +33,7 @@ import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItems;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.neo4j.helpers.collection.IteratorUtil.asCollection;
import static org.neo4j.helpers.collection.MapUtil.map;

View File

@@ -18,7 +18,7 @@ package org.springframework.data.neo4j.equality;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -116,7 +116,7 @@ public class EqualityTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.matchers.JUnitMatchers.hasItems;
import static org.hamcrest.CoreMatchers.hasItems;
import java.util.ArrayList;
import java.util.HashMap;

View File

@@ -19,7 +19,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -81,7 +81,7 @@ public class PropertyTypeConversionTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
@Override

View File

@@ -18,7 +18,7 @@ package org.springframework.data.neo4j.lifecycle;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -53,7 +53,7 @@ public class AfterSaveEventTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
@Bean

View File

@@ -18,7 +18,7 @@ package org.springframework.data.neo4j.lifecycle;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -53,7 +53,7 @@ public class BeforeSaveEventTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
@Bean

View File

@@ -19,7 +19,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.LinkedList;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItem;
@NodeEntity
class Program {
@@ -64,7 +64,7 @@ public class DeleteEventTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
@Bean

View File

@@ -22,7 +22,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
@@ -178,7 +178,7 @@ public class SaveEventTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
@Bean

View File

@@ -19,7 +19,7 @@ import org.junit.After;
import org.junit.Before;
import org.neo4j.graphdb.*;
import org.neo4j.helpers.collection.IteratorUtil;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.convert.DefaultTypeMapper;
import org.springframework.data.convert.TypeMapper;
@@ -104,7 +104,7 @@ public class Neo4jPersistentTestBase {
private Infrastructure createInfrastructure(Neo4jMappingContext mappingContext) throws Exception {
MappingInfrastructureFactoryBean factoryBean = new MappingInfrastructureFactoryBean();
final GraphDatabaseService gdb = new ImpermanentGraphDatabase();
final GraphDatabaseService gdb = new TestGraphDatabaseFactory().newImpermanentDatabase();
factoryBean.setGraphDatabaseService(gdb);
final DelegatingGraphDatabase graphDatabase = new DelegatingGraphDatabase(gdb);
factoryBean.setGraphDatabase(graphDatabase);

View File

@@ -21,7 +21,7 @@ import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.helpers.collection.IteratorUtil;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -173,7 +173,7 @@ public class DerivedFinderTests {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -20,11 +20,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.cypher.javacompat.ExecutionEngine;
import org.neo4j.cypher.javacompat.ExecutionResult;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.index.Index;
import org.neo4j.helpers.collection.IteratorUtil;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,7 +81,7 @@ public class NoIndexDerivedFinderTests {
@Test
public void testWithSeparateTransactions() throws Exception {
final ImpermanentGraphDatabase gdb = new ImpermanentGraphDatabase();
final GraphDatabaseService gdb = new TestGraphDatabaseFactory().newImpermanentDatabase();
final Thread t = new Thread() {
@Override
public void run() {

View File

@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -116,7 +116,7 @@ public class InParameterisedByArrayOfSimpleTypeTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -86,7 +86,7 @@ public class InParameterisedByDateTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -87,7 +87,7 @@ public class InParameterisedByEnumTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -108,7 +108,7 @@ public class InParameterisedBySimpleTypeTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -72,7 +72,7 @@ public class ParameterisedInTests {
static class TestConfig extends Neo4jConfiguration {
@Bean
GraphDatabaseService graphDatabaseService() {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
}

View File

@@ -18,11 +18,11 @@ package org.springframework.data.neo4j.support;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import static org.junit.Assert.assertEquals;
import static org.neo4j.helpers.collection.MapUtil.map;
@@ -34,11 +34,11 @@ import static org.neo4j.helpers.collection.MapUtil.map;
public class DelegatingGraphDatabaseTests {
private DelegatingGraphDatabase graphDatabase;
private ImpermanentGraphDatabase gdb;
private GraphDatabaseService gdb;
@Before
public void setUp() throws Exception {
gdb = new ImpermanentGraphDatabase();
gdb = new TestGraphDatabaseFactory().newImpermanentDatabase();
graphDatabase = new DelegatingGraphDatabase(gdb);
}

View File

@@ -26,7 +26,7 @@ import org.neo4j.graphdb.index.Index;
import org.neo4j.graphdb.traversal.TraversalDescription;
import org.neo4j.kernel.Traversal;
import org.neo4j.kernel.impl.transaction.SpringTransactionManager;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.data.neo4j.conversion.ResultConverter;
import org.springframework.data.neo4j.core.GraphDatabase;
@@ -74,7 +74,7 @@ public class Neo4jTemplateApiTests {
}
protected GraphDatabaseService createGraphDatabaseService() throws IOException {
return new ImpermanentGraphDatabase();
return new TestGraphDatabaseFactory().newImpermanentDatabase();
}
protected GraphDatabase createGraphDatabase() throws Exception {

View File

@@ -21,7 +21,7 @@ import org.junit.Before;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.kernel.GraphDatabaseAPI;
import org.neo4j.kernel.impl.transaction.SpringTransactionManager;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.data.neo4j.core.GraphDatabase;
import org.springframework.data.neo4j.fieldaccess.Neo4jConversionServiceFactoryBean;
@@ -58,7 +58,7 @@ public abstract class NeoApiTests {
protected GraphDatabase createGraphDatabase() throws Exception
{
graphDatabaseService = new ImpermanentGraphDatabase( );
graphDatabaseService = new TestGraphDatabaseFactory().newImpermanentDatabase();
return new DelegatingGraphDatabase(graphDatabaseService);
}

View File

@@ -16,19 +16,18 @@
package org.springframework.data.neo4j.typerepresentation;
import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.neo4j.test.TestGraphDatabaseFactory;
import org.springframework.data.neo4j.model.Person;
import org.springframework.data.neo4j.support.MappingInfrastructure;
import org.springframework.data.neo4j.support.MappingInfrastructureFactoryBean;
import org.springframework.data.neo4j.support.Neo4jTemplate;
import org.springframework.data.neo4j.support.typerepresentation.SubReferenceNodeTypeRepresentationStrategy;
import org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory;
public class TypeRepresentationTests {
@Test
public void testSavingTwiceResultsOnlyInOneTRSCall() throws Exception {
ImpermanentGraphDatabase db = new ImpermanentGraphDatabase();
GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
MappingInfrastructureFactoryBean factoryBean = new MappingInfrastructureFactoryBean(db, null);
factoryBean.setTypeRepresentationStrategy(TypeRepresentationStrategyFactory.Strategy.SubRef);
factoryBean.afterPropertiesSet();

View File

@@ -30,12 +30,11 @@ import org.springframework.data.neo4j.unique.repository.ClubRepository;
import org.springframework.data.neo4j.unique.repository.InvalidClubRepository;
import org.springframework.data.neo4j.unique.repository.UniqueClubRepository;
import org.springframework.data.neo4j.unique.repository.UniqueNumericIdClubRepository;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:unique-test-context.xml"})