Commit Graph

40 Commits

Author SHA1 Message Date
Oliver Gierke
8f269e28fe DATAREST-1127 - Patch operations now always verify paths before operation application.
Previously the SpEL expresssion created from JSON Patch path expressions were executed without double checking whether these paths actually exist on the target object in the first place. This is now in place.
2017-09-08 12:20:44 +02:00
Oliver Trosien
48125faea3 DATAREST-889 - JsonPatchPatchConverter explicitly rejects unknown paths and values.
JsonPatchPatchConverter now explicitly rejects problematic JSON Patch payloads (e.g. incorrect paths, incorrect values) throwing a PatchException.

Original pull request: #227.
2016-09-12 16:08:32 +02:00
Oliver Trosien
1fd9a03c68 DATAREST-885 - Support array values in JsonPatchPatchConverter.
Original pull request: #226.
2016-09-12 13:00:02 +02: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
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
Oliver Gierke
070f049edd DATAREST-765 - Polishing.
Removed solrconfig.xml. Minor formatting in solr.xml. Reduced nesting in shutdown handler in SolrInfrastructureConfig.

Original pull request: #209.
2016-02-10 11:10:42 +01:00
Christoph Strobl
598b276843 DATAREST-765 - Update Solr test configuration for Solr 5.
Added required solr.xml and moved core.properties to new location. Additionally registered a CloseHook to prevent SolrCore.close() failures.

Original pull request: #209.
2016-02-10 11:10:42 +01:00
Oliver Gierke
b4bbc1d79c DATAREST-665 - Switched to a more consistent scheme for I18N of JsonSchema.
We now use the following keys in the resource bundle to determine values for the title attribute of JSON schema property (in descending order of preference):

$fullyQualifiedClassName.$property._title
$simpleClassName.$property._title
$property._title

Also tweaked JsonProperty.format to make sure it always serializes as its toString() value.
2015-09-02 10:10:50 +02:00
Greg Turnquist
a31588cabc DATAREST-414 - Added integration tests for Cassandra.
Original pull request: #158.
2015-01-11 17:52:17 +01:00
Christoph Strobl
38d1b81a4d DATAREST-387 - Added integration tests for Spring Data Solr repositories.
Added configuration for setting up an EmbeddedSolrServer instance within a temporary directory. We use a temporary test folder created by JUnit where we copy the required configuration to. The directory will also hold all index data and will be deleted afterwards.

Original pull request: #156.
2014-12-07 15:55:33 +01:00
Greg Turnquist
ef1ee10940 DATAREST-238 - Changed JSON deserializer to ignore links.
Links are a read-only and basically have to be ignored during any inputs. This required removing the deserializer from PersistentEntityJackson2Module. This will cause the object mapping to fail as it doesn't know about the links property in the request body. Instead of requiring that every entity apply the necessary annotation, the mapper is configured to not fail on non-existent attributes. This allowed all the tests to pass while properly handling PUT operations.

Original pull request: #130.
2014-02-13 12:23:57 +01:00
Oliver Gierke
d59ec3bdd4 DATAREST-233 - Introduced @RepositoryRestResource.
@RepositoryRestResource exposes more detailed attributes tailored to the use case of exposing a repository. @RestResource is still recognized on repository interfaces but we now issue a warning and indicate the new annotation to be used.

Introduced a minimal ResourceDescription interface and let @Description be used within @RestResource and @RepositoryRestResource. We now generate default resource bundle keys and resolve them against a "rest-messages" resource bundle by default. JsonSchema converter now uses the rendered descriptions for schema descriptions.
2014-01-24 15:17:14 +01:00
Oliver Gierke
b3a03ea832 DATAREST-198 - Added test case accessing linked resources.
Added Author and Book domain types to JPA tests to show that following the referenced properties works.
2013-12-29 20:03:48 +01:00
Oliver Gierke
8c13ee3b7e DATAREST-203 - Added test cases to show POSTs are generally working.
Some polishing in PersistentEntityResourceArgumentResolver.
2013-12-28 18:04:46 +01:00
Oliver Gierke
44420d862c DATAREST-199 - Tweaked unmarshalling of JSON payloads.
The BeanWrapper used to set and get values of entities now gets a autowired ConversionService applied. Simplified collection and map creation by using Spring API. Added test case to update an entity with an embedded collection.
2013-12-05 07:43:11 +01:00
Oliver Gierke
db2bbfca0e DATAREST-93 - Quite a lot of refactoring.
Integrated pagination resolving and closer integration of Spring Data Commons configuration.
2013-06-14 20:35:42 +02:00
Jon Brisbin
3b600f9ba8 Updated ResourceProcessor framework to call configured RPs at the appropriate time. 2013-02-18 17:21:20 -06:00
Jon Brisbin
6e4e7da142 Incorporated recent changes to Spring Data Commons and dependent projects that obsoleted the need to manage domain object metadata within Spring Data REST. Required updating to the latest snapshots available for spring-data-commons and spring-data-jpa.
Additional changes include:

* Re-wrote the monolithic Controller into separate controller classes that have a more narrow focus.
* Implemented common functionality as a `HandlerMethodArgumentResolver` rather than as a helper method in a controller class.
* Re-implemented JSONP functionality as an HttpMessageConverter rather than inline within a controller class.
* Updated to Jackson 2 for all JSON handling.
* By relying on spring-data-commons, spring-data-rest now handles all supported Repository types: JPA, MongoDB, and GemFire.

Added support for MongoDB and GemFire repositories by relying on spring-data-commons to provide the metadata rather than maintaining internal metadata information that is store-specific.

