186 Commits

Author SHA1 Message Date
Mark Paluch
b06f8664f1 DATAREST-992 - Remove references to Assert single-arg methods.
Replace references to Assert single-arg methods with references to methods accepting the test object and message.

Related ticket: SPR-15196.
2017-02-01 13:25:13 +01:00
Oliver Gierke
5212d1389f DATAREST-976 - Polishing.
Extracted test for the newly supported sorting scenario so that we now.

Original pull request: #251.
2017-01-16 13:36:38 +01:00
Mark Paluch
69c39377ec DATAREST-976 - Embedded properties are now considered in sort property paths.
We now allow sorting by properties of embedded objects. An embedded object is not linkable to a root object but embedded in the resource itself. If any part of the sort property path points to a linkable association, the whole sort property path is discarded silently and not used for sorting any further.

Original pull request: #251.
2017-01-16 13:36:15 +01:00
Mark Paluch
6bb989018c DATAREST-978 - Migrate ticket references in test code to Spring Framework style. 2017-01-13 10:09:53 +01:00
Oliver Gierke
bccb5fdcb8 DATAREST-962 - Fixed imports in Gemfire integration tests after move to Geode. 2016-12-16 11:01:39 +01:00
Oliver Gierke
aa7eec4683 DATAREST-835 - Search resources returning a single resource now get and consider ETag and Last-Modified headers.
We now interpret If-None-Match and If-Modified-Since headers on requests to resources backed by query methods returning a single instance only. This allows clients to optimize GET requests to those resources to save bandwidth.
2016-12-08 21:35:37 +01:00
Mark Paluch
0dc97dcc56 DATAREST-910 - Support nested Sort properties.
We now support nested Sort properties considering Jackson mapping. Sort translation is optional and skipped if the domain class is not resolvable. Translation in the scope of a domain class maps property paths to apply sorting using embedded properties.

A sort string `nested-name` resolves to a property path `anotherWrap.embedded.name`.

class Aggregate {

	@JsonUnwrapped
	public UnwrapEmbedded anotherWrap;
}

class UnwrapEmbedded {

	@JsonUnwrapped(prefix = "nested-")
	public Embedded embedded;
}

class Embedded {
	public String name;
}

Original pull request: #232.
2016-12-06 12:00:38 +01:00
Oliver Gierke
21b7d7cbed DATAREST-925 - Polishing.
Original pull request: #238.
2016-12-02 20:17:08 +01:00
Craig Andrews
8149a02820 DATAREST-925 - Invoke ResourceProcessors for ProjectionResources.
The serializer for projection resources now also invokes ResourceProcessor instances registered for that particular projection.

Original pull request: #238.
2016-12-02 20:17:08 +01:00
Oliver Gierke
03aa65890e DATAREST-934 - Prepare next development iteration. 2016-11-23 10:59:09 +01:00
Oliver Gierke
4e8771eee8 DATAREST-934 - Release version 3.0 M1 (Kay). 2016-11-23 10:35:48 +01:00
Oliver Gierke
8327b6f4ab DATAREST-935 - Prepare 3.0 development.
Upgraded version numbers and dependencies to Spring Data build parent, Commons and store modules. Fixed a compiler issue in DomainObjectReader.
2016-11-18 16:13:54 +01:00
Oliver Gierke
8fd259dd32 DATAREST-906 - Polishing. 2016-11-03 16:28:33 +01:00
Oliver Gierke
40bb8e8e6c DATAREST-573 - Polishing.
Removed RepositoryRestConfiguration.addCorsMapping(…) as we currently don't have any other shortcut methods for configuration like this.

Tweaked the setup of (now Repository)CorsConfigurationAccessor to be created earlier so that we avoid recreation for every lookup. Introduced a NoOpStringValueResolver to be used by default so that we don't need to deal with the case of the resolver being null at the end of the call chain. Replaced constructor of RepositoryCorsConfigurationAccessor with corresponding Lombok annotation.

Updated reference documentation accordingly.

Original pull request: #233.
2016-10-28 14:19:26 +02:00
Mark Paluch
a3870ca528 DATAREST-573 - Add support for new CORS configuration mechanisms introduced in Spring 4.2.
We now support CORS configuration mechanisms introduced in Spring 4.2. CORS can be configured on multiple levels: Repository interface, Repository REST controller and global level. Spring Data REST CORS configuration is isolated so Spring Web MVC'S CORS configuration does not apply to Spring Data REST resources.

 Multiple configuration sources are merged so different aspects of CORS can be configured in separate locations.

@CrossOrigin
interface PersonRepository extends CrudRepository<Person, Long> {}

@RepositoryRestController
@RequestMapping("/person")
public class PersonController {

	@CrossOrigin(maxAge = 3600)
	@RequestMapping(method = RequestMethod.GET, "/xml/{id}", produces = MediaType.APPLICATION_XML_VALUE)
	public Person retrieve(@PathVariable Long id) {
		// ...
	}
}

@Component
public class SpringDataRestCustomization extends RepositoryRestConfigurerAdapter {

  @Override
  public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {

    config.addCorsMapping("/person/**")
        .allowedOrigins("http://domain2.com")
        .allowedMethods("PUT", "DELETE")
        .allowedHeaders("header1", "header2", "header3")
        .exposedHeaders("header1", "header2")
        .allowCredentials(false).maxAge(3600);
  }
}
2016-10-28 14:19:26 +02:00
Mark Paluch
b436662304 DATAREST-906 - Consider default Pageable even if Sort is empty.
We now resolve default configured Pageable without dropping them if their Sort is empty. Previously, any default Pageable was dropped if its Sort was empty which caused null being handed to controller methods of @RepositoryRestController instances.

