DATAREST-1341 - Adapt to package refactorings in Spring HATEOAS.

This commit is contained in:
Oliver Drotbohm
2019-02-27 12:59:45 +01:00
parent 85694576b2
commit 1bf08180db
69 changed files with 370 additions and 1043 deletions

View File

@@ -27,9 +27,9 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.Resources;
import org.springframework.hateoas.core.EmbeddedWrapper;
import org.springframework.hateoas.core.EmbeddedWrappers;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.server.core.EmbeddedWrapper;
import org.springframework.hateoas.server.core.EmbeddedWrappers;
/**
* Unit tests for {@link PersistentEntityResource}.
@@ -42,7 +42,7 @@ public class PersistentEntityResourceUnitTests {
@Mock Object payload;
@Mock PersistentEntity<?, ?> entity;
Resources<EmbeddedWrapper> resources;
CollectionModel<EmbeddedWrapper> resources;
Link link = new Link("http://localhost", "foo");
@Before
@@ -50,7 +50,7 @@ public class PersistentEntityResourceUnitTests {
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
EmbeddedWrapper wrapper = wrappers.wrap("Embedded", LinkRelation.of("foo"));
this.resources = new Resources<EmbeddedWrapper>(Collections.singleton(wrapper));
this.resources = new CollectionModel<EmbeddedWrapper>(Collections.singleton(wrapper));
}
@Test(expected = IllegalArgumentException.class) // DATAREST-317

View File

@@ -45,7 +45,7 @@ import org.springframework.data.rest.core.mapping.ResourceType;
import org.springframework.data.rest.core.mapping.SupportedHttpMethods;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resources;
import org.springframework.hateoas.CollectionModel;
import org.springframework.http.HttpMethod;
/**
@@ -84,7 +84,7 @@ public class RepositoryPropertyReferenceControllerUnitTests {
doReturn(new Sample()).when(invoker).invokeSave(any(Object.class));
RootResourceInformation information = new RootResourceInformation(metadata, entity, invoker);
Resources<Object> request = new Resources<Object>(Collections.emptySet(), new Link("/reference/some-id"));
CollectionModel<Object> request = new CollectionModel<Object>(Collections.emptySet(), new Link("/reference/some-id"));
controller.createPropertyReference(information, HttpMethod.POST, request, 4711, "references");

View File

@@ -31,7 +31,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.rest.webmvc.support.PagingAndSortingTemplateVariables;
import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver;
import org.springframework.data.web.HateoasSortHandlerMethodArgumentResolver;
import org.springframework.hateoas.mvc.UriComponentsContributor;
import org.springframework.hateoas.server.mvc.UriComponentsContributor;
import org.springframework.web.util.UriComponentsBuilder;
/**

View File

@@ -49,10 +49,10 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module;
import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.hateoas.LinkDiscoverers;
import org.springframework.hateoas.client.LinkDiscoverers;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.core.DefaultRelProvider;
import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter;
import org.springframework.hateoas.server.core.DefaultRelProvider;
import org.springframework.hateoas.server.mvc.TypeConstrainedMappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

View File

@@ -49,10 +49,10 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.ExcerptProjector;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.ResourceProcessor;
import org.springframework.hateoas.server.EntityLinks;
import org.springframework.hateoas.server.RepresentationModelProcessor;
import org.springframework.hateoas.UriTemplate;
import org.springframework.hateoas.mvc.ResourceProcessorInvoker;
import org.springframework.hateoas.server.mvc.RepresentationModelProcessorInvoker;
import org.springframework.plugin.core.PluginRegistry;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -92,7 +92,7 @@ public class PersistentEntityJackson2ModuleUnitTests {
this.persistentEntities = new PersistentEntities(Arrays.asList(mappingContext));
ResourceProcessorInvoker invoker = new ResourceProcessorInvoker(Collections.<ResourceProcessor<?>> emptyList());
RepresentationModelProcessorInvoker invoker = new RepresentationModelProcessorInvoker(Collections.<RepresentationModelProcessor<?>> emptyList());
NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities,
new EmbeddedResourcesAssembler(persistentEntities, associations, mock(ExcerptProjector.class)), invoker);

View File

@@ -23,10 +23,10 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
import org.springframework.hateoas.Resources;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.hateoas.hal.Jackson2HalModule.HalHandlerInstantiator;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.server.core.EvoInflectorRelProvider;
import org.springframework.hateoas.mediatype.hal.Jackson2HalModule;
import org.springframework.hateoas.mediatype.hal.Jackson2HalModule.HalHandlerInstantiator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -78,7 +78,7 @@ public class ProjectionJacksonIntegrationTests {
customer.address = new Address();
CustomerProjection projection = factory.createProjection(CustomerProjection.class, customer);
Resources<CustomerProjection> resources = new Resources<CustomerProjection>(Arrays.asList(projection));
CollectionModel<CustomerProjection> resources = new CollectionModel<CustomerProjection>(Arrays.asList(projection));
String result = mapper.writeValueAsString(resources);