From 2188a1ca1781ae97b83f93f311595ecfb28bc084 Mon Sep 17 00:00:00 2001 From: Michael Hunger Date: Mon, 28 Mar 2011 15:26:29 +0200 Subject: [PATCH] added more REST tests --- .../neo4j/rest/graphdb/RestGraphDatabase.java | 1 - .../RestEntityPropertyValidationTest.java | 43 +++++++++++++++++++ .../data/graph/neo4j/rest/RestFinderTest.java | 43 +++++++++++++++++++ .../data/graph/neo4j/rest/RestIndexTest.java | 42 ++++++++++++++++++ .../graph/neo4j/rest/RestProjectionTest.java | 43 +++++++++++++++++++ .../graph/neo4j/rest/RestPropertyTest.java | 43 +++++++++++++++++++ .../rest/RestRelationshipEntityTest.java | 43 +++++++++++++++++++ .../graph/neo4j/rest/RestTraversalTest.java | 43 +++++++++++++++++++ 8 files changed, 300 insertions(+), 1 deletion(-) create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestEntityPropertyValidationTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestFinderTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestIndexTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestProjectionTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestPropertyTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestRelationshipEntityTest.java create mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestTraversalTest.java diff --git a/spring-data-neo4j-rest/src/main/java/org/neo4j/rest/graphdb/RestGraphDatabase.java b/spring-data-neo4j-rest/src/main/java/org/neo4j/rest/graphdb/RestGraphDatabase.java index c360f9a8b..dc11bcbfa 100644 --- a/spring-data-neo4j-rest/src/main/java/org/neo4j/rest/graphdb/RestGraphDatabase.java +++ b/spring-data-neo4j-rest/src/main/java/org/neo4j/rest/graphdb/RestGraphDatabase.java @@ -1,6 +1,5 @@ package org.neo4j.rest.graphdb; -import com.sun.jersey.api.NotFoundException; import com.sun.jersey.api.client.ClientResponse; import org.neo4j.graphdb.*; import org.neo4j.graphdb.event.KernelEventHandler; diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestEntityPropertyValidationTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestEntityPropertyValidationTest.java new file mode 100644 index 000000000..cb50843f9 --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestEntityPropertyValidationTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.EntityPropertyValidationTest; +import org.springframework.data.graph.neo4j.support.IndexTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", + "classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestEntityPropertyValidationTest extends EntityPropertyValidationTest { + +@BeforeClass +public static void startDb() throws Exception { + RestTestBase.startDb(); +} + +@Before +public void cleanDb() { + RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { + RestTestBase.shutdownDb(); + +} + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestFinderTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestFinderTest.java new file mode 100644 index 000000000..1aa1bc306 --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestFinderTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.FinderTest; +import org.springframework.data.graph.neo4j.support.IndexTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", + "classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestFinderTest extends FinderTest { + +@BeforeClass +public static void startDb() throws Exception { + RestTestBase.startDb(); +} + +@Before +public void cleanDb() { + RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { + RestTestBase.shutdownDb(); + +} + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestIndexTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestIndexTest.java new file mode 100644 index 000000000..b65b556b4 --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestIndexTest.java @@ -0,0 +1,42 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.IndexTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** + * @author mh + * @since 28.03.11 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", + "classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestIndexTest extends IndexTest { + + @BeforeClass + public static void startDb() throws Exception { + RestTestBase.startDb(); + } + + @Before + public void cleanDb() { + RestTestBase.cleanDb(); + } + + @AfterClass + public static void shutdownDb() { + RestTestBase.shutdownDb(); + + } + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestProjectionTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestProjectionTest.java new file mode 100644 index 000000000..5fb6117fe --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestProjectionTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.ProjectionTest; +import org.springframework.data.graph.neo4j.support.RelationshipEntityTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", +"classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestProjectionTest extends ProjectionTest { + +@BeforeClass +public static void startDb() throws Exception { +RestTestBase.startDb(); +} + +@Before +public void cleanDb() { +RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { +RestTestBase.shutdownDb(); + +} + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestPropertyTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestPropertyTest.java new file mode 100644 index 000000000..a26152a29 --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestPropertyTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.NodeEntityRelationshipTest; +import org.springframework.data.graph.neo4j.support.PropertyTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", +"classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestPropertyTest extends PropertyTest { + +@BeforeClass +public static void startDb() throws Exception { +RestTestBase.startDb(); +} + +@Before +public void cleanDb() { +RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { +RestTestBase.shutdownDb(); + +} + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestRelationshipEntityTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestRelationshipEntityTest.java new file mode 100644 index 000000000..43706ddb5 --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestRelationshipEntityTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.PropertyTest; +import org.springframework.data.graph.neo4j.support.RelationshipEntityTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", +"classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestRelationshipEntityTest extends RelationshipEntityTest { + +@BeforeClass +public static void startDb() throws Exception { +RestTestBase.startDb(); +} + +@Before +public void cleanDb() { +RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { +RestTestBase.shutdownDb(); + +} + +} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestTraversalTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestTraversalTest.java new file mode 100644 index 000000000..6357edaad --- /dev/null +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/graph/neo4j/rest/RestTraversalTest.java @@ -0,0 +1,43 @@ +package org.springframework.data.graph.neo4j.rest; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.neo4j.rest.graphdb.RestTestBase; +import org.springframework.data.graph.neo4j.support.ProjectionTest; +import org.springframework.data.graph.neo4j.support.TraversalTest; +import org.springframework.test.context.CleanContextCacheTestExecutionListener; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +/** +* @author mh +* @since 28.03.11 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/support/Neo4jGraphPersistenceTest-context.xml", +"classpath:RestTest-context.xml"}) +@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) +public class RestTraversalTest extends TraversalTest { + +@BeforeClass +public static void startDb() throws Exception { +RestTestBase.startDb(); +} + +@Before +public void cleanDb() { +RestTestBase.cleanDb(); +} + +@AfterClass +public static void shutdownDb() { +RestTestBase.shutdownDb(); + +} + +}