Original pull request: #231.
2016-09-23 15:20:56 +02:00
Oliver Gierke
90f57bd1e7 DATAREST-872 - Polishing.
Simplified types used for testing. Removed unnecessary repository interface.

Related pull request: #221.
2016-09-19 10:28:12 +02:00
Alex Leigh
c36267a447 DATAREST-872 - PersistentEntityJackson2Module now serializes JsonTypeInfo correctly.
NestedEntitySerializer now overrides serializeWithType(…) so that @JsonTypeInfo is rendered properly.

Related pull request: #221.
2016-09-19 10:28:09 +02:00
Oliver Gierke
216e267fce DATAREST-883 - Polishing.
Switched to use @RequiredArgsConstructor where possible. Slightly rearranged test cases. Inlined JacksonMappingAwareSortTranslator to not expose it as bean unless necessary. Use static Jackson BeanClassIntrospector to avoid unnecessary recreation.

Original pull request: #222.
2016-09-19 08:05:45 +02:00
Mark Paluch
a999bd3ca8 DATAREST-883 - Consider Jackson field names in Sort mapping.
We now consider Jackson field names when resolving Sort arguments. Domain model properties annotated with @JsonProperty("sales") can be specified by their Jackson-mapped field name in sort arguments. Field names are mapped to their according persistent property names to be used in repository query method sorting. Unknown field names are silently dropped.

Original pull request: #222.
2016-09-19 08:05:45 +02:00
Oliver Gierke
254c4515e1 DATAREST-864 - NestedEntitySerializer now handles Maps correctly.
Previously, NestedEntitySerializer failed to handle Maps correctly as the logic to convert the found values to nested resources tried to handle the values as is, not explicitly looking at the values instead.

We now use an explicit code path to turn the values into resources so that links pointing to other resources are rendered correctly.

Original pull request: #219.
2016-09-16 16:34:06 +02:00
Oliver Gierke
360ed8a9b2 DATAREST-892 - Fixed integration tests checking for HTTP Content-Type headers.
Spring 4.3 returns Content-Type headers including the character encoding. We needed to relax our assertions on the content type headers to only check for compatibility.
2016-09-09 22:53:42 +02:00
Oliver Gierke
4cb0632518 DATAREST-880 - Prevent nested-entity-as-resource handling for unwrapped properties.
We now exclude properties that are marked as to be unwrapped from getting the nested-entity-as-resource behavour applied as it doesn't make any sense.
2016-08-29 19:26:07 +02:00
Oliver Gierke
b4163e5365 DATAREST-868 - Fixed Jackson core dependency in Solr tests. 2016-08-08 12:47:37 +02:00
Oliver Gierke
eb630ef273 DATAREST-803 - Prepare next development iteration. 2016-07-27 14:32:36 +02:00
Oliver Gierke
eaca77051a DATAREST-803 - Release version 2.6 M1 (Ingalls). 2016-07-27 13:52:12 +02:00
Oliver Gierke
9e5fd30c68 DATAREST-837 - Move to ResourceProcessor invcation infrastructure in Spring HATEOAS.
Deprecated the ResourceProcessor invoking infrastructure in place here in favor of the types moved to Spring HATEOAS. Refactored our codebase to make use of these newly introduced types right away.

Related tickets: spring-projects/spring-hateoas#362.
2016-06-10 21:33:33 +02:00
Oliver Gierke
e18fe00ea6 DATAREST-790 - Prepare next development iteration. 2016-04-06 16:36:59 +02:00
Oliver Gierke
c49a29a247 DATAREST-790 - Release version 2.5 GA (Hopper). 2016-04-06 16:35:59 +02:00
Oliver Gierke
e5a1f2d1cf DATAREST-794 - Upgraded to Solr 5.5 to make integration tests work again. 2016-04-01 10:42:18 +02:00
Oliver Gierke
05c723fe50 DATAREST-782 - Prepare next development iteration. 2016-03-18 11:15:51 +01:00
Oliver Gierke
03a720d1c0 DATAREST-782 - Release version 2.5 RC1 (Hopper). 2016-03-18 11:15:00 +01:00
Oliver Gierke
4430e78966 DATAREST-787 - Remove dependency to JSON Patch library.
Switched to own JSON Patch implementation built by Craig Walls for Spring Sync back in the days.
2016-03-18 09:47:27 +01:00
Oliver Gierke
6075f3052a 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.
2016-03-17 21:29:20 +01:00
Oliver Gierke
2be6b2b6a9 DATAREST-776, DATAREST-775 - Integration tests for lookup types and nested associations.
Added shop integration test example that shows and tests nested associations and both unique and collection lookup type references.
2016-02-29 19:40:12 +01:00
Oliver Gierke
892409da2c DATAREST-774 - Separated integration tests from core project to avoid classpath overlap.
Extracted store specific tests into separate test modules to prevent classpath overlap between projects. Those tests are now executed in an "it" build profile to prevent the tests being packaged for distribution on release.

Use Map-based repositories and mapping contexts for test in the Core and WebMvc module.

Slightly changed the configuration API for lookup types on RepositoryRestConfiguration.

Related ticket: DATAREST-776.
2016-02-29 19:40:10 +01:00