DATAREST-978 - Migrate ticket references in test code to Spring Framework style.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,18 +68,12 @@ public class PathUnitTests {
|
||||
assertThat(new Path("http://localhost").toString(), is("http://localhost"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-222
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-222
|
||||
public void doesNotMatchIfReferenceContainsReservedCharacters() {
|
||||
assertThat(new Path("/foobar").matches("barfoo{?foo}"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-222
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-222
|
||||
public void doesNotMatchNullReference() {
|
||||
assertThat(new Path("/foobar").matches(null), is(false));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,40 +51,28 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
new MetadataConfiguration(), mock(EnumTranslationConfiguration.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodiesIfAcceptHeaderPresentByDefault() {
|
||||
|
||||
assertThat(configuration.returnBodyOnCreate(MediaType.APPLICATION_JSON_VALUE), is(true));
|
||||
assertThat(configuration.returnBodyOnUpdate(MediaType.APPLICATION_JSON_VALUE), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void doesNotReturnBodiesIfNoAcceptHeaderPresentByDefault() {
|
||||
|
||||
assertThat(configuration.returnBodyOnCreate(null), is(false));
|
||||
assertThat(configuration.returnBodyOnUpdate(null), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void doesNotReturnBodiesIfEmptyAcceptHeaderPresentByDefault() {
|
||||
|
||||
assertThat(configuration.returnBodyOnCreate(""), is(false));
|
||||
assertThat(configuration.returnBodyOnUpdate(""), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void doesNotReturnBodyForUpdateIfExplicitlyDeactivated() {
|
||||
|
||||
configuration.setReturnBodyOnUpdate(false);
|
||||
@@ -94,10 +82,7 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
assertThat(configuration.returnBodyOnUpdate(MediaType.APPLICATION_JSON_VALUE), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void doesNotReturnBodyForCreateIfExplicitlyDeactivated() {
|
||||
|
||||
configuration.setReturnBodyOnCreate(false);
|
||||
@@ -107,10 +92,7 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
assertThat(configuration.returnBodyOnCreate(MediaType.APPLICATION_JSON_VALUE), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodyForUpdateIfExplicitlyActivated() {
|
||||
|
||||
configuration.setReturnBodyOnUpdate(true);
|
||||
@@ -120,10 +102,7 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
assertThat(configuration.returnBodyOnUpdate(MediaType.APPLICATION_JSON_VALUE), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodyForCreateIfExplicitlyActivated() {
|
||||
|
||||
configuration.setReturnBodyOnCreate(true);
|
||||
@@ -133,10 +112,7 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
assertThat(configuration.returnBodyOnCreate(MediaType.APPLICATION_JSON_VALUE), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-776
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-776
|
||||
public void considersDomainTypeOfValueRepositoryLookupTypes() {
|
||||
|
||||
configuration.withEntityLookup().forLookupRepository(ProfileRepository.class);
|
||||
@@ -144,10 +120,7 @@ public class RepositoryRestConfigurationUnitTests {
|
||||
assertThat(configuration.isLookupType(Profile.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void configuresCorsProcessing() {
|
||||
|
||||
RepositoryCorsRegistry registry = configuration.getCorsRegistry();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,10 +70,7 @@ public class UriToEntityConverterUnitTests {
|
||||
repositories);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void supportsOnlyEntitiesWithIdProperty() {
|
||||
|
||||
Set<ConvertiblePair> result = converter.getConvertibleTypes();
|
||||
@@ -82,18 +79,12 @@ public class UriToEntityConverterUnitTests {
|
||||
assertThat(result, not(hasItem(new ConvertiblePair(URI.class, NonEntity.class))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void cannotConvertEntityWithIdPropertyIfStringConversionMissing() {
|
||||
assertThat(converter.matches(URI_TYPE, ENTITY_TYPE), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void canConvertEntityWithIdPropertyAndFromStringConversionPossible() {
|
||||
|
||||
doReturn(mock(RepositoryInformation.class)).when(repositories).getRepositoryInformationFor(ENTITY_TYPE.getType());
|
||||
@@ -101,18 +92,12 @@ public class UriToEntityConverterUnitTests {
|
||||
assertThat(converter.matches(URI_TYPE, ENTITY_TYPE), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void cannotConvertEntityWithoutIdentifier() {
|
||||
assertThat(converter.matches(URI_TYPE, TypeDescriptor.valueOf(NonEntity.class)), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void invokesConverterWithLastUriPathSegment() {
|
||||
|
||||
Entity reference = new Entity();
|
||||
@@ -124,42 +109,27 @@ public class UriToEntityConverterUnitTests {
|
||||
assertThat(converter.convert(URI.create("/foo/bar/1"), URI_TYPE, ENTITY_TYPE), is((Object) reference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test(expected = ConversionFailedException.class)
|
||||
@Test(expected = ConversionFailedException.class) // DATAREST-427
|
||||
public void rejectsUnknownType() {
|
||||
converter.convert(URI.create("/foo/1"), URI_TYPE, STRING_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test(expected = ConversionFailedException.class)
|
||||
@Test(expected = ConversionFailedException.class) // DATAREST-427
|
||||
public void rejectsUriWithLessThanTwoSegments() {
|
||||
converter.convert(URI.create("1"), URI_TYPE, ENTITY_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-741
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-741
|
||||
public void rejectsNullPersistentEntities() {
|
||||
new UriToEntityConverter(null, invokerFactory, repositories);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-741
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-741
|
||||
public void rejectsNullRepositoryInvokerFactory() {
|
||||
new UriToEntityConverter(mock(PersistentEntities.class), null, repositories);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-741
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-741
|
||||
public void rejectsNullRepositories() {
|
||||
new UriToEntityConverter(mock(PersistentEntities.class), invokerFactory, null);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,10 +47,7 @@ public class ValidationErrorsUnitTests {
|
||||
this.entities = new PersistentEntities(Arrays.asList(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-798
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-798
|
||||
public void exposesNestedViolationsCorrectly() {
|
||||
|
||||
ValidationErrors errors = new ValidationErrors(new Foo(), entities);
|
||||
@@ -62,10 +59,7 @@ public class ValidationErrorsUnitTests {
|
||||
assertThat(errors.getFieldError().getField(), is("bars[0].field"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-801
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-801
|
||||
public void getsTheNestedFieldsValue() {
|
||||
expectedErrorBehavior(new ValidationErrors(new Foo(), entities));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,58 +31,37 @@ import org.springframework.data.rest.core.config.ProjectionDefinitionConfigurati
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ProjectionDefinitionConfigurationUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsNullProjectionTypeForAutoConfiguration() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsUnannotatedClassForConfigurationShortcut() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsNullProjectionTypeForManualConfiguration() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(null, "name", Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsNullNameForManualConfiguration() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(String.class, (String) null, Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsEmptyNameForManualConfiguration() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(String.class, "", Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-221
|
||||
public void rejectsEmptySourceTypes() {
|
||||
new ProjectionDefinitionConfiguration().addProjection(String.class, "name", new Class<?>[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void findsRegisteredProjection() {
|
||||
|
||||
ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();
|
||||
@@ -91,10 +70,7 @@ public class ProjectionDefinitionConfigurationUnitTests {
|
||||
assertThat(configuration.getProjectionType(String.class, "name"), is(equalTo((Class) Integer.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void registersAnnotatedProjection() {
|
||||
|
||||
ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();
|
||||
@@ -103,10 +79,7 @@ public class ProjectionDefinitionConfigurationUnitTests {
|
||||
assertThat(configuration.getProjectionType(Integer.class, "name"), is(equalTo((Class) SampleProjection.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void defaultsNameToSimpleClassNameIfNotAnnotated() {
|
||||
|
||||
ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();
|
||||
@@ -115,10 +88,7 @@ public class ProjectionDefinitionConfigurationUnitTests {
|
||||
assertThat(configuration.getProjectionType(Integer.class, "default"), is(equalTo((Class) Default.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void definitionEquals() {
|
||||
|
||||
ProjectionDefinition objectName = ProjectionDefinition.of(Object.class, Object.class, "name");
|
||||
@@ -139,10 +109,7 @@ public class ProjectionDefinitionConfigurationUnitTests {
|
||||
assertThat(objectName, is(not(new Object())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-385
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-385
|
||||
public void returnsProjectionForParentClass() {
|
||||
|
||||
ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();
|
||||
@@ -153,18 +120,12 @@ public class ProjectionDefinitionConfigurationUnitTests {
|
||||
assertThat(configuration.getProjectionType(Child.class, "summary"), is(typeCompatibleWith(ParentProjection.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void defaultsParamternameToProjection() {
|
||||
assertThat(new ProjectionDefinitionConfiguration().getParameterName(), is("projection"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-747
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-747
|
||||
public void returnsMostConcreteProjectionForSourceType() {
|
||||
|
||||
ProjectionDefinitionConfiguration configuration = new ProjectionDefinitionConfiguration();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,82 +82,52 @@ public class RepositoryEventIntegrationTests {
|
||||
person = people.save(new Person("Jane", "Doe"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchBeforeCreate() throws Exception {
|
||||
appCtx.publishEvent(new BeforeCreateEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchAfterCreate() throws Exception {
|
||||
appCtx.publishEvent(new AfterCreateEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchBeforeSave() throws Exception {
|
||||
appCtx.publishEvent(new BeforeSaveEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchAfterSave() throws Exception {
|
||||
appCtx.publishEvent(new AfterSaveEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchBeforeDelete() throws Exception {
|
||||
appCtx.publishEvent(new BeforeDeleteEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchAfterDelete() throws Exception {
|
||||
appCtx.publishEvent(new AfterDeleteEvent(person));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchBeforeLinkSave() throws Exception {
|
||||
appCtx.publishEvent(new BeforeLinkSaveEvent(person, new Object()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchAfterLinkSave() throws Exception {
|
||||
appCtx.publishEvent(new AfterLinkSaveEvent(person, new Object()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchBeforeLinkDelete() throws Exception {
|
||||
appCtx.publishEvent(new BeforeLinkDeleteEvent(person, new Object()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-388
|
||||
*/
|
||||
@Test(expected = EventHandlerInvokedException.class)
|
||||
@Test(expected = EventHandlerInvokedException.class) // DATAREST-388
|
||||
public void shouldDispatchAfterLinkDelete() throws Exception {
|
||||
appCtx.publishEvent(new AfterLinkDeleteEvent(person, new Object()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,9 +40,10 @@ public interface PersonRepository extends PagingAndSortingRepository<Person, UUI
|
||||
Page<Person> findByCreatedGreaterThan(@Param("date") Date date, Pageable pageable);
|
||||
|
||||
/**
|
||||
* @see DATAREST-107 - this method matches the earlier one, causing an ambiguous mapping except for the exported
|
||||
* This method matches the earlier one, causing an ambiguous mapping except for the exported
|
||||
* setting
|
||||
*/
|
||||
// DATAREST-107
|
||||
@RestResource(rel = "firstname", path = "firstname", exported = false)
|
||||
Person findByFirstName(@Param("firstName") String firstName);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,10 +35,7 @@ import org.springframework.util.MultiValueMap;
|
||||
*/
|
||||
public class AnnotatedEventHandlerInvokerUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-582
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-582
|
||||
@SuppressWarnings("unchecked")
|
||||
public void doesNotDiscoverMethodsOnProxyClasses() {
|
||||
|
||||
@@ -55,10 +52,7 @@ public class AnnotatedEventHandlerInvokerUnitTests {
|
||||
assertThat(methods.get(BeforeCreateEvent.class), hasSize(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-606
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-606
|
||||
public void invokesPrivateEventHandlerMethods() {
|
||||
|
||||
SampleWithPrivateHandler sampleHandler = new SampleWithPrivateHandler();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,10 +47,7 @@ import org.springframework.http.HttpMethod;
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACMNS-589, DATAREST-409
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-589, DATAREST-409
|
||||
public void doesNotSupportAnyHttpMethodForEmptyRepository() {
|
||||
|
||||
SupportedHttpMethods supportedMethods = getSupportedHttpMethodsFor(RawRepository.class);
|
||||
@@ -62,10 +59,7 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
assertMethodsSupported(supportedMethods, ITEM, false, GET, PUT, POST, PATCH, DELETE, HEAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217, DATAREST-330, DATACMNS-589, DATAREST-409
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217, DATAREST-330, DATACMNS-589, DATAREST-409
|
||||
public void defaultsSupportedHttpMethodsForItemResource() {
|
||||
|
||||
SupportedHttpMethods supportedHttpMethods = getSupportedHttpMethodsFor(SampleRepository.class);
|
||||
@@ -74,10 +68,7 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
assertMethodsSupported(supportedHttpMethods, ITEM, false, POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217, DATAREST-330, DATACMNS-589, DATAREST-409
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217, DATAREST-330, DATACMNS-589, DATAREST-409
|
||||
public void defaultsSupportedHttpMethodsForCollectionResource() {
|
||||
|
||||
SupportedHttpMethods supportedHttpMethods = getSupportedHttpMethodsFor(SampleRepository.class);
|
||||
@@ -86,10 +77,7 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
assertMethodsSupported(supportedHttpMethods, COLLECTION, false, PUT, PATCH, DELETE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-589, DATAREST-409
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACMNS-589, DATAREST-409
|
||||
public void doesNotSupportDeleteIfDeleteMethodIsNotExported() {
|
||||
|
||||
SupportedHttpMethods supportedHttpMethods = getSupportedHttpMethodsFor(HidesDelete.class);
|
||||
@@ -97,10 +85,7 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
assertMethodsSupported(supportedHttpMethods, ITEM, false, DELETE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-523
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-523
|
||||
public void exposesMethodsForProperties() {
|
||||
|
||||
KeyValueMappingContext context = new KeyValueMappingContext();
|
||||
@@ -121,18 +106,12 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
|
||||
allOf(hasItem(GET), not(hasItems(DELETE, PATCH, PUT, POST))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-825
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-825
|
||||
public void supportsDeleteIfFindOneIsHidden() {
|
||||
assertMethodsSupported(getSupportedHttpMethodsFor(HidesFindOne.class), ITEM, true, DELETE, PATCH, PUT, OPTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-825
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-825
|
||||
public void doesNotSupportDeleteIfNoFindOneAvailable() {
|
||||
assertMethodsSupported(getSupportedHttpMethodsFor(NoFindOne.class), ITEM, false, DELETE);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,10 +45,7 @@ public class MappingResourceMetadataUnitTests {
|
||||
new PersistentEntities(Arrays.asList(context)));
|
||||
MappingResourceMetadata metadata = new MappingResourceMetadata(entity, resourceMappings);
|
||||
|
||||
/**
|
||||
* @see DATAREST-514
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-514
|
||||
public void allowsLookupOfPropertyByMappedName() {
|
||||
|
||||
KeyValuePersistentProperty property = entity.getPersistentProperty("related");
|
||||
@@ -60,19 +57,13 @@ public class MappingResourceMetadataUnitTests {
|
||||
assertThat(metadata.getMappingFor(property).getPath().matches("foo"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-518
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-518
|
||||
public void isNotExportedByDefault() {
|
||||
|
||||
assertThat(metadata.isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-518
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-518
|
||||
public void isExportedIfExplicitlyAnnotated() {
|
||||
|
||||
MappingResourceMetadata metadata = new MappingResourceMetadata(context.getPersistentEntity(Related.class),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,10 +43,7 @@ public class PersistentPropertyResourceMappingUnitTests {
|
||||
|
||||
KeyValueMappingContext mappingContext = new KeyValueMappingContext();
|
||||
|
||||
/**
|
||||
* @see DATAREST-175
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-175
|
||||
public void usesPropertyNameAsDefaultResourceMappingRelAndPath() {
|
||||
|
||||
ResourceMapping mapping = getPropertyMappingFor(Entity.class, "first");
|
||||
@@ -57,10 +54,7 @@ public class PersistentPropertyResourceMappingUnitTests {
|
||||
assertThat(mapping.isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-175
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-175
|
||||
public void considersMappingAnnotationOnDomainClassProperty() {
|
||||
|
||||
ResourceMapping mapping = getPropertyMappingFor(Entity.class, "second");
|
||||
@@ -71,10 +65,7 @@ public class PersistentPropertyResourceMappingUnitTests {
|
||||
assertThat(mapping.isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-175
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-175
|
||||
public void considersMappingAnnotationOnDomainClassPropertyMethod() {
|
||||
|
||||
ResourceMapping mapping = getPropertyMappingFor(Entity.class, "third");
|
||||
@@ -85,10 +76,7 @@ public class PersistentPropertyResourceMappingUnitTests {
|
||||
assertThat(mapping.isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-233
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-233
|
||||
public void returnsDefaultDescriptionKey() {
|
||||
|
||||
ResourceMapping mapping = getPropertyMappingFor(Entity.class, "second");
|
||||
@@ -99,10 +87,7 @@ public class PersistentPropertyResourceMappingUnitTests {
|
||||
assertThat(description.getMessage(), is("rest.description.entity.second"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-233
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-233
|
||||
public void considersAtDescription() {
|
||||
|
||||
ResourceMapping mapping = getPropertyMappingFor(Entity.class, "fourth");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,10 +76,7 @@ public class RepositoryCollectionResourceMappingUnitTests {
|
||||
assertThat(mapping.isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-229
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-229
|
||||
public void detectsPagingRepository() {
|
||||
assertThat(getResourceMappingFor(PersonRepository.class).isPagingResource(), is(true));
|
||||
}
|
||||
@@ -92,10 +89,7 @@ public class RepositoryCollectionResourceMappingUnitTests {
|
||||
assertThat(mapping.getItemResourceRel(), is("bar"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-445
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-445
|
||||
public void usesDomainTypeFromRepositoryMetadata() {
|
||||
|
||||
RepositoryMetadata metadata = new DefaultRepositoryMetadata(PersonRepository.class) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,10 +38,7 @@ import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.Re
|
||||
@SuppressWarnings("serial")
|
||||
public class RepositoryDetectionStrategiesUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-473
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-473
|
||||
public void allExposesAllRepositories() {
|
||||
|
||||
assertExposures(ALL, new HashMap<Class<?>, Boolean>() {
|
||||
@@ -54,10 +51,7 @@ public class RepositoryDetectionStrategiesUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-473
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-473
|
||||
public void defaultHonorsVisibilityAndAnnotations() {
|
||||
|
||||
assertExposures(DEFAULT, new HashMap<Class<?>, Boolean>() {
|
||||
@@ -70,10 +64,7 @@ public class RepositoryDetectionStrategiesUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-473
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-473
|
||||
public void visibilityHonorsTypeVisibilityOnly() {
|
||||
|
||||
assertExposures(VISIBILITY, new HashMap<Class<?>, Boolean>() {
|
||||
@@ -86,11 +77,7 @@ public class RepositoryDetectionStrategiesUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-473
|
||||
*/
|
||||
|
||||
@Test
|
||||
@Test // DATAREST-473
|
||||
public void annotatedHonorsAnnotationsOnly() {
|
||||
|
||||
assertExposures(ANNOTATED, new HashMap<Class<?>, Boolean>() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,10 +61,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.getPath(), is(new Path("bar")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-31
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-31
|
||||
public void doesNotDiscoverAnyParametersIfNotAnnotated() throws Exception {
|
||||
|
||||
Method method = PersonRepository.class.getMethod("findByLastname", String.class);
|
||||
@@ -73,10 +70,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.getParametersMetadata().getParameterNames(), is(emptyIterable()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-31
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-31
|
||||
public void resolvesParameterNamesIfNotAnnotated() throws Exception {
|
||||
|
||||
Method method = PersonRepository.class.getMethod("findByFirstname", String.class);
|
||||
@@ -86,10 +80,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.getParametersMetadata().getParameterNames(), hasItem("firstname"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-229
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-229
|
||||
public void considersPagingFinderAPagingResource() throws Exception {
|
||||
|
||||
Method method = PersonRepository.class.getMethod("findByEmailAddress", String.class, Pageable.class);
|
||||
@@ -107,10 +98,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.getRel(), is("findByEmailAddress"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-384
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-384
|
||||
public void considersResourceSortableIfSortParameterIsPresent() throws Exception {
|
||||
|
||||
Method method = PersonRepository.class.getMethod("findByEmailAddress", String.class, Sort.class);
|
||||
@@ -124,10 +112,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.isSortableResource(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void returnsDomainTypeAsProjectionSourceType() throws Exception {
|
||||
|
||||
@@ -137,10 +122,7 @@ public class RepositoryMethodResourceMappingUnitTests {
|
||||
assertThat(mapping.getReturnedDomainType(), is(equalTo((Class) Person.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-699
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-699
|
||||
public void doesNotIncludePageableAsParameter() throws Exception {
|
||||
|
||||
Method method = PersonRepository.class.getMethod("findByLastname", String.class, Pageable.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,10 +89,7 @@ public class RepositoryResourceMappingsIntegrationTests {
|
||||
assertThat(creditCardMapping.getSearchResourceMappings().isExported(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-112
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-112
|
||||
public void usesPropertyNameAsRelForPropertyResourceMapping() {
|
||||
|
||||
Repositories repositories = new Repositories(factory);
|
||||
@@ -107,10 +104,7 @@ public class RepositoryResourceMappingsIntegrationTests {
|
||||
assertThat(mapping.isExported(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-111
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-111
|
||||
public void exposesResourceByPath() {
|
||||
|
||||
assertThat(mappings.exportsTopLevelResourceFor("people"), is(true));
|
||||
@@ -123,10 +117,7 @@ public class RepositoryResourceMappingsIntegrationTests {
|
||||
assertThat(mappings.exportsTopLevelResourceFor("creditCards"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-107
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-107
|
||||
public void skipsSearchMethodsNotExported() {
|
||||
|
||||
ResourceMetadata creditCardMetadata = mappings.getMetadataFor(CreditCard.class);
|
||||
@@ -145,10 +136,7 @@ public class RepositoryResourceMappingsIntegrationTests {
|
||||
assertThat(methodNames, hasItems("findByFirstName", "findByCreatedGreaterThan"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-325
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-325
|
||||
public void exposesMethodResourceMappingInPackageProtectedButExportedRepo() {
|
||||
|
||||
ResourceMetadata metadata = mappings.getMetadataFor(Author.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,10 +51,7 @@ public class TypeBasedCollectionResourceMappingUnitTests {
|
||||
assertThat(mapping.isExported(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-99
|
||||
public void doesNotExportNonPublicTypesByDefault() {
|
||||
|
||||
CollectionResourceMapping mapping = new TypeBasedCollectionResourceMapping(HiddenSample.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,34 +81,22 @@ public class DefaultSelfLinkProviderUnitTests {
|
||||
this.provider = new DefaultSelfLinkProvider(entities, entityLinks, lookups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-724
|
||||
public void rejectsNullEntities() {
|
||||
new DefaultSelfLinkProvider(null, entityLinks, lookups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-724
|
||||
public void rejectsNullEntityLinks() {
|
||||
new DefaultSelfLinkProvider(entities, null, lookups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-724
|
||||
public void rejectsNullEntityLookups() {
|
||||
new DefaultSelfLinkProvider(entities, entityLinks, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-724
|
||||
public void usesEntityIdIfNoLookupDefined() {
|
||||
|
||||
Profile profile = new Profile("Name", "Type");
|
||||
@@ -117,10 +105,7 @@ public class DefaultSelfLinkProviderUnitTests {
|
||||
assertThat(link.getHref(), Matchers.endsWith(profile.getId().toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-724
|
||||
@SuppressWarnings("unchecked")
|
||||
public void usesEntityLookupIfDefined() {
|
||||
|
||||
@@ -135,10 +120,7 @@ public class DefaultSelfLinkProviderUnitTests {
|
||||
assertThat(link.getHref(), Matchers.endsWith("foo"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-724
|
||||
public void rejectsLinkCreationForUnknownEntity() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,10 +52,7 @@ public class DomainObjectMergerTests {
|
||||
this.merger = new DomainObjectMerger(new Repositories(context.getBeanFactory()), new DefaultConversionService());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-130
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-130
|
||||
public void mergeNewValue() {
|
||||
|
||||
Person incoming = new Person("Bilbo", "Baggins");
|
||||
@@ -67,10 +64,7 @@ public class DomainObjectMergerTests {
|
||||
assertThat(existingDomainObject.getLastName(), is(incoming.getLastName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-130
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-130
|
||||
public void mergeNullValue() {
|
||||
|
||||
Person incoming = new Person(null, null);
|
||||
@@ -82,10 +76,7 @@ public class DomainObjectMergerTests {
|
||||
assertThat(existingDomainObject.getLastName(), is(incoming.getLastName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void doesNotMergeEmptyCollectionsForReferences() {
|
||||
|
||||
Person bilbo = new Person("Bilbo", "Baggins");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,10 +31,7 @@ import org.junit.Test;
|
||||
*/
|
||||
public class DomainObjectMergerUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void considersEmptyObjectsEmpty() {
|
||||
|
||||
assertThat(isNullOrEmpty(null), is(true));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,26 +76,17 @@ public class UnwrappingRepositoryInvokerFactoryUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-511
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-511
|
||||
public void unwrapsValuesForFindOne() {
|
||||
assertFindOneValueForSource(source, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-511
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-511
|
||||
public void unwrapsValuesForQuery() {
|
||||
assertQueryValueForSource(source, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-724
|
||||
@SuppressWarnings("unchecked")
|
||||
public void usesRegisteredEntityLookup() {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,10 +34,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
*/
|
||||
public class MethodsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-582
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-582
|
||||
public void userMethodsFilterSkipsMethodsIntroducedByProxying() throws Exception {
|
||||
|
||||
ProxyFactory factory = new ProxyFactory();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,10 +81,7 @@ public class HalBrowserIntegrationTests {
|
||||
defaultRequest(get(BASE_PATH).accept(MediaType.TEXT_HTML)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-293
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-293
|
||||
public void exposesJsonUnderApiRootByDefault() throws Exception {
|
||||
|
||||
mvc.perform(get(BASE_PATH).accept(MediaType.ALL)).//
|
||||
@@ -92,10 +89,7 @@ public class HalBrowserIntegrationTests {
|
||||
andExpect(header().string(HttpHeaders.CONTENT_TYPE, startsWith(MediaTypes.HAL_JSON.toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-293
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-293
|
||||
public void redirectsToBrowserForApiRootAndHtml() throws Exception {
|
||||
|
||||
mvc.perform(get(BASE_PATH).accept(MediaType.TEXT_HTML)).//
|
||||
@@ -103,10 +97,7 @@ public class HalBrowserIntegrationTests {
|
||||
andExpect(header().string(HttpHeaders.LOCATION, endsWith(TARGET)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-293
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-293
|
||||
public void forwardsBrowserToIndexHtml() throws Exception {
|
||||
|
||||
mvc.perform(get(BASE_PATH.concat("/browser"))).//
|
||||
@@ -114,10 +105,7 @@ public class HalBrowserIntegrationTests {
|
||||
andExpect(header().string(HttpHeaders.LOCATION, endsWith(TARGET)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-293
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-293
|
||||
public void exposesHalBrowser() throws Exception {
|
||||
|
||||
mvc.perform(get(BASE_PATH.concat("/browser/index.html"))).//
|
||||
@@ -125,10 +113,7 @@ public class HalBrowserIntegrationTests {
|
||||
andExpect(content().string(containsString("The HAL Browser")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-293
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-293
|
||||
public void retrunsApiIfHtmlIsNotExplicitlyListed() throws Exception {
|
||||
|
||||
mvc.perform(get(BASE_PATH).accept(MediaType.APPLICATION_JSON, MediaType.ALL)).//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,11 +38,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
*/
|
||||
public class HalBrowserUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-565
|
||||
* @see DATAREST-720
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-565, DATAREST-720
|
||||
public void createsContextRelativeRedirectForBrowser() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.data.rest.tests;
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,11 +66,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-113
|
||||
* @see DATAREST-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-113, DATAREST-638
|
||||
public void exposesSchemasForResourcesExposed() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request("/");
|
||||
@@ -95,10 +91,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-203
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-203
|
||||
public void servesHalWhenRequested() throws Exception {
|
||||
|
||||
mvc.perform(get("/")). //
|
||||
@@ -106,10 +99,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
andExpect(jsonPath("$._links", notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-203
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-203
|
||||
public void servesHalWhenJsonIsRequested() throws Exception {
|
||||
|
||||
mvc.perform(get("/").accept(MediaType.APPLICATION_JSON)). //
|
||||
@@ -117,10 +107,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
andExpect(jsonPath("$._links", notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-203
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-203
|
||||
public void exposesSearchesForRootResources() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request("/");
|
||||
@@ -166,10 +153,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-198
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-198
|
||||
public void accessLinkedResources() throws Exception {
|
||||
|
||||
MockHttpServletResponse rootResource = client.request("/");
|
||||
@@ -195,10 +179,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-230
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-230
|
||||
public void exposesDescriptionAsAlpsDocuments() throws Exception {
|
||||
|
||||
MediaType ALPS_MEDIA_TYPE = MediaType.valueOf("application/alps+json");
|
||||
@@ -214,20 +195,14 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
andExpect(content().contentTypeCompatibleWith(ALPS_MEDIA_TYPE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-448
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-448
|
||||
public void returnsNotFoundForUriNotBackedByARepository() throws Exception {
|
||||
|
||||
mvc.perform(get("/index.html")).//
|
||||
andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-658
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-658
|
||||
public void collectionResourcesExposeLinksAsHeadersForHeadRequest() throws Exception {
|
||||
|
||||
for (String rel : expectedRootLinkRels()) {
|
||||
@@ -245,10 +220,7 @@ public abstract class CommonWebTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-661
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-661
|
||||
public void patchToNonExistingResourceReturnsNotFound() throws Exception {
|
||||
|
||||
String rel = expectedRootLinkRels().iterator().next();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author Alex Leigh
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,6 @@ import javax.persistence.OneToOne;
|
||||
|
||||
/**
|
||||
* @author Alex Leigh
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @see DATAREST-463
|
||||
*/
|
||||
@Entity
|
||||
public class Item {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @see DATAREST-463
|
||||
*/
|
||||
@CrossOrigin
|
||||
public interface ItemRepository extends CrudRepository<Item, Long> {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
/**
|
||||
* @author Alex Leigh
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
/**
|
||||
* @author Alex Leigh
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author Alex Leigh
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @see DATAREST-463
|
||||
*/
|
||||
@Entity
|
||||
public class User {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,5 @@ import org.springframework.data.repository.CrudRepository;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @see DATAREST-463
|
||||
*/
|
||||
interface UserRepository extends CrudRepository<User, Long> {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,28 +41,19 @@ public class RepositoryControllerIntegrationTests extends AbstractControllerInte
|
||||
|
||||
@Autowired RepositoryController controller;
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void rootResourceExposesGetOnly() {
|
||||
|
||||
HttpEntity<?> response = controller.optionsForRepositories();
|
||||
assertAllowHeaders(response, HttpMethod.GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333, DATAREST-330
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333, DATAREST-330
|
||||
public void headRequestReturnsNoContent() {
|
||||
assertThat(controller.headForRepositories().getStatusCode(), is(HttpStatus.NO_CONTENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160, DATAREST-333, DATAREST-463
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160, DATAREST-333, DATAREST-463
|
||||
public void exposesLinksToRepositories() {
|
||||
|
||||
RepositoryLinksResource resource = controller.listRepositories().getBody();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,10 +66,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
@Autowired PersistentEntityResourceAssembler assembler;
|
||||
@Autowired PersistentEntities entities;
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test(expected = HttpRequestMethodNotSupportedException.class)
|
||||
@Test(expected = HttpRequestMethodNotSupportedException.class) // DATAREST-217
|
||||
public void returnsNotFoundForListingEntitiesIfFindAllNotExported() throws Exception {
|
||||
|
||||
repository.save(new Address());
|
||||
@@ -78,10 +75,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
controller.getCollectionResource(request, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test(expected = HttpRequestMethodNotSupportedException.class)
|
||||
@Test(expected = HttpRequestMethodNotSupportedException.class) // DATAREST-217
|
||||
public void rejectsEntityCreationIfSaveIsNotExported() throws Exception {
|
||||
|
||||
RootResourceInformation request = getResourceInformation(Address.class);
|
||||
@@ -89,10 +83,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
controller.postCollectionResource(request, null, null, MediaType.APPLICATION_JSON_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-301
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-301
|
||||
public void setsExpandedSelfUriInLocationHeader() throws Exception {
|
||||
|
||||
RootResourceInformation information = getResourceInformation(Order.class);
|
||||
@@ -106,28 +97,19 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
assertThat(entity.getHeaders().getLocation().toString(), not(Matchers.endsWith("{?projection}")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-330
|
||||
public void exposesHeadForCollectionResourceIfExported() throws Exception {
|
||||
ResponseEntity<?> entity = controller.headCollectionResource(getResourceInformation(Person.class),
|
||||
new DefaultedPageable(null, false));
|
||||
assertThat(entity.getStatusCode(), is(HttpStatus.NO_CONTENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void doesNotExposeHeadForCollectionResourceIfNotExported() throws Exception {
|
||||
controller.headCollectionResource(getResourceInformation(CreditCard.class), new DefaultedPageable(null, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-330
|
||||
public void exposesHeadForItemResourceIfExported() throws Exception {
|
||||
|
||||
Address address = repository.save(new Address());
|
||||
@@ -138,48 +120,33 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
assertThat(entity.getStatusCode(), is(HttpStatus.NO_CONTENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void doesNotExposeHeadForItemResourceIfNotExisting() throws Exception {
|
||||
controller.headForItemResource(getResourceInformation(CreditCard.class), 1L, assembler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void doesNotExposeMethodsForOptionsIfNotHttpMethodsSupportedForCollectionResource() {
|
||||
|
||||
HttpEntity<?> response = controller.optionsForCollectionResource(getResourceInformation(Address.class));
|
||||
assertAllowHeaders(response, OPTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void exposesSupportedHttpMethodsInAllowHeaderForOptionsRequestToCollectionResource() {
|
||||
|
||||
HttpEntity<?> response = controller.optionsForCollectionResource(getResourceInformation(Person.class));
|
||||
assertAllowHeaders(response, GET, POST, HEAD, OPTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void exposesSupportedHttpMethodsInAllowHeaderForOptionsRequestToItemResource() {
|
||||
|
||||
HttpEntity<?> response = controller.optionsForItemResource(getResourceInformation(Person.class));
|
||||
assertAllowHeaders(response, GET, PUT, PATCH, DELETE, HEAD, OPTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333, DATAREST-348
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333, DATAREST-348
|
||||
public void optionsForItermResourceSetsAllowPatchHeader() {
|
||||
|
||||
ResponseEntity<?> entity = controller.optionsForItemResource(getResourceInformation(Person.class));
|
||||
@@ -194,10 +161,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
MediaType.APPLICATION_JSON_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodyOnPutForUpdateIfAcceptHeaderPresentByDefault() throws Exception {
|
||||
|
||||
RootResourceInformation request = getResourceInformation(Order.class);
|
||||
@@ -210,10 +174,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
MediaType.APPLICATION_JSON_VALUE).hasBody(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodyForCreatingPutIfAcceptHeaderPresentByDefault() throws HttpRequestMethodNotSupportedException {
|
||||
|
||||
RootResourceInformation request = getResourceInformation(Order.class);
|
||||
@@ -224,10 +185,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
MediaType.APPLICATION_JSON_VALUE).hasBody(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void returnsBodyForPostIfAcceptHeaderIsPresentByDefault() throws Exception {
|
||||
|
||||
RootResourceInformation request = getResourceInformation(Order.class);
|
||||
@@ -239,10 +197,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
.hasBody(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-34
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-34
|
||||
public void doesNotReturnBodyForPostIfNoAcceptHeaderPresentByDefault() throws Exception {
|
||||
|
||||
RootResourceInformation request = getResourceInformation(Order.class);
|
||||
@@ -255,10 +210,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-581
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-581
|
||||
public void createsEtagForProjectedEntityCorrectly() throws Exception {
|
||||
|
||||
Address address = repository.save(new Address());
|
||||
@@ -278,10 +230,7 @@ public class RepositoryEntityControllerIntegrationTests extends AbstractControll
|
||||
assertThat(entity.getHeaders().getETag(), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-724
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-724
|
||||
public void deletesEntityWithCustomLookupCorrectly() throws Exception {
|
||||
|
||||
Address address = repository.save(new Address());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -112,66 +112,42 @@ public class RepositorySearchControllerIntegrationTests extends AbstractControll
|
||||
tester.withContentResource(new HasSelfLink(BASE.slash(metadata.getPath()).slash("{id}")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void doesNotExposeHeadForSearchResourceIfResourceDoesnHaveSearches() {
|
||||
controller.headForSearches(getResourceInformation(Author.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void exposesHeadForSearchResourceIfResourceIsNotExposed() {
|
||||
controller.headForSearches(getResourceInformation(CreditCard.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-330
|
||||
public void exposesHeadForSearchResourceIfResourceIsExposed() {
|
||||
controller.headForSearches(getResourceInformation(Person.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-330
|
||||
public void exposesHeadForExistingQueryMethodResource() {
|
||||
controller.headForSearch(getResourceInformation(Person.class), "findByCreatedUsingISO8601Date");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void doesNotExposeHeadForInvalidQueryMethodResource() {
|
||||
controller.headForSearch(getResourceInformation(Person.class), "foobar");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void searchResourceSupportsGetOnly() {
|
||||
assertAllowHeaders(controller.optionsForSearches(getResourceInformation(Person.class)), HttpMethod.GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-333
|
||||
public void returns404ForOptionsForRepositoryWithoutSearches() {
|
||||
controller.optionsForSearches(getResourceInformation(Address.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-333
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-333
|
||||
public void queryMethodResourceSupportsGetOnly() {
|
||||
|
||||
RootResourceInformation resourceInformation = getResourceInformation(Person.class);
|
||||
@@ -180,10 +156,7 @@ public class RepositorySearchControllerIntegrationTests extends AbstractControll
|
||||
assertAllowHeaders(response, HttpMethod.GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-502
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-502
|
||||
public void interpretsUriAsReferenceToRelatedEntity() {
|
||||
|
||||
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<String, Object>(1);
|
||||
@@ -197,10 +170,7 @@ public class RepositorySearchControllerIntegrationTests extends AbstractControll
|
||||
assertThat(result.getBody(), is(instanceOf(Resources.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-515
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-515
|
||||
public void repositorySearchResourceExposesDomainType() {
|
||||
|
||||
RepositorySearchesResource searches = controller.listSearches(getResourceInformation(Person.class));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,20 +40,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Transactional
|
||||
public class RootResourceInformationIntegrationTests extends AbstractControllerIntegrationTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217
|
||||
public void getIsNotSupportedIfFindAllIsNotExported() {
|
||||
|
||||
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
|
||||
assertThat(supportedMethods.getMethodsFor(COLLECTION), not(hasItem(GET)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217
|
||||
public void postIsNotSupportedIfSaveIsNotExported() {
|
||||
|
||||
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,10 +91,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
configuration.setEnableEnumTranslation(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-230
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-230
|
||||
public void exposesAlpsCollectionResources() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -105,10 +102,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
.andExpect(jsonPath("$.alps.descriptors[*].name", hasItems("people", "person")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-638
|
||||
public void verifyThatAlpsIsDefaultProfileFormat() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -120,10 +114,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-463
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-463
|
||||
public void verifyThatAttributesIgnoredDontAppearInAlps() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -138,10 +129,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
.andExpect(jsonPath("$.alps.descriptors[*].descriptors[*].name", not(hasItems("manager", "curator"))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-494
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-494
|
||||
public void linksToJsonSchemaFromRepresentationDescriptor() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -156,10 +144,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
assertThat(href, endsWith("/profile/items"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-516
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-516
|
||||
public void referenceToAssociatedEntityDesciptorPointsToRepresentationDescriptor() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -176,10 +161,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
assertThat(rt, allOf(containsString(ProfileController.PROFILE_ROOT_MAPPING), endsWith("-representation")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-630
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-630
|
||||
public void onlyExposesIdAttributesWhenExposedInTheConfiguration() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
@@ -190,10 +172,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
.andExpect(jsonPath("$.alps.descriptors[*].descriptors[*].name", hasItems("id", "name")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-683
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-683
|
||||
public void enumValueListingsAreTranslatedIfEnabled() throws Exception {
|
||||
|
||||
configuration.setEnableEnumTranslation(true);
|
||||
@@ -211,10 +190,7 @@ public class AlpsControllerIntegrationTests extends AbstractControllerIntegratio
|
||||
assertThat(value, is("Male, Female, Undefined"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-753
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-753
|
||||
public void alpsCanHandleGroovyDomainObjects() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique("profile");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,10 +64,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesSelectiveDefaultCorsConfiguration() throws Exception {
|
||||
|
||||
Link findItems = client.discoverUnique("items");
|
||||
@@ -81,10 +78,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS,TRACE"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesGlobalCorsConfiguration() throws Exception {
|
||||
|
||||
Link findBooks = client.discoverUnique("books");
|
||||
@@ -103,10 +97,9 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
* @see BooksXmlController
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesCorsConfigurationOnCustomControllers() throws Exception {
|
||||
|
||||
// Preflight request
|
||||
@@ -128,10 +121,9 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
* @see BooksPdfController
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesCorsConfigurationOnCustomControllerMethod() throws Exception {
|
||||
|
||||
// Preflight request
|
||||
@@ -144,10 +136,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, containsString("GET,PUT,POST")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesCorsConfigurationOnRepository() throws Exception {
|
||||
|
||||
Link authorsLink = client.discoverUnique("authors");
|
||||
@@ -162,10 +151,7 @@ public class CorsIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,PATCH"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void appliesCorsConfigurationOnRepositoryToCustomControllers() throws Exception {
|
||||
|
||||
// Preflight request
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,10 +77,7 @@ public class DataRest262Tests {
|
||||
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void deserializesNestedAssociation() throws Exception {
|
||||
|
||||
Airport airport = repository.save(new Airport());
|
||||
@@ -90,10 +87,7 @@ public class DataRest262Tests {
|
||||
assertThat(result.orgOrDstFlightPart.airport.id, is(airport.id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
@Ignore
|
||||
public void serializesLinksToNestedAssociations() throws Exception {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -87,10 +87,7 @@ public class DataRest363Tests {
|
||||
this.frodo = personRepository.save(new Person("Frodo", "Baggins"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-363
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-363
|
||||
public void testBasics() throws Exception {
|
||||
|
||||
ResultActions frodoActions = testMvcClient.follow("/people/".concat(frodo.getId().toString()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -90,10 +90,7 @@ public class JpaDefaultPageableWebTests extends AbstractWebIntegrationTests {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void executesSearchThatTakesAMappedSortProperty() throws Exception {
|
||||
|
||||
Link findBySortedLink = client.discoverUnique("books", "search", "find-spring-books-sorted");
|
||||
@@ -112,10 +109,7 @@ public class JpaDefaultPageableWebTests extends AbstractWebIntegrationTests {
|
||||
andExpect(jsonPath("$._embedded.books[1].title").doesNotExist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void shouldApplyDefaultPageable() throws Exception {
|
||||
|
||||
mvc.perform(get("/books/default-pageable"))//
|
||||
@@ -123,10 +117,7 @@ public class JpaDefaultPageableWebTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(jsonPath("$.size").value(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void shouldOverrideDefaultPageable() throws Exception {
|
||||
|
||||
mvc.perform(get("/books/default-pageable?size=10"))//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -115,10 +115,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-99
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-99
|
||||
public void doesNotExposeCreditCardRepository() throws Exception {
|
||||
|
||||
mvc.perform(get("/")). //
|
||||
@@ -143,10 +140,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertDoesNotHaveLinkWithRel(Link.REL_NEXT, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-169
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-169
|
||||
public void exposesLinkForRelatedResource() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request("/");
|
||||
@@ -158,10 +152,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(client.request(creatorLink), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-200
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-200
|
||||
public void exposesInlinedEntities() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request("/");
|
||||
@@ -171,10 +162,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertHasJsonPathValue("$..lineItems", orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-199
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-199
|
||||
public void createsOrderUsingPut() throws Exception {
|
||||
|
||||
mvc.perform(//
|
||||
@@ -183,10 +171,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
).andExpect(status().isCreated());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-117
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-117
|
||||
public void createPersonThenVerifyIgnoredAttributesDontExist() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -206,10 +191,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertJsonPathDoesntExist("$.weight", response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-95
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-95
|
||||
public void createThenPatch() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -233,10 +215,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat((String) JsonPath.read(frodo.getContentAsString(), "$.lastName"), is("Baggins"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-150
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-150
|
||||
public void createThenPut() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -268,10 +247,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertPersonWithNameAndSiblingLink("Billy Bob");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-219
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-219
|
||||
public void manipulatePropertyCollectionRestfullyWithMultiplePosts() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -288,10 +264,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertSiblingNames(frodosSiblingLink, "Bilbo", "Merry", "Pippin");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-219
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-219
|
||||
public void manipulatePropertyCollectionRestfullyWithSinglePost() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -306,10 +279,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertSiblingNames(frodosSiblingLink, "Bilbo", "Merry", "Pippin");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-219
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-219
|
||||
public void manipulatePropertyCollectionRestfullyWithMultiplePuts() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -328,10 +298,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertSiblingNames(frodosSiblingsLink, "Merry", "Pippin");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-219
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-219
|
||||
public void manipulatePropertyCollectionRestfullyWithSinglePut() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -351,10 +318,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertSiblingNames(frodoSiblingLink, "Merry", "Pippin");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-219
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-219
|
||||
public void manipulatePropertyCollectionRestfullyWithDelete() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -374,10 +338,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertSiblingNames(frodosSiblingsLink, "Bilbo", "Merry");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-50
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-50
|
||||
public void propertiesCanHaveNulls() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -394,10 +355,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertNull(JsonPath.read(responseBody, "$.lastName"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-238
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-238
|
||||
public void putShouldWorkDespiteExistingLinks() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -419,10 +377,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertJsonPathEquals("$.firstName", "Bilbo", overwrittenResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217
|
||||
public void doesNotAllowGetToCollectionResourceIfFindAllIsNotExported() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("addresses");
|
||||
@@ -431,10 +386,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(status().isMethodNotAllowed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-217
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-217
|
||||
public void doesNotAllowPostToCollectionResourceIfSaveIsNotExported() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("addresses");
|
||||
@@ -447,9 +399,8 @@ public class JpaWebTests extends CommonWebTests {
|
||||
* Checks, that the server only returns the properties contained in the projection requested.
|
||||
*
|
||||
* @see OrderSummary
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void returnsProjectionIfRequested() throws Exception {
|
||||
|
||||
Link orders = client.discoverUnique("orders");
|
||||
@@ -468,18 +419,12 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertJsonPathDoesntExist("$.lineItems", response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-261
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-261
|
||||
public void relProviderDetectsCustomizedMapping() {
|
||||
assertThat(relProvider.getCollectionResourceRelFor(Person.class), is("people"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-311
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-311
|
||||
public void onlyLinksShouldAppearWhenExecuteSearchCompact() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique("people");
|
||||
@@ -505,10 +450,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(JsonPath.<JSONArray> read(responseBody, "$.content"), hasSize(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-317
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-317
|
||||
public void rendersExcerptProjectionsCorrectly() throws Exception {
|
||||
|
||||
Link authorsLink = client.discoverUnique("authors");
|
||||
@@ -531,10 +473,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
client.follow(new Link(href)).andExpect(client.hasLinkWithRel("books"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-353
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-353
|
||||
public void returns404WhenTryingToDeleteANonExistingResource() throws Exception {
|
||||
|
||||
Link receiptsLink = client.discoverUnique("receipts");
|
||||
@@ -543,10 +482,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-384
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-384
|
||||
public void exectuesSearchThatTakesASort() throws Exception {
|
||||
|
||||
Link booksLink = client.discoverUnique("books");
|
||||
@@ -569,10 +505,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(client.hasLinkWithRel("self"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void returnConflictWhenConcurrentlyEditingVersionedEntity() throws Exception {
|
||||
|
||||
Link receiptLink = client.discoverUnique("receipts");
|
||||
@@ -599,10 +532,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
.andExpect(status().isPreconditionFailed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-423
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-423
|
||||
public void invokesCustomControllerAndBindsDomainObjectCorrectly() throws Exception {
|
||||
|
||||
MockHttpServletResponse authorsResponse = client.request(client.discoverUnique("authors"));
|
||||
@@ -613,10 +543,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(status().isIAmATeapot());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-523
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-523
|
||||
public void augmentsCollectionAssociationUsingPost() throws Exception {
|
||||
|
||||
List<Link> links = preparePersonResources(new Person("Frodo", "Baggins"), //
|
||||
@@ -637,10 +564,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-658
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-658
|
||||
public void returnsLinkHeadersForHeadRequestToItemResource() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request(client.discoverUnique("people"));
|
||||
@@ -655,10 +579,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(links.hasLink("person"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void exectuesSearchThatTakesAMappedSortProperty() throws Exception {
|
||||
|
||||
Link findBySortedLink = client.discoverUnique("books", "search", "find-by-sorted");
|
||||
@@ -679,10 +600,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(client.hasLinkWithRel("self"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void exectuesCustomQuerySearchThatTakesAMappedSortProperty() throws Exception {
|
||||
|
||||
Link findByLink = client.discoverUnique("books", "search", "find-spring-books-sorted");
|
||||
@@ -702,10 +620,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(client.hasLinkWithRel("self"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void callUnmappedCustomRepositoryController() throws Exception {
|
||||
|
||||
mvc.perform(post("/orders/search/sort")).andExpect(status().isOk());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,11 +73,7 @@ public class ProfileIntegrationTests extends AbstractControllerIntegrationTests
|
||||
this.client = new TestMvcClient(mvc, this.discoverers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-230
|
||||
* @see DATAREST-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-230, DATAREST-638
|
||||
public void exposesProfileLink() throws Exception {
|
||||
|
||||
client.follow(ROOT_URI)//
|
||||
@@ -85,11 +81,7 @@ public class ProfileIntegrationTests extends AbstractControllerIntegrationTests
|
||||
.andExpect(jsonPath("$._links.profile.href", endsWith(ProfileController.PROFILE_ROOT_MAPPING)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-230
|
||||
* @see DATAREST-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-230, DATAREST-638
|
||||
public void profileRootLinkContainsMetadataForEachRepo() throws Exception {
|
||||
|
||||
Link profileLink = client.discoverUnique(new Link(ROOT_URI), ProfileResourceProcessor.PROFILE_REL);
|
||||
@@ -104,10 +96,7 @@ public class ProfileIntegrationTests extends AbstractControllerIntegrationTests
|
||||
assertThat(client.discoverUnique(profileLink, "addresses", MediaType.ALL), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-638
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-638
|
||||
public void profileLinkOnCollectionResourceLeadsToRepositorySpecificMetadata() throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique(new Link(ROOT_URI), "people");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,6 @@ import javax.persistence.Id;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @see DATAREST-754
|
||||
*/
|
||||
@Entity
|
||||
public class SimulatedGroovyDomainClass implements GroovyObject {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,5 @@ import org.springframework.data.rest.webmvc.jpa.groovy.SimulatedGroovyDomainClas
|
||||
* Simulates a repository built on a Groovy domain object.
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @see DATAREST-754
|
||||
*/
|
||||
public interface SimulatedGroovyDomainClassRepository extends CrudRepository<SimulatedGroovyDomainClass, Long> {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,10 +69,7 @@ public class Jackson2DatatypeHelperIntegrationTests {
|
||||
em.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-500
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-500
|
||||
public void configuresHIbernate4ModuleToLoadLazyLoadingProxies() throws Exception {
|
||||
|
||||
PersistentEntity<?, ?> entity = entities.getPersistentEntity(Order.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -126,10 +126,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(p.getSiblings(), is(Collections.EMPTY_LIST));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-238
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-238
|
||||
public void deserializePersonWithLinks() throws IOException {
|
||||
|
||||
String bilbo = "{\n" + " \"_links\" : {\n" + " \"self\" : {\n"
|
||||
@@ -144,10 +141,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(p.getLastName(), equalTo("Baggins"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-238
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-238
|
||||
public void serializesPersonEntity() throws IOException, InterruptedException {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = repositories.getPersistentEntity(Person.class);
|
||||
@@ -168,10 +162,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(siblingLink.getHref(), endsWith(new UriTemplate("/{id}/siblings").expand(person.getId()).toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-248
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-248
|
||||
public void deserializesPersonWithLinkToOtherPersonCorrectly() throws Exception {
|
||||
|
||||
Person father = people.save(new Person("John", "Doe"));
|
||||
@@ -182,10 +173,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(result.getFather(), is(father));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-248
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-248
|
||||
public void deserializesPersonWithLinkToOtherPersonsCorrectly() throws Exception {
|
||||
|
||||
Person firstSibling = people.save(new Person("John", "Doe"));
|
||||
@@ -198,10 +186,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(result.getSiblings(), hasItems(firstSibling, secondSibling));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-248
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-248
|
||||
public void deserializesEmbeddedAssociationsCorrectly() throws Exception {
|
||||
|
||||
String content = TestUtils.readFileFromClasspath("order.json");
|
||||
@@ -210,10 +195,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(order.getLineItems(), hasSize(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-250
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-250
|
||||
public void serializesReferencesWithinPagedResourceCorrectly() throws Exception {
|
||||
|
||||
Person creator = new Person("Dave", "Matthews");
|
||||
@@ -235,10 +217,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(result, "$._embedded.orders[*].lineItems"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-521
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-521
|
||||
public void serializesLinksForExcerpts() throws Exception {
|
||||
|
||||
Person dave = new Person("Dave", "Matthews");
|
||||
@@ -261,10 +240,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(result, "$._embedded.father[*]._links.self"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-521
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-521
|
||||
public void rendersAdditionalLinksRegisteredWithResource() throws Exception {
|
||||
|
||||
Person dave = new Person("Dave", "Matthews");
|
||||
@@ -280,10 +256,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(result, "$._links.processed"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-697
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-697
|
||||
public void rendersProjectionWithinSimpleResourceCorrectly() throws Exception {
|
||||
|
||||
Person person = new Person("Dave", "Matthews");
|
||||
@@ -297,10 +270,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(result, "$._links.self"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-880
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-880
|
||||
public void unwrapsNestedTypeCorrectly() throws Exception {
|
||||
|
||||
CreditCard creditCard = new CreditCard(new CreditCard.CCN("1234123412341234"));
|
||||
@@ -308,10 +278,7 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(mapper.writeValueAsString(creditCard), "$.ccn"), is("1234123412341234"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-872
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-872
|
||||
public void serializesInheritance() throws Exception {
|
||||
|
||||
Suite suite = new Suite();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,10 +44,7 @@ public class BackendIdConverterHandlerMethodArgumentResolverIntegrationTests
|
||||
|
||||
@Autowired BackendIdHandlerMethodArgumentResolver resolver;
|
||||
|
||||
/**
|
||||
* @see DATAREST-155
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-155
|
||||
public void translatesUriToBackendId() throws Exception {
|
||||
|
||||
Method method = ReflectionUtils.findMethod(SampleController.class, "resolveId", Serializable.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,10 +64,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(link.getRel(), is("people"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void returnsLinkWithProjectionTemplateVariableIfProjectionIsDefined() {
|
||||
|
||||
Link link = entityLinks.linkToSingleResource(Order.class, 1);
|
||||
@@ -76,20 +73,14 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(link.getVariableNames(), hasItem(configuration.getProjectionConfiguration().getParameterName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-155
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-155
|
||||
public void usesCustomGeneratedBackendId() {
|
||||
|
||||
Link link = entityLinks.linkToSingleResource(Book.class, 7L);
|
||||
assertThat(link.expand().getHref(), endsWith("/7-7-7-7-7-7-7"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-317
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-317
|
||||
public void adaptsToExistingPageable() {
|
||||
|
||||
Link link = entityLinks.linkToPagedResource(Person.class, new PageRequest(0, 10));
|
||||
@@ -99,10 +90,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(link.getVariableNames(), hasItems("sort", "projection"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void returnsLinksToSearchResources() {
|
||||
|
||||
Links links = entityLinks.linksToSearchResources(Person.class);
|
||||
@@ -114,10 +102,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(firstnameLink.getVariableNames(), hasItems("page", "size"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void returnsLinkToSearchResource() {
|
||||
|
||||
Link link = entityLinks.linkToSearchResource(Person.class, "firstname");
|
||||
@@ -127,11 +112,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(link.getVariableNames(), hasItems("firstname", "page", "size"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
* @see DATAREST-519
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467, DATAREST-519
|
||||
public void prepopulatesPaginationInformationForSearchResourceLink() {
|
||||
|
||||
Link link = entityLinks.linkToSearchResource(Person.class, "firstname", new PageRequest(0, 10));
|
||||
@@ -145,10 +126,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(components.getQueryParams(), allOf(hasKey("page"), hasKey("size")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void returnsTemplatedLinkForSortedSearchResource() {
|
||||
|
||||
Link link = entityLinks.linkToSearchResource(Person.class, "lastname");
|
||||
@@ -157,11 +135,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(link.getVariableNames(), hasItems("lastname", "sort"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
* @see DATAREST-519
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467, DATAREST-519
|
||||
public void prepopulatesSortInformationForSearchResourceLink() {
|
||||
|
||||
Link link = entityLinks.linkToSearchResource(Person.class, "lastname", new Sort("firstname"));
|
||||
@@ -175,12 +149,7 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt
|
||||
assertThat(components.getQueryParams(), hasKey("sort"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-668
|
||||
* @see DATAREST-519
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-668, DATAREST-519, DATAREST-467
|
||||
public void addsProjectVariableToSearchResourceIfAvailable() {
|
||||
|
||||
for (Link link : entityLinks.linksToSearchResources(Book.class)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,13 +29,9 @@ public interface ProfileRepository extends PagingAndSortingRepository<Profile, S
|
||||
|
||||
List<Profile> findByType(String type);
|
||||
|
||||
/**
|
||||
* @see DATAREST-247
|
||||
*/
|
||||
// DATAREST-247
|
||||
long countByType(@Param("type") String type);
|
||||
|
||||
/**
|
||||
* @see DATAREST-511
|
||||
*/
|
||||
// DATAREST-511
|
||||
Optional<Profile> findById(@Param("id") String id);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,6 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
* @see DATAREST-754
|
||||
*/
|
||||
@Document
|
||||
public class SimulatedGroovyDomainClass implements GroovyObject {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,5 @@ import org.springframework.data.repository.CrudRepository;
|
||||
* Simulates a repository built on a Groovy domain object.
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @see DATAREST-754
|
||||
*/
|
||||
public interface SimulatedGroovyDomainClassRepository extends CrudRepository<SimulatedGroovyDomainClass, String> {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -126,10 +126,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(jsonPath("$.address.zipCode").value(is(notNullValue())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-247
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-247
|
||||
public void executeQueryMethodWithPrimitiveReturnType() throws Exception {
|
||||
|
||||
Link profiles = client.discoverUnique("profiles");
|
||||
@@ -172,10 +169,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
assertThat(JsonPath.read(response.getContentAsString(), "$.address.zipCode"), is((Object) "ZIP"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void returnConflictWhenConcurrentlyEditingVersionedEntity() throws Exception {
|
||||
|
||||
Link receiptLink = client.discoverUnique("receipts");
|
||||
@@ -202,10 +196,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
.andExpect(status().isPreconditionFailed());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-471
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-471
|
||||
public void auditableResourceHasLastModifiedHeaderSet() throws Exception {
|
||||
|
||||
Profile profile = repository.findAll().iterator().next();
|
||||
@@ -216,10 +207,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
assertThat(header, not(isEmptyOrNullString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-482
|
||||
public void putDoesNotRemoveAssociations() throws Exception {
|
||||
|
||||
Link usersLink = client.discoverUnique("users");
|
||||
@@ -242,10 +230,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(jsonPath("$.embedded.users[0].address").doesNotExist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-482
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-482
|
||||
public void emptiesAssociationForEmptyUriList() throws Exception {
|
||||
|
||||
Link usersLink = client.discoverUnique("users");
|
||||
@@ -259,10 +244,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(jsonPath("$").exists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-491
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-491
|
||||
public void updatesMapPropertyCorrectly() throws Exception {
|
||||
|
||||
Link profilesLink = client.discoverUnique("profiles");
|
||||
@@ -276,10 +258,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
client.follow(profileLink).andExpect(jsonPath("$.metadata.Key").value("Value"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-506
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-506
|
||||
public void supportsConditionalGetsOnItemResource() throws Exception {
|
||||
|
||||
Receipt receipt = new Receipt();
|
||||
@@ -302,10 +281,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(header().string(ETAG, is(notNullValue())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-511
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-511
|
||||
public void invokesQueryResourceReturningAnOptional() throws Exception {
|
||||
|
||||
Profile profile = repository.findAll().iterator().next();
|
||||
@@ -316,10 +292,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(status().isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-517
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-517
|
||||
public void returnsNotFoundIfQueryExecutionDoesNotReturnResult() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("profiles", "search", "findById");
|
||||
@@ -328,10 +301,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-712
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-712
|
||||
public void invokesQueryMethodTakingAReferenceCorrectly() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("users", "search", "findByColleaguesContains");
|
||||
@@ -344,10 +314,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
mvc.perform(get(href)).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-835
|
||||
public void exposesETagHeaderForSearchResourceYieldingItemResource() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("profiles", "search", "findById");
|
||||
@@ -359,10 +326,7 @@ public class MongoWebTests extends CommonWebTests {
|
||||
.andExpect(header().string("Last-Modified", is(notNullValue())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-835
|
||||
public void doesNotAddETagHeaderForCollectionQueryResource() throws Exception {
|
||||
|
||||
Link link = client.discoverUnique("profiles", "search", "findByType");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,10 +57,7 @@ public class PersistentEntityResourceAssemblerIntegrationTests extends AbstractC
|
||||
@Autowired @Qualifier("objectMapper") ObjectMapper objectMapper;
|
||||
@Autowired Associations associations;
|
||||
|
||||
/**
|
||||
* @see DATAREST-609
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-609
|
||||
public void addsSelfAndSingleResourceLinkToResourceByDefault() throws Exception {
|
||||
|
||||
Projector projector = mock(Projector.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,10 +39,7 @@ public class RepositoryRestHandlerMappingIntegrationTests extends AbstractContro
|
||||
|
||||
@Autowired DelegatingHandlerMapping mapping;
|
||||
|
||||
/**
|
||||
* @see DATAREST-617
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-617
|
||||
public void usesMethodsWithoutProducesClauseForGeneralJsonRequests() throws Exception {
|
||||
|
||||
MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", "/users");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,10 +79,7 @@ public class JsonPatchHandlerUnitTests {
|
||||
this.user.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-348
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-348
|
||||
public void appliesRemoveOperationCorrectly() throws Exception {
|
||||
|
||||
String input = "[{ \"op\": \"replace\", \"path\": \"/address/zipCode\", \"value\": \"ZIP\" },"
|
||||
@@ -94,10 +91,7 @@ public class JsonPatchHandlerUnitTests {
|
||||
assertThat(result.address.zipCode, is("ZIP"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-348
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-348
|
||||
public void appliesMergePatchCorrectly() throws Exception {
|
||||
|
||||
String input = "{ \"address\" : { \"zipCode\" : \"ZIP\"}, \"lastname\" : null }";
|
||||
@@ -130,10 +124,7 @@ public class JsonPatchHandlerUnitTests {
|
||||
assertThat(user.colleagues.get(0).firstname, is(christoph.firstname));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-609
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-609
|
||||
public void hintsToMediaTypeIfBodyCantBeRead() throws Exception {
|
||||
|
||||
exception.expect(HttpMessageNotReadableException.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,10 +48,7 @@ public class LegacyRepresentationConfigIntegrationTests extends AbstractReposito
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-213, DATAREST-617
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-213, DATAREST-617
|
||||
public void returnsJsonIfConfiguredAndRequested() throws Exception {
|
||||
|
||||
for (String resource : Arrays.asList("/", "/users")) {
|
||||
@@ -61,10 +58,7 @@ public class LegacyRepresentationConfigIntegrationTests extends AbstractReposito
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-213, DATAREST-617
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-213, DATAREST-617
|
||||
public void returnsJsonIfConfigured() throws Exception {
|
||||
|
||||
for (String resource : Arrays.asList("/", "/users")) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -80,10 +80,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
|
||||
when(parameter.hasParameterAnnotation(QuerydslPredicate.class)).thenReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-616
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-616
|
||||
public void returnsInvokerIfRepositoryIsNotQuerydslAware() {
|
||||
|
||||
ReceiptRepository repository = mock(ReceiptRepository.class);
|
||||
@@ -94,10 +91,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
|
||||
assertThat(result, is(invoker));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-616
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-616
|
||||
public void wrapsInvokerInQuerydslAdapter() {
|
||||
|
||||
Object repository = mock(QuerydslUserRepository.class);
|
||||
@@ -108,10 +102,7 @@ public class QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUn
|
||||
assertThat(result, is(instanceOf(QuerydslRepositoryInvokerAdapter.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-616
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-616
|
||||
public void invokesCustomizationOnRepositoryIfItImplementsCustomizer() {
|
||||
|
||||
QuerydslCustomizingUserRepository repository = mock(QuerydslCustomizingUserRepository.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -96,10 +96,7 @@ public class PersistentEntitySerializationTests {
|
||||
this.projectionFactory = new SpelAwareProxyProjectionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-250
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-250
|
||||
public void serializesEmbeddedReferencesCorrectly() throws Exception {
|
||||
|
||||
User user = new User();
|
||||
@@ -119,18 +116,12 @@ public class PersistentEntitySerializationTests {
|
||||
assertThat(JsonPath.read(result, "$._embedded.users[*].address"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void deserializesTranslatedEnumProperty() throws Exception {
|
||||
assertThat(mapper.readValue("{ \"gender\" : \"Male\" }", User.class).gender, is(Gender.MALE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-864
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-864
|
||||
public void createsNestedResourceForMap() throws Exception {
|
||||
|
||||
User dave = users.save(new User());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -95,10 +95,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
customizerFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-631, DATAREST-632
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-631, DATAREST-632
|
||||
public void fulfillsConstraintsForProfile() {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
@@ -111,10 +108,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
assertConstraints(Profile.class, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-632
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-632
|
||||
public void fulfillsConstraintsForUser() throws Exception {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
@@ -166,10 +160,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
|
||||
assertConstraints(User.class, constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-754
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-754
|
||||
public void handlesGroovyDomainObjects() {
|
||||
|
||||
List<Constraint> constraints = new ArrayList<Constraint>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,10 +39,7 @@ public class RepositoryLinkBuildUnitTests {
|
||||
|
||||
MongoMappingContext context = new MongoMappingContext();
|
||||
|
||||
/**
|
||||
* @see DATAREST-292
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-292
|
||||
public void usesCurrentRequestsUriBaseForRelativeBaseUri() {
|
||||
|
||||
TestMvcClient.initWebTest();
|
||||
@@ -50,10 +47,7 @@ public class RepositoryLinkBuildUnitTests {
|
||||
assertRootUriFor("api", "http://localhost/api/profile");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-292, DATAREST-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-292, DATAREST-296
|
||||
public void usesBaseUriOnlyIfItIsAbsolute() {
|
||||
assertRootUriFor("http://foobar/api", "http://foobar/api/profile");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -95,10 +95,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deletePersonAccessDeniedForNoCredentials() throws Exception {
|
||||
|
||||
// Getting the collection is not tested here. This is to get the URI that will later be tested for DELETE
|
||||
@@ -117,10 +114,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
mvc.perform(delete(href)).andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deletePersonAccessDeniedForUsers() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = mvc
|
||||
@@ -137,10 +131,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
andExpect(status().isForbidden());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deletePersonAccessGrantedForAdmins() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = mvc
|
||||
@@ -157,20 +148,14 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(status().is(HttpStatus.NO_CONTENT.value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllPeopleAccessDeniedForNoCredentials() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("people").expand().getHref())).//
|
||||
andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllPeopleAccessGrantedForUsers() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("people").expand().getHref()).//
|
||||
@@ -178,10 +163,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
andExpect(status().isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllPeopleAccessGrantedForAdmins() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("people").expand().getHref()).//
|
||||
@@ -189,10 +171,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
andExpect(status().isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deleteOrderAccessDeniedForNoCredentials() throws Exception {
|
||||
|
||||
// Getting the collection is not tested here. This is to get the URI that will later be tested for DELETE
|
||||
@@ -209,10 +188,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
mvc.perform(delete(href)).andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deleteOrderAccessDeniedForUsers() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = mvc
|
||||
@@ -226,10 +202,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
andExpect(status().isForbidden());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void deleteOrderAccessGrantedForAdmins() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = mvc
|
||||
@@ -246,20 +219,14 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(status().is(HttpStatus.NO_CONTENT.value()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllOrdersAccessDeniedForNoCredentials() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("orders").expand().getHref())).//
|
||||
andExpect(status().isUnauthorized());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllOrdersAccessGrantedForUsers() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("orders").expand().getHref()).//
|
||||
@@ -267,10 +234,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
|
||||
andExpect(status().isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-327
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-327
|
||||
public void findAllOrdersAccessGrantedForAdmins() throws Throwable {
|
||||
|
||||
mvc.perform(get(client.discoverUnique("orders").expand().getHref()).//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,10 +62,7 @@ public class ShopIntegrationTests extends AbstractWebIntegrationTests {
|
||||
expectRelatedResource("customer", actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void renderProductNameOnlyProjection() throws Exception {
|
||||
|
||||
Map<String, Object> arguments = Collections.singletonMap("projection", "nameOnly");
|
||||
@@ -76,10 +73,7 @@ public class ShopIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(jsonPath("$._embedded.products[0].price").doesNotExist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void renderProductNameOnlyProjectionResourceProcessor() throws Exception {
|
||||
|
||||
Map<String, Object> arguments = Collections.singletonMap("projection", "nameOnly");
|
||||
@@ -89,10 +83,7 @@ public class ShopIntegrationTests extends AbstractWebIntegrationTests {
|
||||
.andExpect(jsonPath("$._embedded.products[0]._links.beta").exists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void renderOrderItemsOnlyProjectionResourceProcessor() throws Exception {
|
||||
|
||||
Map<String, Object> arguments = Collections.singletonMap("projection", "itemsOnly");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,10 +77,7 @@ public class SolrWebTests extends CommonWebTests {
|
||||
repo.deleteAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-387
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-387
|
||||
public void allowsPaginationThroughData() throws Exception {
|
||||
|
||||
MockHttpServletResponse response = client.request("/products?page=0&size=1");
|
||||
@@ -97,18 +94,12 @@ public class SolrWebTests extends CommonWebTests {
|
||||
assertDoesNotHaveLinkWithRel(Link.REL_NEXT, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-387
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-387
|
||||
public void allowsRetrievingDataById() throws Exception {
|
||||
requestAndCompare(PLAYSTATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-387
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-387
|
||||
public void createsEntitesCorrectly() throws Exception {
|
||||
|
||||
Product product = new Product("4", "iWatch", "trends", "scary");
|
||||
@@ -120,10 +111,7 @@ public class SolrWebTests extends CommonWebTests {
|
||||
assertJsonDocumentMatches(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-387
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-387
|
||||
public void deletesEntitiesCorrectly() throws Exception {
|
||||
deleteAndVerify(new Link("/products/1"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -584,9 +584,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
* The {@link HandlerMapping} to delegate requests to Spring Data REST controllers. Sets up a
|
||||
* {@link DelegatingHandlerMapping} to make sure manually implemented {@link BasePathAwareController} instances that
|
||||
* register custom handlers for certain media types don't cause the {@link RepositoryRestHandlerMapping} to be
|
||||
* omitted.
|
||||
*
|
||||
* @see DATAREST-490
|
||||
* omitted. See DATAREST-490.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,10 +68,7 @@ public class AssociationLinksUnitTests {
|
||||
this.links = new Associations(mappings, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-262
|
||||
public void rejectsNullMappings() {
|
||||
new Associations(null, mock(RepositoryRestConfiguration.class));
|
||||
}
|
||||
@@ -81,36 +78,24 @@ public class AssociationLinksUnitTests {
|
||||
new Associations(mappings, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void considersNullPropertyUnlinkable() {
|
||||
assertThat(links.isLinkableAssociation((PersistentProperty<?>) null), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void consideredHiddenPropertyUnlinkable() {
|
||||
assertThat(links.isLinkableAssociation(entity.getPersistentProperty("hiddenProperty")), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void considersUnexportedPropertyUnlinkable() {
|
||||
|
||||
KeyValuePersistentProperty property = entity.getPersistentProperty("unexportedProperty");
|
||||
assertThat(links.isLinkableAssociation(property), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void createsLinkToAssociationProperty() {
|
||||
|
||||
PersistentProperty<?> property = entity.getPersistentProperty("property");
|
||||
@@ -120,10 +105,7 @@ public class AssociationLinksUnitTests {
|
||||
assertThat(associationLinks, hasItem(new Link("/base/property", "property")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-262
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-262
|
||||
public void doesNotCreateLinksForHiddenProperty() {
|
||||
|
||||
PersistentProperty<?> property = entity.getPersistentProperty("hiddenProperty");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,20 +29,14 @@ import org.junit.Test;
|
||||
*/
|
||||
public class BaseUriUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void doesNotMatchNonOverlap() {
|
||||
|
||||
assertThat(new BaseUri(URI.create("foo")).getRepositoryLookupPath("/bar"), is(nullValue()));
|
||||
assertThat(new BaseUri(URI.create("http://localhost:8080/foo/")).getRepositoryLookupPath("/bar"), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void matchesSimpleBaseUri() {
|
||||
|
||||
BaseUri uri = new BaseUri(URI.create("foo"));
|
||||
@@ -50,10 +44,7 @@ public class BaseUriUnitTests {
|
||||
assertThat(uri.getRepositoryLookupPath("/foo"), isEmptyString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void ignoresTrailingSlash() {
|
||||
|
||||
BaseUri uri = new BaseUri(URI.create("foo/"));
|
||||
@@ -62,10 +53,7 @@ public class BaseUriUnitTests {
|
||||
assertThat(uri.getRepositoryLookupPath("/foo/"), isEmptyString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void ignoresLeadingSlash() {
|
||||
|
||||
BaseUri uri = new BaseUri(URI.create("/foo"));
|
||||
@@ -74,10 +62,7 @@ public class BaseUriUnitTests {
|
||||
assertThat(uri.getRepositoryLookupPath("/foo/"), isEmptyString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void matchesAbsoluteBaseUriOnOverlap() {
|
||||
|
||||
BaseUri uri = new BaseUri(URI.create("http://localhost:8080/foo/"));
|
||||
@@ -88,11 +73,7 @@ public class BaseUriUnitTests {
|
||||
assertThat(uri.getRepositoryLookupPath("/foo/people/"), is("/people"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-674
|
||||
* @see SPR-13455
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-674, SPR-13455
|
||||
public void repositoryLookupPathHandlesDoubleSlashes() {
|
||||
assertThat(BaseUri.NONE.getRepositoryLookupPath("/books//1"), is("/books/1"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,10 +41,7 @@ public class CustomAcceptHeaderHttpServletRequestUnitTests {
|
||||
|
||||
HttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
/**
|
||||
* @see DATAREST-863
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-863
|
||||
public void returnsRegisterdHeadersOnAccessForMultipleOnes() {
|
||||
|
||||
List<MediaType> mediaTypes = Arrays.asList(MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_ATOM_XML);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,10 +37,7 @@ public class IncomingRequestUnitTests {
|
||||
this.request = new MockHttpServletRequest("PATCH", "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-498
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-498
|
||||
public void identifiesJsonPatchRequestForRequestWithContentTypeParameters() {
|
||||
|
||||
request.addHeader("Content-Type", "application/json-patch+json;charset=UTF-8");
|
||||
@@ -51,10 +48,7 @@ public class IncomingRequestUnitTests {
|
||||
assertThat(incomingRequest.isJsonMergePatchRequest(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-498
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-498
|
||||
public void identifiesJsonMergePatchRequestForRequestWithContentTypeParameters() {
|
||||
|
||||
request.addHeader("Content-Type", "application/merge-patch+json;charset=UTF-8");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,26 +53,17 @@ public class PersistentEntityResourceUnitTests {
|
||||
this.resources = new Resources<EmbeddedWrapper>(Collections.singleton(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-317
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-317
|
||||
public void rejectsNullPayload() {
|
||||
PersistentEntityResource.build(null, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-317
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-317
|
||||
public void rejectsNullPersistentEntity() {
|
||||
PersistentEntityResource.build(payload, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-317
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-317
|
||||
public void defaultsEmbeddedsToEmptyResources() {
|
||||
|
||||
PersistentEntityResource resource = PersistentEntityResource.build(payload, entity).build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,10 +52,7 @@ public class RepositoryCorsConfigurationAccessorUnitTests {
|
||||
accessor = new RepositoryCorsConfigurationAccessor(mappings, repositories, NoOpStringValueResolver.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void createConfigurationShouldConstructCorsConfiguration() {
|
||||
|
||||
CorsConfiguration configuration = accessor.createConfiguration(AnnotatedRepository.class);
|
||||
@@ -69,10 +66,7 @@ public class RepositoryCorsConfigurationAccessorUnitTests {
|
||||
assertThat(configuration.getMaxAge(), is(1800L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-573
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-573
|
||||
public void createConfigurationShouldConstructFullCorsConfiguration() {
|
||||
|
||||
CorsConfiguration configuration = accessor.createConfiguration(FullyConfiguredCorsRepository.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,10 +64,7 @@ public class RepositoryPropertyReferenceControllerUnitTests {
|
||||
|
||||
KeyValueMappingContext mappingContext = new KeyValueMappingContext();
|
||||
|
||||
/**
|
||||
* @see DATAREST-791
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-791
|
||||
public void usesRepositoryInvokerToLookupRelatedInstance() throws Exception {
|
||||
|
||||
KeyValuePersistentEntity<?> entity = mappingContext.getPersistentEntity(Sample.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,10 +57,7 @@ public class RepositoryRestExceptionHandlerUnitTests {
|
||||
logger.setLevel(logLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-427
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-427
|
||||
public void handlesHttpMessageNotReadableException() {
|
||||
|
||||
ResponseEntity<ExceptionMessage> result = HANDLER
|
||||
@@ -69,10 +66,7 @@ public class RepositoryRestExceptionHandlerUnitTests {
|
||||
assertThat(result.getStatusCode(), is(HttpStatus.BAD_REQUEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-507
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-507
|
||||
public void handlesConflictCorrectly() {
|
||||
|
||||
ResponseEntity<ExceptionMessage> result = HANDLER.handleConflict(new DataIntegrityViolationException("Message!"));
|
||||
@@ -80,10 +74,7 @@ public class RepositoryRestExceptionHandlerUnitTests {
|
||||
assertThat(result.getStatusCode(), is(HttpStatus.CONFLICT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-706
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-706
|
||||
public void forwardsExceptionForMiscellaneousFailure() {
|
||||
|
||||
String message = "My Message!";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,20 +91,14 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
new RepositoryRestHandlerMapping(mappings, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-111
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-111
|
||||
public void returnsNullForUriNotMapped() throws Exception {
|
||||
|
||||
handlerMapping.afterPropertiesSet();
|
||||
assertThat(handlerMapping.lookupHandlerMethod("/foo", mockRequest), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-111
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-111
|
||||
public void looksUpRepositoryEntityControllerMethodCorrectly() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -117,10 +111,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method.getMethod(), is(listEntitiesMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-292
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-292
|
||||
public void returnsRepositoryHandlerMethodWithBaseUriConfigured() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -135,10 +126,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method.getMethod(), is(listEntitiesMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-292
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-292
|
||||
public void returnsRootHandlerMethodWithBaseUriConfigured() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -153,10 +141,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method.getMethod(), is(rootHandlerMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void returnsRepositoryHandlerMethodForAbsoluteBaseUri() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -171,10 +156,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method.getMethod(), is(listEntitiesMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void returnsRepositoryHandlerMethodForAbsoluteBaseUriWithServletMapping() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -190,10 +172,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method.getMethod(), is(listEntitiesMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void refrainsFromMappingIfTheRequestDoesNotPointIntoAbsolutelyDefinedUriSpace() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
@@ -207,10 +186,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-276
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-276
|
||||
public void refrainsFromMappingWhenUrisDontMatch() throws Exception {
|
||||
|
||||
String baseUri = "foo";
|
||||
@@ -227,10 +203,7 @@ public class RepositoryRestHandlerMappingUnitTests {
|
||||
assertThat(method, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-609
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-609
|
||||
public void rejectsUnexpandedUriTemplateWithNotFound() throws Exception {
|
||||
|
||||
when(mappings.exportsTopLevelResourceFor("/people")).thenReturn(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,18 +28,12 @@ import org.junit.Test;
|
||||
*/
|
||||
public class RepositorySearchesResourceUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-515
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-515
|
||||
public void rejectsNullDomainType() {
|
||||
new RepositorySearchesResource(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-515
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-515
|
||||
public void returnsConfiguredDomainType() {
|
||||
assertThat(new RepositorySearchesResource(String.class).getDomainType(), is(typeCompatibleWith(String.class)));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,26 +61,17 @@ public class ResourceStatusUnitTests {
|
||||
doReturn(new HttpHeaders()).when(preparer).prepareHeaders(eq(entity), Matchers.any());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-835
|
||||
public void rejectsNullPreparer() {
|
||||
ResourceStatus.of(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-835
|
||||
public void returnsModifiedIfNoHeadersGiven() {
|
||||
assertModified(status.getStatusAndHeaders(new HttpHeaders(), new Sample(0), entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-835
|
||||
public void returnsNotModifiedForEntityWithRequestedETag() {
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
@@ -89,10 +80,7 @@ public class ResourceStatusUnitTests {
|
||||
assertNotModified(status.getStatusAndHeaders(headers, new Sample(1), entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-835
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-835
|
||||
public void returnsNotModifiedIfEntityIsStillConsideredValid() {
|
||||
|
||||
doReturn(true).when(preparer).isObjectStillValid(Matchers.any(), Matchers.any(HttpHeaders.class));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,10 +54,7 @@ public class RootResourceInformationUnitTests {
|
||||
this.information = new RootResourceInformation(metadata, entity, invoker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-330
|
||||
*/
|
||||
@Test(expected = ResourceNotFoundException.class)
|
||||
@Test(expected = ResourceNotFoundException.class) // DATAREST-330
|
||||
public void throwsExceptionOnVerificationIfResourceIsNotExported() throws HttpRequestMethodNotSupportedException {
|
||||
|
||||
when(metadata.isExported()).thenReturn(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,26 +47,17 @@ public class ArgumentResolverPagingAndSortingTemplateVariablesUnitTests {
|
||||
@Mock HateoasSortHandlerMethodArgumentResolver sortResolver;
|
||||
@Mock UriComponentsBuilder builder;
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-467
|
||||
public void rejectsNullArgumentResolverForPageable() {
|
||||
new ArgumentResolverPagingAndSortingTemplateVariables(null, sortResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-467
|
||||
public void rejectsNullArgumentResolverForSort() {
|
||||
new ArgumentResolverPagingAndSortingTemplateVariables(pageableResolver, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void supportsPageableAndSortMethodParameters() {
|
||||
|
||||
PagingAndSortingTemplateVariables variables = new ArgumentResolverPagingAndSortingTemplateVariables(
|
||||
@@ -77,18 +68,12 @@ public class ArgumentResolverPagingAndSortingTemplateVariablesUnitTests {
|
||||
assertThat(variables.supportsParameter(getParameterMock(Object.class)), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void forwardsEnhanceRequestForPageable() {
|
||||
assertForwardsEnhanceFor(new PageRequest(0, 10), pageableResolver, sortResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-467
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-467
|
||||
public void forwardsEnhanceRequestForSort() {
|
||||
assertForwardsEnhanceFor(new Sort("property"), sortResolver, pageableResolver);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,10 +82,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-210
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-210
|
||||
public void assertEnableHypermediaSupportWorkingCorrectly() {
|
||||
|
||||
assertThat(context.getBean("entityLinksPluginRegistry"), is(notNullValue()));
|
||||
@@ -103,10 +100,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
mapper.writeValueAsString(new RepositoryLinksResource());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-271
|
||||
public void assetConsidersPaginationCustomization() {
|
||||
|
||||
HateoasPageableHandlerMethodArgumentResolver resolver = context
|
||||
@@ -124,10 +118,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
assertThat(params.get("mySize").get(0), is("7000"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-336
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-336
|
||||
public void objectMapperRendersDatesInIsoByDefault() throws Exception {
|
||||
|
||||
Sample sample = new Sample();
|
||||
@@ -143,18 +134,12 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
assertThat(result, is((Object) formatter.print(sample.date, Locale.US)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-362
|
||||
*/
|
||||
@Test(expected = NoSuchBeanDefinitionException.class)
|
||||
@Test(expected = NoSuchBeanDefinitionException.class) // DATAREST-362
|
||||
public void doesNotExposePersistentEntityJackson2ModuleAsBean() {
|
||||
context.getBean(PersistentEntityJackson2Module.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-362
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-362
|
||||
public void registeredHttpMessageConvertersAreTypeConstrained() {
|
||||
|
||||
Collection<MappingJackson2HttpMessageConverter> converters = context
|
||||
@@ -166,10 +151,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-424
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-424
|
||||
public void halHttpMethodConverterIsRegisteredBeforeTheGeneralOne() {
|
||||
|
||||
CollectingComponent component = context.getBean(CollectingComponent.class);
|
||||
@@ -179,10 +161,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
assertThat(converters.get(1).getSupportedMediaTypes(), hasItem(RestMediaTypes.SCHEMA_JSON));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-424
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-424
|
||||
public void halHttpMethodConverterIsRegisteredAfterTheGeneralOneIfHalIsDisabledAsDefaultMediaType() {
|
||||
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(NonHalConfiguration.class);
|
||||
@@ -195,10 +174,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
assertThat(converters.get(1).getSupportedMediaTypes(), hasItem(MediaTypes.HAL_JSON));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-431, DATACMNS-626
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-431, DATACMNS-626
|
||||
public void hasConvertersForPointAndDistance() {
|
||||
|
||||
ConversionService service = context.getBean("defaultConversionService", ConversionService.class);
|
||||
@@ -209,10 +185,7 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
assertThat(service.canConvert(Distance.class, String.class), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-686
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-686
|
||||
public void defaultsEncodingForMessageSourceToUtfEight() {
|
||||
|
||||
MessageSourceAccessor accessor = context.getBean("resourceDescriptionMessageSourceAccessor",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -95,10 +95,7 @@ public class DomainObjectReaderUnitTests {
|
||||
this.reader = new DomainObjectReader(entities, new Associations(mappings, mock(RepositoryRestConfiguration.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-461
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-461
|
||||
public void doesNotConsiderIgnoredProperties() throws Exception {
|
||||
|
||||
SampleUser user = new SampleUser("firstname", "password");
|
||||
@@ -110,10 +107,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.password, is("password"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-556
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-556
|
||||
public void considersMappedFieldNamesWhenApplyingNodeToDomainObject() throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -127,10 +121,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.lastName, is("Beauford"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-605
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-605
|
||||
public void mergesMapCorrectly() throws Exception {
|
||||
|
||||
SampleUser user = new SampleUser("firstname", "password");
|
||||
@@ -146,10 +137,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.relatedUsers.get("parent").name, is("Oliver"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-701
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-701
|
||||
@SuppressWarnings("unchecked")
|
||||
public void mergesNestedMapWithoutTypeInformation() throws Exception {
|
||||
|
||||
@@ -169,10 +157,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(((Map<Object, Object>) object).get("c"), is((Object) "2"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-701
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-701
|
||||
public void rejectsMergingUnknownDomainObject() throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -181,10 +166,7 @@ public class DomainObjectReaderUnitTests {
|
||||
reader.readPut(node, "", mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-705
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-705
|
||||
public void doesNotWipeIdAndVersionPropertyForPut() throws Exception {
|
||||
|
||||
VersionedType type = new VersionedType();
|
||||
@@ -203,10 +185,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.version, is(1L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-873
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-873
|
||||
public void doesNotApplyInputToReadOnlyFields() throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -220,10 +199,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(reader.readPut(node, sample, mapper).createdDate, is(reference));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-931
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-931
|
||||
public void readsPatchForEntityNestedInCollection() throws Exception {
|
||||
|
||||
Phone phone = new Phone();
|
||||
@@ -240,10 +216,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.phones.get(0).creationDate, is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-919
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-919
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readsComplexNestedMapsAndArrays() throws Exception {
|
||||
|
||||
@@ -281,10 +254,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(sub4.get("c2"), is("new"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-938
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-938
|
||||
public void nestedEntitiesAreUpdated() throws Exception {
|
||||
|
||||
Inner inner = new Inner();
|
||||
@@ -307,10 +277,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.inner, is(sameInstance(inner)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-937
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-937
|
||||
public void considersTransientProperties() throws Exception {
|
||||
|
||||
SampleWithTransient sample = new SampleWithTransient();
|
||||
@@ -325,10 +292,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.temporary, is("new temp"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-953
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-953
|
||||
public void writesArrayForPut() throws Exception {
|
||||
|
||||
Child inner = new Child();
|
||||
@@ -345,10 +309,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.inner.items.get(0).some, is("value"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-956
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-956
|
||||
public void writesArrayWithAddedItemForPut() throws Exception {
|
||||
|
||||
Child inner = new Child();
|
||||
@@ -369,10 +330,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.inner.items.get(2).some, is("value3"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-956
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-956
|
||||
public void writesArrayWithRemovedItemForPut() throws Exception {
|
||||
|
||||
Child inner = new Child();
|
||||
@@ -392,10 +350,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.inner.items.get(0).some, is("value"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-959
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-959
|
||||
public void addsElementToPreviouslyEmptyCollection() throws Exception {
|
||||
|
||||
Parent source = new Parent();
|
||||
@@ -410,10 +365,7 @@ public class DomainObjectReaderUnitTests {
|
||||
assertThat(result.inner.items.get(0).some, is("value"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-959
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-959
|
||||
@SuppressWarnings("unchecked")
|
||||
public void turnsObjectIntoCollection() throws Exception {
|
||||
|
||||
@@ -464,9 +416,7 @@ public class DomainObjectReaderUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-556
|
||||
*/
|
||||
// DATAREST-556
|
||||
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
|
||||
static class Person {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,42 +47,27 @@ public class EnumTranslatorUnitTests {
|
||||
this.configuration = new EnumTranslator(new MessageSourceAccessor(messageSource));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-654
|
||||
public void rejectsNullMessageSourceAccessor() {
|
||||
new EnumTranslator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesNullForNullSource() {
|
||||
assertThat(configuration.fromText(MyEnum.class, null), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesNullForEmptySource() {
|
||||
assertThat(configuration.fromText(MyEnum.class, null), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesNullForUnknownValue() {
|
||||
assertThat(configuration.fromText(MyEnum.class, "Foobar"), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void returnsEnumNameIfDefaultTranslationIsDisabled() {
|
||||
|
||||
configuration.setEnableDefaultTranslation(false);
|
||||
@@ -90,19 +75,13 @@ public class EnumTranslatorUnitTests {
|
||||
assertThat(configuration.asText(MyEnum.SECOND_VALUE), is(MyEnum.SECOND_VALUE.name()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void returnsDefaultTranslationByDefault() {
|
||||
|
||||
assertThat(configuration.asText(MyEnum.SECOND_VALUE), is("Second value"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesEnumNameIfDefaultTranslationIsDisabled() {
|
||||
|
||||
configuration.setEnableDefaultTranslation(false);
|
||||
@@ -110,20 +89,14 @@ public class EnumTranslatorUnitTests {
|
||||
assertThat(configuration.fromText(MyEnum.class, "FIRST_VALUE"), is(MyEnum.FIRST_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesStandardTranslationAndEnumNameByDefault() {
|
||||
|
||||
assertThat(configuration.fromText(MyEnum.class, "FIRST_VALUE"), is(MyEnum.FIRST_VALUE));
|
||||
assertThat(configuration.fromText(MyEnum.class, "Second value"), is(MyEnum.SECOND_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void translatesEnumName() {
|
||||
|
||||
LocaleContextHolder.setLocale(Locale.US);
|
||||
@@ -134,10 +107,7 @@ public class EnumTranslatorUnitTests {
|
||||
assertThat(configuration.asText(MyEnum.FIRST_VALUE), is("Translated"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesEnumNameByDefaultEvenIfMessageDefined() {
|
||||
|
||||
// Parses resolved message and enum name
|
||||
@@ -152,10 +122,7 @@ public class EnumTranslatorUnitTests {
|
||||
assertThat(configuration.fromText(MyEnum.class, "SECOND_VALUE"), is(MyEnum.SECOND_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-654
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-654
|
||||
public void parsesEnumWithDefaultTranslationDisabled() {
|
||||
|
||||
configuration.setEnableDefaultTranslation(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,10 +57,7 @@ public class JacksonMetadataUnitTests {
|
||||
this.mapper.disable(MapperFeature.INFER_PROPERTY_MUTATORS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-644
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-644
|
||||
public void detectsReadOnlyProperty() {
|
||||
|
||||
JacksonMetadata metadata = new JacksonMetadata(mapper, User.class);
|
||||
@@ -72,10 +69,7 @@ public class JacksonMetadataUnitTests {
|
||||
assertThat(metadata.isReadOnly(property), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-644
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-644
|
||||
public void reportsConstructorArgumentAsJacksonWritable() {
|
||||
|
||||
JacksonMetadata metadata = new JacksonMetadata(mapper, Value.class);
|
||||
@@ -86,10 +80,7 @@ public class JacksonMetadataUnitTests {
|
||||
assertThat(metadata.isReadOnly(property), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-644
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-644
|
||||
public void detectsCustomSerializerFortType() {
|
||||
|
||||
JsonSerializer<?> serializer = new JacksonMetadata(new ObjectMapper(), SomeBean.class)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,10 +48,7 @@ public class JacksonSerializersUnitTests {
|
||||
this.mapper.registerModule(new JacksonSerializers(translator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-929
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-929
|
||||
public void translatesPlainEnumCorrectly() throws Exception {
|
||||
|
||||
Sample result = mapper.readValue("{ \"property\" : \"value\"}", Sample.class);
|
||||
@@ -59,10 +56,7 @@ public class JacksonSerializersUnitTests {
|
||||
assertThat(result.property, is(SampleEnum.VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-929
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-929
|
||||
public void translatesCollectionOfEnumsCorrectly() throws Exception {
|
||||
|
||||
Sample result = mapper.readValue("{ \"collection\" : [ \"value\" ] }", Sample.class);
|
||||
@@ -70,10 +64,7 @@ public class JacksonSerializersUnitTests {
|
||||
assertThat(result.collection, hasItem(SampleEnum.VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-929
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-929
|
||||
public void translatesEnumArraysCorrectly() throws Exception {
|
||||
|
||||
Sample result = mapper.readValue("{ \"array\" : [ \"value\" ] }", Sample.class);
|
||||
@@ -81,10 +72,7 @@ public class JacksonSerializersUnitTests {
|
||||
assertThat(result.array, hasItemInArray(SampleEnum.VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-929
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-929
|
||||
public void translatesMapEnumValueCorrectly() throws Exception {
|
||||
|
||||
Sample result = mapper.readValue("{ \"mapToEnum\" : { \"foo\" : \"value\" } }", Sample.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,10 +32,7 @@ public class JsonSchemaUnitTests {
|
||||
|
||||
static final TypeInformation<?> type = ClassTypeInformation.from(Sample.class);
|
||||
|
||||
/**
|
||||
* @see DATAREST-492
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-492
|
||||
public void considersNumberPrimitivesJsonSchemaNumbers() {
|
||||
|
||||
JsonSchemaProperty property = new JsonSchemaProperty("foo", null, "bar", false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,40 +39,28 @@ public class MappedPropertiesUnitTests {
|
||||
KeyValuePersistentEntity<?> entity = context.getPersistentEntity(Sample.class);
|
||||
MappedProperties properties = MappedProperties.fromJacksonProperties(entity, mapper);
|
||||
|
||||
/**
|
||||
* @see DATAREST-575
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-575
|
||||
public void doesNotExposeMappedPropertyForNonSpringDataPersistentProperty() {
|
||||
|
||||
assertThat(properties.hasPersistentPropertyForField("notExposedBySpringData"), is(false));
|
||||
assertThat(properties.getPersistentProperty("notExposedBySpringData"), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-575
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-575
|
||||
public void doesNotExposeMappedPropertyForNonJacksonProperty() {
|
||||
|
||||
assertThat(properties.hasPersistentPropertyForField("notExposedByJackson"), is(false));
|
||||
assertThat(properties.getPersistentProperty("notExposedByJackson"), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-575
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-575
|
||||
public void exposesProperty() {
|
||||
|
||||
assertThat(properties.hasPersistentPropertyForField("exposedProperty"), is(true));
|
||||
assertThat(properties.getPersistentProperty("exposedProperty"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-575
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-575
|
||||
public void exposesRenamedPropertyByExternalName() {
|
||||
|
||||
assertThat(properties.hasPersistentPropertyForField("email"), is(true));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,10 +56,7 @@ public class MappingAwarePageableArgumentResolverUnitTests {
|
||||
resolver = new MappingAwarePageableArgumentResolver(translator, delegate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void resolveArgumentShouldReturnTranslatedPageable() throws Exception {
|
||||
|
||||
Sort translated = new Sort("world");
|
||||
@@ -75,10 +72,7 @@ public class MappingAwarePageableArgumentResolverUnitTests {
|
||||
assertThat(result.getSort(), is(equalTo(translated)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void resolveArgumentShouldReturnPageableWithoutSort() throws Exception {
|
||||
|
||||
Pageable pageable = new PageRequest(0, 1);
|
||||
@@ -92,10 +86,7 @@ public class MappingAwarePageableArgumentResolverUnitTests {
|
||||
assertThat(result.getSort(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-906
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-906
|
||||
public void resolveArgumentShouldReturnNoPageable() throws Exception {
|
||||
|
||||
Pageable result = resolver.resolveArgument(parameter, modelAndViewContainer, webRequest, binderFactory);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -102,10 +102,7 @@ public class PersistentEntityJackson2ModuleUnitTests {
|
||||
this.mapper.registerModule(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-328, DATAREST-320
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-328, DATAREST-320
|
||||
public void doesNotDropPropertiesWithCustomizedNames() throws Exception {
|
||||
|
||||
Sample sample = new Sample();
|
||||
@@ -116,10 +113,7 @@ public class PersistentEntityJackson2ModuleUnitTests {
|
||||
assertThat(JsonPath.read(result, "$.foo"), is((Object) "bar"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-340
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-340
|
||||
public void rendersAdditionalJsonPropertiesNotBackedByAPersistentField() throws Exception {
|
||||
|
||||
SampleWithAdditionalGetters sample = new SampleWithAdditionalGetters();
|
||||
@@ -128,10 +122,7 @@ public class PersistentEntityJackson2ModuleUnitTests {
|
||||
assertThat(JsonPath.read(result, "$.number"), is((Object) 5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-662
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-662
|
||||
public void resolvesReferenceToSubtypeCorrectly() throws IOException {
|
||||
|
||||
PersistentProperty<?> property = persistentEntities.getPersistentEntity(PetOwner.class)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,10 +51,7 @@ public class ProjectionJacksonIntegrationTests {
|
||||
this.mapper.setHandlerInstantiator(new HalHandlerInstantiator(new EvoInflectorRelProvider(), null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void considersJacksonAnnotationsOnProjectionInterfaces() throws Exception {
|
||||
|
||||
Customer customer = new Customer();
|
||||
@@ -68,10 +65,7 @@ public class ProjectionJacksonIntegrationTests {
|
||||
assertThat(JsonPath.read(result, "$.firstname"), is((Object) "Dave"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void rendersHalContentCorrectly() throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,10 +60,7 @@ public class SortTranslatorUnitTests {
|
||||
sortTranslator = new SortTranslator(persistentEntities, objectMapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void shouldMapKnownProperties() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("hello", "name"),
|
||||
@@ -73,10 +70,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort.getOrderFor("name"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void returnsNullSortIfNoPropertiesMatch() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("hello", "world"),
|
||||
@@ -85,10 +79,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void shouldMapKnownPropertiesWithJsonProperty() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("hello", "foo"),
|
||||
@@ -98,10 +89,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort.getOrderFor("name"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-883
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-883
|
||||
public void shouldJacksonFieldNameForMapping() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("name"),
|
||||
@@ -110,10 +98,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldMapKnownNestedProperties() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(
|
||||
@@ -125,10 +110,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort.getOrderFor("embedded.someInterface"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldSkipWrongNestedProperties() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("embedded.unknown"),
|
||||
@@ -137,10 +119,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldSkipKnownAssociationProperties() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("refEmbedded.name"),
|
||||
@@ -149,10 +128,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort, is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldJacksonFieldNameForNestedFieldMapping() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("em.foo"),
|
||||
@@ -161,10 +137,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort.getOrderFor("embeddedWithJsonProperty.bar"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldTranslatePathForSingleLevelJsonUnwrappedObject() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("un-name"),
|
||||
@@ -173,10 +146,7 @@ public class SortTranslatorUnitTests {
|
||||
assertThat(translatedSort.getOrderFor("embedded.name"), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void shouldTranslatePathForMultiLevelLevelJsonUnwrappedObject() {
|
||||
|
||||
Sort translatedSort = sortTranslator.translateSort(new Sort("un-name", "burrito.un-name"),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -69,36 +69,24 @@ public class UriStringDeserializerUnitTests {
|
||||
ReflectionTestUtils.setField(context, "_parser", parser);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-316
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-316
|
||||
public void extractsUriToForwardToConverter() throws Exception {
|
||||
assertConverterInvokedWithUri("/foo/32", URI.create("/foo/32"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-316
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-316
|
||||
public void extractsUriFromTemplateToForwardToConverter() throws Exception {
|
||||
assertConverterInvokedWithUri("/foo/32{?projection}", URI.create("/foo/32"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-377
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-377
|
||||
public void returnsNullUriIfSourceIsEmptyOrNull() throws Exception {
|
||||
|
||||
assertThat(invokeConverterWith(""), is(nullValue()));
|
||||
assertThat(invokeConverterWith(null), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-377
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-377
|
||||
public void rejectsNonUriValue() throws Exception {
|
||||
|
||||
exception.expect(JsonMappingException.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,10 +59,7 @@ public class WrappedPropertiesUnitTests {
|
||||
persistentEntities = new PersistentEntities(Collections.singleton(mappingContext));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void wrappedPropertiesShouldConsiderSingleLevelUnwrapping() {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(OneLevelNesting.class);
|
||||
@@ -81,10 +78,7 @@ public class WrappedPropertiesUnitTests {
|
||||
assertThat(street, contains(addressProperty, streetProperty));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void wrappedPropertiesShouldConsiderMultiLevelUnwrapping() {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(MultiLevelNesting.class);
|
||||
@@ -106,10 +100,7 @@ public class WrappedPropertiesUnitTests {
|
||||
assertThat(street, contains(oneLevelNestingProperty, addressProperty, streetProperty));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void wrappedPropertiesShouldConsiderJacksonFieldNames() {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(MultiLevelNesting.class);
|
||||
@@ -119,10 +110,7 @@ public class WrappedPropertiesUnitTests {
|
||||
assertThat(wrappedProperties.hasPersistentPropertiesForField("pre-zip-post"), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void wrappedPropertiesShouldIgnoreIgnoredJacksonFields() {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(MultiLevelNesting.class);
|
||||
@@ -132,10 +120,7 @@ public class WrappedPropertiesUnitTests {
|
||||
assertThat(wrappedProperties.hasPersistentPropertiesForField("pre-street-ignored"), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void wrappedPropertiesShouldIgnoreSyntheticProperties() {
|
||||
|
||||
PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(SyntheticProperties.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -121,10 +121,7 @@ public class JsonPatchTests {
|
||||
assertEquals("F", todos.get(5).getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-889
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-889
|
||||
public void patchArray() throws Exception {
|
||||
|
||||
Todo todo = new Todo(1L, "F", false);
|
||||
@@ -136,10 +133,7 @@ public class JsonPatchTests {
|
||||
assertEquals(Arrays.asList("one", "two", "three"), patchedTodo.getItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-889
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-889
|
||||
public void patchUnknownType() throws Exception {
|
||||
|
||||
Todo todo = new Todo();
|
||||
@@ -152,10 +146,7 @@ public class JsonPatchTests {
|
||||
readJsonPatch("patch-biginteger.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-889
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-889
|
||||
public void failureWithInvalidPatchContent() throws Exception {
|
||||
|
||||
Todo todo = new Todo();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,10 +68,7 @@ public class ReplaceOperationTests {
|
||||
assertEquals("22", todos.get(1).getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-885
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-885
|
||||
public void replaceObjectPropertyValue() throws Exception {
|
||||
|
||||
Todo todo = new Todo(1L, "A", false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,10 +44,7 @@ public class DelegatingHandlerMappingUnitTests {
|
||||
@Mock HandlerMapping first, second;
|
||||
@Mock HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* @see DATAREST-490, DATAREST-522
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-490, DATAREST-522
|
||||
public void consultsAllHandlerMappingsAndThrowsExceptionEventually() throws Exception {
|
||||
|
||||
DelegatingHandlerMapping mapping = new DelegatingHandlerMapping(Arrays.asList(first, second));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,18 +24,12 @@ import org.junit.Test;
|
||||
*/
|
||||
public class ETagDoesntMatchExceptionUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-160
|
||||
public void rejectsNullTargetBean() {
|
||||
new ETagDoesntMatchException(null, ETag.from("1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREST-160
|
||||
public void rejectsNullExpectedETag() {
|
||||
new ETagDoesntMatchException(new Object(), null);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,28 +38,19 @@ public class ETagUnitTests {
|
||||
|
||||
KeyValueMappingContext context = new KeyValueMappingContext();
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test(expected = ETagDoesntMatchException.class)
|
||||
@Test(expected = ETagDoesntMatchException.class) // DATAREST-160
|
||||
public void expectWrongEtag() throws Exception {
|
||||
|
||||
ETag eTag = ETag.from("1");
|
||||
eTag.verify(context.getPersistentEntity(Sample.class), new Sample(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void expectCorrectEtag() throws Exception {
|
||||
ETag.from("0").verify(context.getPersistentEntity(Sample.class), new Sample(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void createsETagFromVersionValue() throws Exception {
|
||||
|
||||
PersistentEntity<?, ?> entity = context.getPersistentEntity(Sample.class);
|
||||
@@ -68,34 +59,22 @@ public class ETagUnitTests {
|
||||
assertThat(from.toString(), is((Object) "\"0\""));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void surroundsValueWithQuotationMarksOnToString() {
|
||||
assertThat(ETag.from("1").toString(), is("\"1\""));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void returnsNoEtagForNullStringSource() {
|
||||
assertThat(ETag.from((String) null), is(ETag.NO_ETAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void returnsNoEtagForNullPersistentEntityResourceSource() {
|
||||
assertThat(ETag.from((PersistentEntityResource) null), is(ETag.NO_ETAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void hasValueObjectEqualsSemantics() {
|
||||
|
||||
ETag one = ETag.from("1");
|
||||
@@ -110,64 +89,43 @@ public class ETagUnitTests {
|
||||
assertThat(one.equals(""), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void returnsNoEtagForEntityWithoutVersionProperty() {
|
||||
|
||||
PersistentEntity<?, ?> entity = context.getPersistentEntity(SampleWithoutVersion.class);
|
||||
assertThat(ETag.from(PersistentEntityResource.build(new SampleWithoutVersion(), entity).build()), is(ETag.NO_ETAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void noETagReturnsNullForToString() {
|
||||
assertThat(ETag.NO_ETAG.toString(), is(nullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void noETagDoesNotRejectVerification() {
|
||||
ETag.NO_ETAG.verify(context.getPersistentEntity(Sample.class), new Sample(5L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void verificationDoesNotRejectNullEntity() {
|
||||
ETag.from("5").verify(context.getPersistentEntity(Sample.class), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void stripsTrailingAndLeadingQuotesOnCreation() {
|
||||
|
||||
assertThat(ETag.from("\"1\""), is(ETag.from("1")));
|
||||
assertThat(ETag.from("\"\"1\"\""), is(ETag.from("1")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void addsETagToHeadersIfNotNoETag() {
|
||||
|
||||
HttpHeaders headers = ETag.from("1").addTo(new HttpHeaders());
|
||||
assertThat(headers.getETag(), is(notNullValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-160
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-160
|
||||
public void doesNotAddHeaderForNoETag() {
|
||||
|
||||
HttpHeaders headers = ETag.NO_ETAG.addTo(new HttpHeaders());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,10 +56,7 @@ public class PersistentEntityProjectorUnitTests {
|
||||
doReturn(Excerpt.class).when(metadata).getExcerptProjection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void returnsObjectAsIsIfNoProjectionTypeFound() {
|
||||
|
||||
Object object = new Object();
|
||||
@@ -67,10 +64,7 @@ public class PersistentEntityProjectorUnitTests {
|
||||
assertThat(projector.project(object), is(object));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-221
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-221
|
||||
public void invokesProjectionFactoryIfProjectionFound() {
|
||||
|
||||
configuration.addProjection(Sample.class, Object.class);
|
||||
@@ -78,10 +72,7 @@ public class PersistentEntityProjectorUnitTests {
|
||||
assertThat(projector.project(new Object()), is(instanceOf(Sample.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-806
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-806
|
||||
public void favorsExplicitProjectionOverExcerpt() {
|
||||
|
||||
configuration.addProjection(Sample.class, Object.class);
|
||||
@@ -89,18 +80,12 @@ public class PersistentEntityProjectorUnitTests {
|
||||
assertThat(projector.projectExcerpt(new Object()), is(instanceOf(Sample.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-806
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-806
|
||||
public void excerptProjectionIsUsedForExcerpt() {
|
||||
assertThat(projector.projectExcerpt(new Object()), is(instanceOf(Excerpt.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-806
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-806
|
||||
public void usesExcerptProjectionIfNoExplicitProjectionWasRequested() {
|
||||
|
||||
configuration.addProjection(Sample.class, Object.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,10 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
*/
|
||||
public class UriUtilsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void pathSegmentsShouldDiscoverPathUsingMethodMapping() throws Exception {
|
||||
|
||||
Method method = ClassUtils.getMethod(MappedMethod.class, "method");
|
||||
@@ -44,10 +41,7 @@ public class UriUtilsUnitTests {
|
||||
assertThat(pathSegments, hasItems("hello", "world"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREST-910
|
||||
*/
|
||||
@Test
|
||||
@Test // DATAREST-910
|
||||
public void pathSegmentsShouldDiscoverPathUsingTypeAndMethodMapping() throws Exception {
|
||||
|
||||
Method method = ClassUtils.getMethod(MappedClassAndMethod.class, "method");
|
||||
|
||||
Reference in New Issue
Block a user