updating test cases
This commit is contained in:
parent
718c04ceeb
commit
1a3e005442
@ -13,15 +13,8 @@
|
|||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<neo4j.version>3.0.1</neo4j.version>
|
<neo4j.version>3.0.1</neo4j.version>
|
||||||
<spring-data-neo4j.version>4.1.1.RELEASE</spring-data-neo4j.version>
|
<spring-data-neo4j.version>4.1.1.RELEASE</spring-data-neo4j.version>
|
||||||
<spring-data-releasetrain.version>Hopper-SR1</spring-data-releasetrain.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>1.3.0.RELEASE</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
@ -29,11 +22,6 @@
|
|||||||
<version>${spring-data-neo4j.version}</version>
|
<version>${spring-data-neo4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-rest</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.voodoodyne.jackson.jsog</groupId>
|
<groupId>com.voodoodyne.jackson.jsog</groupId>
|
||||||
<artifactId>jackson-jsog</artifactId>
|
<artifactId>jackson-jsog</artifactId>
|
||||||
@ -41,9 +29,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- end::dependencies[] -->
|
|
||||||
|
|
||||||
<!-- Test Dependencies -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
@ -89,11 +74,6 @@
|
|||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>4.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.12</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
@ -107,29 +87,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spring-milestones</id>
|
|
||||||
<url>http://repo.spring.io/libs-snapshot</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>spring-milestones</id>
|
|
||||||
<url>http://repo.spring.io/libs-snapshot</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.baeldung.spring.data.neo4j.config;
|
package com.baeldung.spring.data.neo4j.config;
|
||||||
|
|
||||||
import org.neo4j.ogm.session.SessionFactory;
|
import org.neo4j.ogm.session.SessionFactory;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
||||||
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;
|
||||||
@ -13,7 +12,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
|
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableAutoConfiguration
|
|
||||||
@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")
|
||||||
|
@ -4,14 +4,12 @@ import com.baeldung.spring.data.neo4j.domain.Movie;
|
|||||||
import org.springframework.data.neo4j.annotation.Query;
|
import org.springframework.data.neo4j.annotation.Query;
|
||||||
import org.springframework.data.neo4j.repository.GraphRepository;
|
import org.springframework.data.neo4j.repository.GraphRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@RepositoryRestResource(collectionResourceRel = "movies", path = "movies")
|
|
||||||
public interface MovieRepository extends GraphRepository<Movie> {
|
public interface MovieRepository extends GraphRepository<Movie> {
|
||||||
Movie findByTitle(@Param("title") String title);
|
Movie findByTitle(@Param("title") String title);
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ public class MovieRepositoryTest {
|
|||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testFindAll() {
|
public void testFindAll() {
|
||||||
System.out.println("findAll");
|
System.out.println("findAll");
|
||||||
Collection<Movie> result = (Collection<Movie>) instance.findAll();
|
Collection<Movie> result =
|
||||||
|
(Collection<Movie>) instance.findAll();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(1, result.size());
|
assertEquals(1, result.size());
|
||||||
}
|
}
|
||||||
@ -92,7 +93,8 @@ public class MovieRepositoryTest {
|
|||||||
public void testFindByTitleContaining() {
|
public void testFindByTitleContaining() {
|
||||||
System.out.println("findByTitleContaining");
|
System.out.println("findByTitleContaining");
|
||||||
String title = "Italian";
|
String title = "Italian";
|
||||||
Collection<Movie> result = instance.findByTitleContaining(title);
|
Collection<Movie> result =
|
||||||
|
instance.findByTitleContaining(title);
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(1,result.size());
|
assertEquals(1,result.size());
|
||||||
}
|
}
|
||||||
@ -115,8 +117,7 @@ public class MovieRepositoryTest {
|
|||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testDeleteMovie() {
|
public void testDeleteMovie() {
|
||||||
System.out.println("deleteMovie");
|
System.out.println("deleteMovie");
|
||||||
instance.delete(
|
instance.delete(instance.findByTitle("The Italian Job"));
|
||||||
instance.findByTitle("The Italian Job"));
|
|
||||||
assertNull(instance.findByTitle("The Italian Job"));
|
assertNull(instance.findByTitle("The Italian Job"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +126,8 @@ public class MovieRepositoryTest {
|
|||||||
public void testDeleteAll() {
|
public void testDeleteAll() {
|
||||||
System.out.println("deleteAll");
|
System.out.println("deleteAll");
|
||||||
instance.deleteAll();
|
instance.deleteAll();
|
||||||
Collection<Movie> result = (Collection<Movie>) instance.findAll();
|
Collection<Movie> result =
|
||||||
|
(Collection<Movie>) instance.findAll();
|
||||||
assertEquals(0,result.size());
|
assertEquals(0,result.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user