From 6075f3052a76863344a2bf8659bc2ab8ae0bdab6 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 17 Mar 2016 21:29:20 +0100 Subject: [PATCH] DATAREST-782 - Fixed build after Spring 4.2.5 update. Upgraded to JSONPath 1.1.0 as 0.9 is not supported with Spring 4.2 anymore. Tweaked integration tests due to changed semantics and internals of JSONPath >= 1.0. --- pom.xml | 2 +- .../rest/core/AbstractIntegrationTests.java | 2 - .../RepositoryEventIntegrationTests.java | 2 - ...itoryResourceMappingsIntegrationTests.java | 4 +- .../spring-data-rest-tests-core/pom.xml | 1 - .../tests/AbstractWebIntegrationTests.java | 18 ++++---- .../data/rest/tests/CommonWebTests.java | 4 +- .../alps/AlpsControllerIntegrationTests.java | 46 ++++++++++++------- .../data/rest/webmvc/jpa/JpaWebTests.java | 4 +- .../PersistentEntitySerializationTests.java | 6 +-- .../spring-data-rest-tests-mongodb/pom.xml | 2 - .../rest/tests/mongodb/MongoWebTests.java | 6 --- .../PersistentEntitySerializationTests.java | 4 +- ...tEntityToJsonSchemaConverterUnitTests.java | 3 ++ .../security/SecurityIntegrationTests.java | 2 - .../ProjectionJacksonIntegrationTests.java | 4 +- 16 files changed, 55 insertions(+), 55 deletions(-) diff --git a/pom.xml b/pom.xml index dcc9fb871..098d06349 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ 1.1.0.BUILD-SNAPSHOT 4.3.10.Final - 0.9.1 + 1.1.0 false diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java index c9a0f23b3..a7b10143b 100644 --- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java +++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java @@ -22,7 +22,6 @@ import org.springframework.data.rest.core.domain.Person; import org.springframework.data.rest.core.domain.PersonRepository; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; /** * Base class for integration tests loading {@link RepositoryTestsConfig} and populating the {@link PersonRepository} @@ -32,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = RepositoryTestsConfig.class) -@Transactional public abstract class AbstractIntegrationTests { @Autowired PersonRepository repository; diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java index b16e76b87..47c3551d9 100644 --- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java +++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java @@ -42,7 +42,6 @@ import org.springframework.data.rest.core.event.BeforeLinkSaveEvent; import org.springframework.data.rest.core.event.BeforeSaveEvent; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; /** * Tests around the {@link org.springframework.context.ApplicationEvent} handling abstractions. @@ -52,7 +51,6 @@ import org.springframework.transaction.annotation.Transactional; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration -@Transactional public class RepositoryEventIntegrationTests { @Configuration diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java index db64b072a..d56bbf695 100644 --- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java +++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java @@ -42,17 +42,15 @@ import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.Re import org.springframework.hateoas.core.EvoInflectorRelProvider; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; /** * Integration tests for {@link RepositoryResourceMappings}. * * @author Oliver Gierke - * @author Greg Trunquist + * @author Greg Turnquist */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = JpaRepositoryConfig.class) -@Transactional public class RepositoryResourceMappingsIntegrationTests { @Autowired ListableBeanFactory factory; diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml index a1a86d9b5..21d2aae53 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml +++ b/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml @@ -40,7 +40,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java index 643f382a8..cba3785b8 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java @@ -15,17 +15,16 @@ package org.springframework.data.rest.tests; * limitations under the License. */ - import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import net.minidev.json.JSONArray; + import java.util.Collections; import java.util.Map; -import net.minidev.json.JSONArray; - import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -65,7 +64,7 @@ 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]"; + private static final String CONTENT_LINK_JSONPATH = "$._embedded.._links.%s.href"; @Autowired WebApplicationContext context; @Autowired LinkDiscoverers discoverers; @@ -117,8 +116,10 @@ public abstract class AbstractWebIntegrationTests { String href = link.isTemplated() ? link.expand().getHref() : link.getHref(); - MockHttpServletResponse response = mvc.perform(MockMvcRequestBuilders.request(HttpMethod.PATCH, href).// - content(payload.toString()).contentType(mediaType)).// + MockHttpServletResponse response = mvc + .perform(MockMvcRequestBuilders.request(HttpMethod.PATCH, href).// + content(payload.toString()).contentType(mediaType)) + .// andExpect(status().is2xxSuccessful()).// andReturn().getResponse(); @@ -153,7 +154,8 @@ public abstract class AbstractWebIntegrationTests { try { - String href = JsonPath.read(content, String.format(CONTENT_LINK_JSONPATH, rel)).toString(); + String href = JsonPath. read(content, String.format(CONTENT_LINK_JSONPATH, rel)).get(0).toString(); + assertThat("Expected to find a link with rel" + rel + " in the content section of the response!", href, is(expected ? notNullValue() : nullValue())); @@ -247,4 +249,4 @@ public abstract class AbstractWebIntegrationTests { protected MultiValueMap getRootAndLinkedResources() { return new LinkedMultiValueMap(0); } -} \ No newline at end of file +} diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java index e83ff0eb3..fe7ba0a35 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java @@ -134,7 +134,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests { if (searchLink != null) { client.follow(searchLink).// andExpect(client.hasLinkWithRel("self")).// - andExpect(jsonPath("$.domainType", is(nullValue()))); // DATAREST-549 + andExpect(jsonPath("$.domainType").doesNotExist()); // DATAREST-549 } } } @@ -182,7 +182,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests { for (String linkedRel : linked.getValue()) { // Find URIs pointing to linked resources - String jsonPath = String.format("$..%s._links.%s.href", linked.getKey(), linkedRel); + String jsonPath = String.format("$._embedded.%s[*]._links.%s.href", linked.getKey(), linkedRel); String representation = resource.getContentAsString(); JSONArray uris = JsonPath.read(representation, jsonPath); diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java index 08ed68b61..1feae58e1 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java @@ -19,6 +19,8 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import net.minidev.json.JSONArray; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -30,7 +32,6 @@ import org.springframework.data.rest.tests.AbstractControllerIntegrationTests; import org.springframework.data.rest.tests.TestMvcClient; import org.springframework.data.rest.webmvc.ProfileController; import org.springframework.data.rest.webmvc.RestMediaTypes; -import org.springframework.data.rest.webmvc.alps.AlpsController; import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; import org.springframework.data.rest.webmvc.jpa.Item; import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig; @@ -45,6 +46,8 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import com.jayway.jsonpath.JsonPath; + /** * Integration tests for {@link AlpsController}. * @@ -146,9 +149,11 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio assertThat(itemsLink, is(notNullValue())); - client.follow(itemsLink, RestMediaTypes.ALPS_JSON)// - .andExpect( - jsonPath("$.alps.descriptors[?(@.id == 'item-representation')][0].href", endsWith("/profile/items"))); + String result = client.follow(itemsLink, RestMediaTypes.ALPS_JSON).andReturn().getResponse().getContentAsString(); + String href = JsonPath. read(result, "$.alps.descriptors[?(@.id == 'item-representation')].href").get(0) + .toString(); + + assertThat(href, endsWith("/profile/items")); } /** @@ -162,12 +167,13 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio String jsonPath = "$.alps."; // Root jsonPath += "descriptors[?(@.id == 'person-representation')]."; // Representation descriptor - jsonPath += "descriptors[?(@.name == 'father')][0]."; // First father descriptor + jsonPath += "descriptors[?(@.name == 'father')]."; // First father descriptor jsonPath += "rt"; // Return type - client.follow(usersLink, RestMediaTypes.ALPS_JSON)// - .andExpect(jsonPath(jsonPath, - allOf(containsString(ProfileController.PROFILE_ROOT_MAPPING), endsWith("-representation")))); + String result = client.follow(usersLink, RestMediaTypes.ALPS_JSON).andReturn().getResponse().getContentAsString(); + String rt = JsonPath. read(result, jsonPath).get(0).toString(); + + assertThat(rt, allOf(containsString(ProfileController.PROFILE_ROOT_MAPPING), endsWith("-representation"))); } /** @@ -195,10 +201,14 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio Link profileLink = client.discoverUnique("profile"); Link peopleLink = client.discoverUnique(profileLink, "people", MediaType.ALL); - client.follow(peopleLink)// - .andExpect(jsonPath( - "$.alps.descriptors[?(@.id == 'person-representation')].descriptors[?(@.name == 'gender')][0].doc.value", - is("Male, Female, Undefined"))); + String result = client.follow(peopleLink).andReturn().getResponse().getContentAsString(); + + String value = JsonPath + . read(result, + "$.alps.descriptors[?(@.id == 'person-representation')].descriptors[?(@.name == 'gender')].doc.value") + .get(0).toString(); + + assertThat(value, is("Male, Female, Undefined")); } /** @@ -210,9 +220,13 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio Link profileLink = client.discoverUnique("profile"); Link groovyDomainObjectLink = client.discoverUnique(profileLink, "simulatedGroovyDomainClasses"); - client.follow(groovyDomainObjectLink)// - .andExpect(jsonPath( - "$.alps.descriptors[?(@.id == 'simulatedGroovyDomainClass-representation')][0].descriptors[0].name", - is("name"))); + String result = client.follow(groovyDomainObjectLink).andReturn().getResponse().getContentAsString(); + + String name = JsonPath + . read(result, + "$.alps.descriptors[?(@.id == 'simulatedGroovyDomainClass-representation')].descriptors[0].name") + .get(0).toString(); + + assertThat(name, is("name")); } } diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java index e6e63773b..36b1d82f2 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java @@ -694,10 +694,10 @@ public class JpaWebTests extends CommonWebTests { MockHttpServletResponse response = client.request(client.discoverUnique("people")); - String jsonPath = String.format("$._embedded.people[?(@.firstName == '%s')][0]", name); + String jsonPath = String.format("$._embedded.people[?(@.firstName == '%s')]", name); // Assert content inlined - Object john = JsonPath.read(response.getContentAsString(), jsonPath); + Object john = JsonPath. read(response.getContentAsString(), jsonPath).get(0); assertThat(john, is(notNullValue())); assertThat(JsonPath.read(john, "$.firstName"), is(notNullValue())); diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java index 0f02b3b68..c06fb8d9b 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java @@ -225,7 +225,7 @@ public class PersistentEntitySerializationTests { String result = mapper.writeValueAsString(persistentEntityResource); - assertThat(JsonPath.read(result, "$_embedded.orders[*].lineItems"), is(notNullValue())); + assertThat(JsonPath.read(result, "$._embedded.orders[*].lineItems"), is(notNullValue())); } /** @@ -251,7 +251,7 @@ public class PersistentEntitySerializationTests { String result = mapper.writeValueAsString(resource); - assertThat(JsonPath.read(result, "$_embedded.father[*]._links.self"), is(notNullValue())); + assertThat(JsonPath.read(result, "$._embedded.father[*]._links.self"), is(notNullValue())); } /** @@ -270,7 +270,7 @@ public class PersistentEntitySerializationTests { String result = mapper.writeValueAsString(resource); - assertThat(JsonPath.read(result, "$_links.processed"), is(notNullValue())); + assertThat(JsonPath.read(result, "$._links.processed"), is(notNullValue())); } /** diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml index 61610f0b7..5bd179a3e 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml +++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml @@ -33,7 +33,6 @@ com.querydsl querydsl-mongodb ${querydsl} - test @@ -76,7 +75,6 @@ target/generated-sources/annotations org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor - true org.springframework.data.rest.tests.mongodb.groovy,groovy.lang diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java index 45b2de90b..41bdc5dcb 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java @@ -30,12 +30,6 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.rest.tests.CommonWebTests; -import org.springframework.data.rest.tests.mongodb.Address; -import org.springframework.data.rest.tests.mongodb.Profile; -import org.springframework.data.rest.tests.mongodb.ProfileRepository; -import org.springframework.data.rest.tests.mongodb.Receipt; -import org.springframework.data.rest.tests.mongodb.User; -import org.springframework.data.rest.tests.mongodb.UserRepository; import org.springframework.data.rest.webmvc.RestMediaTypes; import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks; import org.springframework.hateoas.Link; diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java index efbb2de6e..0857b5b95 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java @@ -45,7 +45,6 @@ import org.springframework.hateoas.hal.HalLinkDiscoverer; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletWebRequest; @@ -62,7 +61,6 @@ import com.jayway.jsonpath.JsonPath; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { MongoDbRepositoryConfig.class, RepositoryTestsConfig.class, PersistentEntitySerializationTests.TestConfig.class }) -@Transactional public class PersistentEntitySerializationTests { @Autowired ObjectMapper mapper; @@ -114,7 +112,7 @@ public class PersistentEntitySerializationTests { String result = mapper.writeValueAsString(persistentEntityResource); - assertThat(JsonPath.read(result, "$_embedded.users[*].address"), is(notNullValue())); + assertThat(JsonPath.read(result, "$._embedded.users[*].address"), is(notNullValue())); } /** diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java index bcd0a92bf..288f05d92 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java @@ -52,6 +52,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.PathNotFoundException; /** * @author Oliver Gierke @@ -186,6 +187,8 @@ public class PersistentEntityToJsonSchemaConverterUnitTests { try { assertThat(constraint.description, JsonPath.read(writeSchemaFor, constraint.selector), constraint.matcher); + } catch (PathNotFoundException e) { + assertThat(constraint.matcher.matches(null), is(true)); } catch (RuntimeException e) { assertThat(e, constraint.matcher); } diff --git a/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java index d783d8df6..e7bc20f4d 100644 --- a/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java @@ -38,7 +38,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.WebApplicationContext; /** @@ -50,7 +49,6 @@ import org.springframework.web.context.WebApplicationContext; * @author Rob Winch */ @RunWith(SpringJUnit4ClassRunner.class) -@Transactional @ContextConfiguration(classes = { SecurityIntegrationTests.Config.class, SecurityConfiguration.class, RepositoryRestMvcConfiguration.class }) public class SecurityIntegrationTests extends AbstractWebIntegrationTests { diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java index 94700b5b7..86c1d3718 100644 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/ProjectionJacksonIntegrationTests.java @@ -65,7 +65,7 @@ public class ProjectionJacksonIntegrationTests { CustomerProjection projection = factory.createProjection(CustomerProjection.class, customer); String result = mapper.writeValueAsString(projection); - assertThat(JsonPath.read(result, "$firstname"), is((Object) "Dave")); + assertThat(JsonPath.read(result, "$.firstname"), is((Object) "Dave")); } /** @@ -89,7 +89,7 @@ public class ProjectionJacksonIntegrationTests { String result = mapper.writeValueAsString(resources); - assertThat(JsonPath.read(result, "$_embedded.customers[0].firstname"), is((Object) "Dave")); + assertThat(JsonPath.read(result, "$._embedded.customers[0].firstname"), is((Object) "Dave")); } static class Customer {