diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/ServerPluginTest.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/ServerPluginTest.java index e673111c6..afb711036 100644 --- a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/ServerPluginTest.java +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/ServerPluginTest.java @@ -18,11 +18,9 @@ package org.springframework.data.neo4j.rest.support; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; - import com.sun.jersey.api.client.WebResource; import org.codehaus.jackson.map.ObjectMapper; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.neo4j.rest.graphdb.RequestResult; import org.springframework.data.neo4j.aspects.Person; @@ -39,24 +37,16 @@ import static org.springframework.data.neo4j.aspects.Person.persistedPerson; * @author mh * @since 14.04.11 */ -@Ignore("TODO") public class ServerPluginTest extends RestTestBase { - private Person person; - @BeforeClass public static void init() { new ProvidedClassPathXmlApplicationContext(neoServer.getGraphDatabase(), "Plugin-context.xml"); } - @Override - public void setUp() throws Exception { - super.setUp(); - person = persistedPerson("Michael", 35); - } - @Test public void testGetFriends() throws IOException { + Person person = persistedPerson("Michael", 35); final RequestResult requestResult = RequestResult.extractFrom(createRequest("ext/TestServerPlugin/graphdb/person").post(ClientResponse.class, "{\"name\":\"" + person.getName() + "\"}")); assertEquals(200, requestResult.getStatus()); final String result = requestResult.getEntity(); diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/TestServerPlugin.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/TestServerPlugin.java index 97f65576d..704172aac 100644 --- a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/TestServerPlugin.java +++ b/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/TestServerPlugin.java @@ -49,12 +49,17 @@ public class TestServerPlugin extends ServerPlugin { } private synchronized ApplicationContext context(GraphDatabaseService graphDb) { - if (ctx==null) { - ctx = new ProvidedClassPathXmlApplicationContext(graphDb, "Plugin-context.xml"); - personRepository = ctx.getBean(PersonRepository.class); - template = ctx.getBean(Neo4jTemplate.class); + try { + if (ctx == null) { + ctx = new ProvidedClassPathXmlApplicationContext(graphDb, "Plugin-context.xml"); + personRepository = ctx.getBean(PersonRepository.class); + template = ctx.getBean(Neo4jTemplate.class); + } + return ctx; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); } - return ctx; } @Name( "get_all_friends" ) diff --git a/spring-data-neo4j-rest/src/test/resources/Plugin-context.xml b/spring-data-neo4j-rest/src/test/resources/Plugin-context.xml index 52f4a4d1c..aad337de4 100644 --- a/spring-data-neo4j-rest/src/test/resources/Plugin-context.xml +++ b/spring-data-neo4j-rest/src/test/resources/Plugin-context.xml @@ -8,8 +8,9 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 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"> - + + - +