Replaced Spock spec tests with JMock unit and integration tests. Started integrating Jetty 8 into the testing so MVC testing can be done against a live server.
2013-01-18 10:14:29 -06:00
Jon Brisbin
9dd9afb93f Change AnnotatedHandlerRepositoryEventListener into a BeanPostProcessor which works better all around and processes every bean, looking for event handlers. 2012-10-29 10:24:30 -05:00
Jon Brisbin
dbfd43c1a0 Changes to the order in which ApplicationContexts are loaded, changed package that JavaConfig classes are in to keep them from being picked up by the repository component scanning, split single JavaConfig into separate JPA Repository config and Spring Data REST config classes. 2012-10-02 09:05:21 -05:00
Jon Brisbin
df3b60ba41 Changed the way baseUri is calculated. Changed tests to accommodate new method signatures, fix failing tests.
* Added a configuration property to `RepositoryRestConfiguration` for deployments behind a proxy which do not know the external URL to use as the baseUri for links.
* Changed the way the baseUri is injected into the controller by introducing a `BaseUriMethodArgumentResolver` to inject the proper baseUri (either the one from the configuration, or the one from the request if that's not specified).
2012-10-01 09:52:46 -05:00
Jon Brisbin
cff8065d8d Fixed misspelling. 2012-09-27 15:50:41 -05:00
Jon Brisbin
967e6572ff Removed obsolete reference. 2012-09-27 15:50:24 -05:00
Jon Brisbin
40645673bf Integrated Spring HATEOAS. 2012-08-27 15:16:02 -05:00
Jon Brisbin
3aa8905b15 Added configuration property for domain type to repository mappings. Also improved the post-processing support, though I think there's still some room for tweaking. 2012-08-20 15:06:15 -05:00
Jon Brisbin
b9b6a8fe92 DATAREST-39: Modified the DELETEing of links so that an attempt to delete a required relationship will result in a 405 Method Not Allowed. Had to change the entities and tests to accommodate the new required relationship on the Address entity, which pingponged into a number of changes. 2012-08-17 13:37:26 -05:00
Jon Brisbin
3393780e65 DATAREST-37: Display entities inline when accessing relationship links. 2012-08-13 09:32:42 -05:00
Jon Brisbin
81b5f29c1e Adding a test scenario for @MappedSuperclass, fixed a couple bugs w.r.t. generating links to entities. 2012-08-07 11:03:02 -05:00
Jon Brisbin
7f8abc5aa8 Big update. Bug fixes, code re-formatting, changing tests. 2012-07-26 13:31:34 -05:00
Jon Brisbin
f969f92acc #18, DATAREST-20, DATAREST-21, DATAREST-22 Bugfixes, re-vamp output method, JSONPE support
There were some issues with how results were being displayed in searches versus entity lists. This code changes the way all results are displayed by offereing several options for output. The default is to inline the entity in the response and page the results (defaults to 20). If the UA sends an `Accept` header of `application/x-spring-data-compact+json` or `text/uri-list`, however, SD REST will output a compact list of only links and will not inline the entities.

The method of output was completely rewritten to use HttpMessageConverters exclusively. Views and the subsequent ContentNegotiatingViewResolver machinery have been elimintated. This should make it easier to embed inside an existing Spring MVC application. This is also easily extendable so the user can plug in their own set of HttpMessageConverters for any output format they like (JAXB, Atom/XML, etc...).

Also added was JSONPE support. By setting the `jsonpParamName` property on the `RepositoryRestConfiguration` customization class, the user can change the default JSONP param name of `callback`. There's also a `jsonpOnErrParamName` property on that configuration (defaults to `null`) that will allow you to capture errors using JSONP. Normally this would not be possible using script element injection, but the REST controller changes the status code to 200 and pass your javascript function the actual response code and wraps the error as the second parameter.
2012-07-23 17:08:10 -05:00
Jon Brisbin
ebd50e96e7 Added script to load lots of random names pulled from a spreadsheet based on the 1990 Census. 2012-06-26 11:19:58 -05:00
Jon Brisbin
e0b3d84362 Forgot to add the new Entity to the JPA configuration for fix for #14. 2012-05-23 10:32:37 -05:00
Jon Brisbin
9fb07a0fe5 Fix for #14 where links in linked entities weren't being rendered correctly.
Also added another entity and Repository to push the Person entity down another step in the hierarchy to test this. This change mirrors the one I did to fix #12.
2012-05-23 10:03:50 -05:00
Jon Brisbin
6c5bab7be3 Changed the way I look for ConversionServices to add to the default set of Converters by looking in the ApplicationContext rather than playing monkey games with @Configuration and @Autowired. 2012-05-07 13:28:04 -05:00
Jon Brisbin
e44506c4e0 Reorganize how configuration is loaded, add UUID/String Converters. 2012-05-07 10:26:27 -05:00
Jon Brisbin
077529e830 Added fuller comment(s) about Validators. 2012-04-26 14:31:44 -05:00
Jon Brisbin
4c0b4a8867 Add comment about Validators. 2012-04-26 14:17:22 -05:00
Jon Brisbin
2f0c20bd31 Added ValidatingRepositoryEventListener as a default bean so it's on all the time. 2012-04-26 13:53:53 -05:00
Jon Brisbin
fe9e485d81 Added ApplicationEvent handling and annotation-based extension mechanism. 2012-04-26 11:40:14 -05:00
Jon Brisbin
e49014542c Re-org submodules, add debug compiler options 2012-04-11 15:44:20 -05:00