DATAREST-1064 - Adapt to API changes in repository interfaces.

Additional cleanups in QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver to make sure a QuerydslRepositoryInvokerAdapter is only applied if the QuerydslPredicateBuilder actually exposes a predicate. Extracted a couple of methods to make sure the mapping pipeline reads nicely.
This commit is contained in:
Oliver Gierke
2017-05-03 17:22:54 +02:00
parent 632ca25998
commit f906695e7a
26 changed files with 104 additions and 89 deletions

View File

@@ -237,18 +237,18 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
public void deletesEntityWithCustomLookupCorrectly() throws Exception {
Address address = repository.save(new Address());
assertThat(repository.findOne(address.id)).isNotNull();
assertThat(repository.findById(address.id)).isNotNull();
RootResourceInformation resourceInformation = getResourceInformation(Address.class);
RepositoryInvoker invoker = spy(resourceInformation.getInvoker());
doReturn(Optional.of(address)).when(invoker).invokeFindOne("foo");
doReturn(Optional.of(address)).when(invoker).invokeFindById("foo");
RootResourceInformation informationSpy = Mockito.spy(resourceInformation);
doReturn(invoker).when(informationSpy).getInvoker();
controller.deleteItemResource(informationSpy, "foo", ETag.from("0"));
assertThat(repository.findOne(address.id)).isEmpty();
assertThat(repository.findById(address.id)).isEmpty();
}
interface AddressProjection {}

View File

@@ -53,7 +53,7 @@ public class TestDataPopulator {
Author john = new Author("John");
Author thomas = new Author("Thomas");
Iterable<Author> authors = this.authors.save(Arrays.asList(ollie, mark, michael, david, john, thomas));
Iterable<Author> authors = this.authors.saveAll(Arrays.asList(ollie, mark, michael, david, john, thomas));
books.save(new Book("1449323952", "Spring Data", 1000, authors, new Offer(21.21, "EUR")));
books.save(new Book("1449323953", "Spring Data (Second Edition)", 2000, authors, new Offer(30.99, "EUR")));
@@ -79,6 +79,6 @@ public class TestDataPopulator {
jane.addSibling(john);
jane.setFather(billyBob);
people.save(Arrays.asList(john, jane));
people.saveAll(Arrays.asList(john, jane));
}
}

View File

@@ -73,7 +73,7 @@ public class Jackson2DatatypeHelperIntegrationTests {
PersistentEntity<?, ?> entity = entities.getRequiredPersistentEntity(Order.class);
PersistentProperty<?> property = entity.getRequiredPersistentProperty("creator");
PersistentPropertyAccessor accessor = entity.getPropertyAccessor(orders.findOne(this.order.getId()).orElse(null));
PersistentPropertyAccessor accessor = entity.getPropertyAccessor(orders.findById(this.order.getId()).orElse(null));
assertThat(objectMapper.writeValueAsString(accessor.getProperty(property))).isNotEqualTo("null");
}