Neo4j moved (#1152)

* Neo4j cleanup

* Neo4j cleanup

* Neo4j cleanup x2
This commit is contained in:
Danil Kornishev 2017-02-14 15:44:45 -05:00 committed by Zeger Hendrikse
parent 8f01c27090
commit dd40ed7025
10 changed files with 79 additions and 78 deletions

View File

@ -9,45 +9,7 @@
<name>core-java</name> <name>core-java</name>
<dependencies> <dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-jdbc-driver</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
<classifier>no_aop</classifier>
<scope>test</scope>
</dependency>
<!-- utils --> <!-- utils -->
<dependency> <dependency>
<groupId>net.sourceforge.collections</groupId> <groupId>net.sourceforge.collections</groupId>

View File

@ -7,10 +7,41 @@
<version>1.0</version> <version>1.0</version>
<dependencies> <dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId> <artifactId>spring-data-neo4j</artifactId>
<version>${spring-data-neo4j.version}</version> <version>${spring-data-neo4j.version}</version>
<type>test-jar</type>
</dependency> </dependency>
<dependency> <dependency>
@ -27,13 +58,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>${spring-data-neo4j.version}</version>
<type>test-jar</type>
</dependency>
<dependency> <dependency>
<groupId>org.neo4j</groupId> <groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId> <artifactId>neo4j-kernel</artifactId>
@ -72,9 +96,14 @@
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
<version>${spring-test.version}</version> <version>${spring-test.version}</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -130,16 +159,18 @@
</profiles> </profiles>
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<neo4j.version>3.0.7</neo4j.version> <neo4j.version>3.1.0</neo4j.version>
<spring-data-neo4j.version>4.1.6.RELEASE</spring-data-neo4j.version> <spring-data-neo4j.version>4.1.6.RELEASE</spring-data-neo4j.version>
<jackson-jsog.version>1.1</jackson-jsog.version> <jackson-jsog.version>1.1</jackson-jsog.version>
<spring-boot.version>1.4.3.RELEASE</spring-boot.version> <spring-boot.version>1.4.3.RELEASE</spring-boot.version>
<spring-test.version>4.3.5.RELEASE</spring-test.version> <spring-test.version>4.3.5.RELEASE</spring-test.version>
<neo4j-ogm-test.version>2.0.6</neo4j-ogm-test.version> <neo4j-ogm-test.version>2.1.1</neo4j-ogm-test.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>

View File

@ -4,15 +4,12 @@ import org.neo4j.ogm.session.SessionFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@ComponentScan(basePackages = { "com.baeldung.spring.data.neo4j.services" }) @ComponentScan(basePackages = { "com.baeldung.spring.data.neo4j.services" })
@Configuration @Configuration
@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory") @EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory")
public class MovieDatabaseNeo4jConfiguration extends Neo4jConfiguration { public class MovieDatabaseNeo4jConfiguration {
public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL") : "http://neo4j:movies@localhost:7474"; public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL") : "http://neo4j:movies@localhost:7474";
@ -23,7 +20,7 @@ public class MovieDatabaseNeo4jConfiguration extends Neo4jConfiguration {
return config; return config;
} }
@Override @Bean
public SessionFactory getSessionFactory() { public SessionFactory getSessionFactory() {
return new SessionFactory(getConfiguration(), "com.baeldung.spring.data.neo4j.domain"); return new SessionFactory(getConfiguration(), "com.baeldung.spring.data.neo4j.domain");
} }

View File

@ -5,9 +5,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.data.neo4j.server.Neo4jServer;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement @EnableTransactionManagement
@ -15,7 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @Configuration
@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory") @EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory")
@Profile({ "embedded", "test" }) @Profile({ "embedded", "test" })
public class MovieDatabaseNeo4jTestConfiguration extends Neo4jConfiguration { public class MovieDatabaseNeo4jTestConfiguration {
@Bean @Bean
public org.neo4j.ogm.config.Configuration getConfiguration() { public org.neo4j.ogm.config.Configuration getConfiguration() {
@ -24,7 +22,7 @@ public class MovieDatabaseNeo4jTestConfiguration extends Neo4jConfiguration {
return config; return config;
} }
@Override @Bean
public SessionFactory getSessionFactory() { public SessionFactory getSessionFactory() {
return new SessionFactory(getConfiguration(), "com.baeldung.spring.data.neo4j.domain"); return new SessionFactory(getConfiguration(), "com.baeldung.spring.data.neo4j.domain");
} }

View File

@ -1,12 +1,9 @@
package com.baeldung.graph; package com.baeldung.spring.data.neo4j.domain;
import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship; import org.neo4j.ogm.annotation.Relationship;
/**
* @author Danil Kornishev (danil.kornishev@mastercard.com)
*/
@NodeEntity @NodeEntity
public class Car { public class Car {
@GraphId @GraphId

View File

@ -1,11 +1,8 @@
package com.baeldung.graph; package com.baeldung.spring.data.neo4j.domain;
import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship; import org.neo4j.ogm.annotation.Relationship;
/**
* @author Danil Kornishev (danil.kornishev@mastercard.com)
*/
@NodeEntity @NodeEntity
public class Company { public class Company {
private Long id; private Long id;

View File

@ -1,10 +1,11 @@
package com.baeldung.graph; package com.baeldung.neo4j;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Statement; import java.sql.Statement;
import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.neo4j.driver.v1.AuthTokens; import org.neo4j.driver.v1.AuthTokens;
@ -12,7 +13,6 @@ import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase; import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session; import org.neo4j.driver.v1.Session;
import org.neo4j.driver.v1.StatementResult; import org.neo4j.driver.v1.StatementResult;
import org.testng.Assert;
@Ignore @Ignore
public class Neo4JServerTest { public class Neo4JServerTest {

View File

@ -1,18 +1,19 @@
package com.baeldung.graph; package com.baeldung.neo4j;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.neo4j.ogm.config.Configuration; import org.neo4j.ogm.config.Configuration;
import org.neo4j.ogm.model.Result; import org.neo4j.ogm.model.Result;
import org.neo4j.ogm.session.Session; import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory; import org.neo4j.ogm.session.SessionFactory;
import org.testng.Assert;
import java.util.HashMap; import com.baeldung.spring.data.neo4j.domain.Car;
import java.util.Map; import com.baeldung.spring.data.neo4j.domain.Company;
import org.neo4j.ogm.transaction.Transaction;
/**
* @author Danil Kornishev (danil.kornishev@mastercard.com)
*/
public class Neo4jOgmTest { public class Neo4jOgmTest {
@Test @Test
@ -20,7 +21,7 @@ public class Neo4jOgmTest {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver"); conf.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver");
SessionFactory factory = new SessionFactory(conf, "com.baeldung.graph"); SessionFactory factory = new SessionFactory(conf, "com.baeldung.spring.data.neo4j.domain");
Session session = factory.openSession(); Session session = factory.openSession();
Car tesla = new Car("tesla", "modelS"); Car tesla = new Car("tesla", "modelS");
@ -30,6 +31,8 @@ public class Neo4jOgmTest {
session.save(baeldung); session.save(baeldung);
Assert.assertEquals(1, session.countEntitiesOfType(Company.class));
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("make", "tesla"); params.put("make", "tesla");
Result result = session.query("MATCH (car:Car) <-[:owns]- (company:Company)" + Result result = session.query("MATCH (car:Car) <-[:owns]- (company:Company)" +

View File

@ -1,4 +1,4 @@
package com.baeldung.graph; package com.baeldung.neo4j;
import java.io.File; import java.io.File;
@ -7,6 +7,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.GraphDatabaseService;
@ -16,7 +17,6 @@ import org.neo4j.graphdb.NotFoundException;
import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Result; import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.testng.Assert;
public class Neo4jTest { public class Neo4jTest {

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %5p %40.40c:%4L - %m%n</pattern>
</encoder>
</appender>
<logger name="org.neo4j.ogm" level="info"/>
<root level="warn">
<appender-ref ref="console"/>
</root>
</configuration>