diff --git a/.gitignore b/.gitignore
index 7a8023634..4434ad519 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.gradle/
bin/
build/
+target/
*.i*
.classpath
.project
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 000000000..616fee36a
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,141 @@
+
+
+
+ 4.0.0
+
+ org.springframework.data
+ spring-data-rest-parent
+ 2.0.0.BUILD-SNAPSHOT
+ pom
+
+ Spring Data REST
+
+
+ org.springframework.data.build
+ spring-data-parent
+ 1.3.0.BUILD-SNAPSHOT
+ ../spring-data-build/parent/pom.xml
+
+
+
+ spring-data-rest-core
+ spring-data-rest-webmvc
+
+
+
+ multi
+ spring-data-rest
+
+ 1.7.0.BUILD-SNAPSHOT
+ 1.5.0.BUILD-SNAPSHOT
+ 1.4.0.BUILD-SNAPSHOT
+ 3.0.0.M1
+ 1.3.3.RELEASE
+
+ 4.2.0.Final
+
+ false
+
+
+
+
+ ogierke
+ Oliver Gierke
+ ogierke at gopivotal.com
+ Pivotal
+ http://www.gopivotal.com
+
+ Project Lead
+
+ +1
+
+
+ gturnquist
+ Greg Turnquist
+ gturnquist at gopivotal.com
+ Pivotal
+ http://www.gopivotal.com
+
+ Developer
+
+ -5
+
+
+
+
+
+
+ javax.validation
+ validation-api
+ 1.0.0.GA
+ true
+
+
+
+
+
+ org.springframework.data
+ spring-data-jpa
+ ${springdata.jpa}
+ test
+
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+ 1.0.1.Final
+ test
+
+
+
+ org.hibernate
+ hibernate-entitymanager
+ ${hibernate.version}
+ test
+
+
+
+ org.springframework.data
+ spring-data-mongodb
+ ${springdata.mongodb}
+ test
+
+
+
+ org.springframework.data
+ spring-data-neo4j
+ ${springdata.neo4j}
+ test
+
+
+
+ org.springframework.data
+ spring-data-gemfire
+ ${springdata.gemfire}
+ test
+
+
+
+ org.hsqldb
+ hsqldb
+ 2.2.8
+ test
+
+
+
+
+
+
+ spring-libs-snapshot
+ http://repo.spring.io/libs-snapshot
+
+
+
+
+
+ spring-plugins-release
+ http://repo.spring.io/plugins-release
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-rest-core/pom.xml b/spring-data-rest-core/pom.xml
new file mode 100644
index 000000000..a316b3519
--- /dev/null
+++ b/spring-data-rest-core/pom.xml
@@ -0,0 +1,64 @@
+
+
+
+ 4.0.0
+
+ spring-data-rest-core
+
+ Spring Data REST - Core
+ Spring Data REST - Core
+
+
+ org.springframework.data
+ spring-data-rest-parent
+ 2.0.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+
+ 0.9.0.BUILD-SNAPSHOT
+ 0.8.0.RELEASE
+ 1.0.1
+
+
+
+
+
+ org.springframework
+ spring-tx
+
+
+
+ org.springframework.data
+ spring-data-commons
+ ${springdata.commons}
+
+
+
+ org.springframework.hateoas
+ spring-hateoas
+ ${spring.hateoas}
+
+
+
+ org.springframework.plugin
+ spring-plugin-core
+ ${springplugin}
+
+
+
+ org.atteo
+ evo-inflector
+ ${evoinflector}
+
+
+
+ joda-time
+ joda-time
+ ${jodatime}
+ true
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/pom.xml b/spring-data-rest-webmvc/pom.xml
new file mode 100644
index 000000000..2aeeffeaa
--- /dev/null
+++ b/spring-data-rest-webmvc/pom.xml
@@ -0,0 +1,102 @@
+
+
+
+ 4.0.0
+
+ spring-data-rest-webmvc
+
+ Spring Data REST - WebMVC
+ Spring Data REST - WebMVC
+
+
+ org.springframework.data
+ spring-data-rest-parent
+ 2.0.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+
+ 2.3.0
+ 0.8.1
+
+
+
+
+
+ ${project.groupId}
+ spring-data-rest-core
+ ${project.version}
+
+
+
+ org.springframework
+ spring-webmvc
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+ provided
+
+
+
+
+
+ org.springframework
+ spring-orm
+ true
+
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+ 1.0.1.Final
+ true
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson}
+
+
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-hibernate4
+ ${jackson}
+ true
+
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate.version}
+ true
+
+
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-joda
+ ${jackson}
+ true
+
+
+
+
+
+ com.jayway.jsonpath
+ json-path
+ ${jsonpath}
+ test
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java
index cb2018589..2c8443097 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java
@@ -52,6 +52,7 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.context.WebApplicationContext;
+import com.jayway.jsonpath.InvalidPathException;
import com.jayway.jsonpath.JsonPath;
/**
@@ -62,6 +63,8 @@ import com.jayway.jsonpath.JsonPath;
@ContextConfiguration(classes = RepositoryRestMvcConfiguration.class)
public abstract class AbstractWebIntegrationTests {
+ private static final String CONTENT_LINK_JSONPATH = "$._embedded.._links.%s.href[0]";
+
protected static MediaType DEFAULT_MEDIA_TYPE = org.springframework.hateoas.MediaTypes.HAL_JSON;
@Autowired WebApplicationContext context;
@@ -143,13 +146,34 @@ public abstract class AbstractWebIntegrationTests {
}
protected Link assertHasContentLinkWithRel(String rel, MockHttpServletResponse response) throws Exception {
+ return assertContentLinkWithRel(rel, response, true);
+ }
+
+ protected void assertDoesNotHaveContentLinkWithRel(String rel, MockHttpServletResponse response) throws Exception {
+ assertContentLinkWithRel(rel, response, false);
+ }
+
+ protected Link assertContentLinkWithRel(String rel, MockHttpServletResponse response, boolean expected)
+ throws Exception {
String content = response.getContentAsString();
- String href = JsonPath.read(content, String.format("$.._links.%s.href[0]", rel)).toString();
- assertThat("Expected to find a link with rel" + rel + " in the content section of the response!", href,
- is(notNullValue()));
- return new Link(href, rel);
+ try {
+
+ String href = JsonPath.read(content, String.format(CONTENT_LINK_JSONPATH, rel)).toString();
+ assertThat("Expected to find a link with rel" + rel + " in the content section of the response!", href,
+ is(expected ? notNullValue() : nullValue()));
+
+ return new Link(href, rel);
+
+ } catch (InvalidPathException o_O) {
+
+ if (expected) {
+ fail("Didn't find any content in the given response!");
+ }
+
+ return null;
+ }
}
protected void assertDoesNotHaveLinkWithRel(String rel, MockHttpServletResponse response) throws Exception {
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
index 0b92bd9c6..fd42ef761 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
@@ -20,12 +20,10 @@ import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collections;
-import java.util.List;
import java.util.Map;
+import java.util.Scanner;
import org.junit.Before;
import org.junit.Test;
@@ -40,7 +38,6 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
-import org.springframework.util.StringUtils;
/**
* Web integration tests specific to JPA.
@@ -189,7 +186,13 @@ public class JpaWebTests extends AbstractWebIntegrationTests {
private String readFile(String name) throws Exception {
ClassPathResource file = new ClassPathResource(name, getClass());
- List lines = Files.readAllLines(file.getFile().toPath(), Charset.forName("UTF-8"));
- return StringUtils.collectionToDelimitedString(lines, System.lineSeparator());
+ StringBuilder builder = new StringBuilder();
+ Scanner scanner = new Scanner(file.getFile(), "UTF-8");
+
+ while (scanner.hasNextLine()) {
+ builder.append(scanner.nextLine());
+ }
+
+ return builder.toString();
}
}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/neo4j/Neo4jWebTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/neo4j/Neo4jWebTests.java
index b281dd8e0..160152baf 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/neo4j/Neo4jWebTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/neo4j/Neo4jWebTests.java
@@ -86,6 +86,6 @@ public class Neo4jWebTests extends AbstractWebIntegrationTests {
mvc.perform(delete(customerLink.getHref()));
// Assert no customers anymore
- assertDoesNotHaveLinkWithRel("self", request(customers));
+ assertDoesNotHaveContentLinkWithRel("self", request(customers));
}
}