DATAREDIS-660 - Adapt to API changes in mapping subsystem.

This commit is contained in:
Mark Paluch
2017-06-29 17:50:26 +02:00
parent a06162de0e
commit 772d412ba8
14 changed files with 230 additions and 247 deletions

View File

@@ -45,7 +45,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
import org.springframework.data.convert.WritingConverter;
import org.springframework.data.mapping.model.MappingException;
import org.springframework.data.mapping.MappingException;
import org.springframework.data.redis.core.PartialUpdate;
import org.springframework.data.redis.core.convert.KeyspaceConfiguration.KeyspaceSettings;
import org.springframework.data.redis.core.convert.ConversionTestEntities.*;

View File

@@ -28,7 +28,6 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.hamcrest.core.IsCollectionContaining;
@@ -42,15 +41,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.geo.Point;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.redis.core.convert.ConversionTestEntities.Address;
import org.springframework.data.redis.core.convert.ConversionTestEntities.AddressWithId;
import org.springframework.data.redis.core.convert.ConversionTestEntities.Item;
import org.springframework.data.redis.core.convert.ConversionTestEntities.Location;
import org.springframework.data.redis.core.convert.ConversionTestEntities.Person;
import org.springframework.data.redis.core.convert.ConversionTestEntities.PersonWithAddressReference;
import org.springframework.data.redis.core.convert.ConversionTestEntities.Size;
import org.springframework.data.redis.core.convert.ConversionTestEntities.TaVeren;
import org.springframework.data.redis.core.convert.ConversionTestEntities.TheWheelOfTime;
import org.springframework.data.redis.core.convert.ConversionTestEntities.*;
import org.springframework.data.redis.core.index.GeoIndexed;
import org.springframework.data.redis.core.index.IndexConfiguration;
import org.springframework.data.redis.core.index.Indexed;
@@ -253,7 +244,7 @@ public class PathIndexResolverUnitTests {
public void resolveIndexShouldReturnDataWhenNoIndexConfiguredButPropertyAnnotated() {
when(propertyMock.isAnnotationPresent(eq(Indexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(Optional.of(createIndexedInstance()));
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(createIndexedInstance());
assertThat(resolve("foo", "rand"), notNullValue());
}
@@ -263,7 +254,7 @@ public class PathIndexResolverUnitTests {
when(propertyMock.isCollectionLike()).thenReturn(true);
when(propertyMock.isAnnotationPresent(eq(Indexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(Optional.of(createIndexedInstance()));
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(createIndexedInstance());
IndexedData index = resolve("list.[0].name", "rand");
@@ -275,7 +266,7 @@ public class PathIndexResolverUnitTests {
when(propertyMock.isMap()).thenReturn(true);
when(propertyMock.isAnnotationPresent(eq(Indexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(Optional.of(createIndexedInstance()));
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(createIndexedInstance());
IndexedData index = resolve("map.[foo].name", "rand");
@@ -287,7 +278,7 @@ public class PathIndexResolverUnitTests {
when(propertyMock.isMap()).thenReturn(true);
when(propertyMock.isAnnotationPresent(eq(Indexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(Optional.of(createIndexedInstance()));
when(propertyMock.findAnnotation(eq(Indexed.class))).thenReturn(createIndexedInstance());
IndexedData index = resolve("map.[0].name", "rand");
@@ -449,7 +440,7 @@ public class PathIndexResolverUnitTests {
when(propertyMock.isMap()).thenReturn(true);
when(propertyMock.isAnnotationPresent(eq(GeoIndexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(GeoIndexed.class))).thenReturn(Optional.of(createGeoIndexedInstance()));
when(propertyMock.findAnnotation(eq(GeoIndexed.class))).thenReturn(createGeoIndexedInstance());
IndexedData index = resolve("location", new Point(1D, 2D));
@@ -461,7 +452,7 @@ public class PathIndexResolverUnitTests {
when(propertyMock.isMap()).thenReturn(true);
when(propertyMock.isAnnotationPresent(eq(GeoIndexed.class))).thenReturn(true);
when(propertyMock.findAnnotation(eq(GeoIndexed.class))).thenReturn(Optional.of(createGeoIndexedInstance()));
when(propertyMock.findAnnotation(eq(GeoIndexed.class))).thenReturn(createGeoIndexedInstance());
IndexedData index = resolve("property.location", new Point(1D, 2D));

View File

@@ -21,7 +21,6 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.io.Serializable;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
@@ -31,13 +30,14 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.keyvalue.core.mapping.KeySpaceResolver;
import org.springframework.data.mapping.model.MappingException;
import org.springframework.data.mapping.MappingException;
import org.springframework.data.redis.core.TimeToLiveAccessor;
import org.springframework.data.redis.core.convert.ConversionTestEntities;
import org.springframework.data.util.TypeInformation;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @param <T>
* @param <ID>
*/
@@ -111,6 +111,6 @@ public class BasicRedisPersistentEntityUnitTests<T, ID extends Serializable> {
entity.addPersistentProperty(property1);
entity.addPersistentProperty(property2);
assertThat(entity.getIdProperty(), is(equalTo(Optional.of(property2))));
assertThat(entity.getIdProperty(), is(equalTo(property2)));
}
}

View File

@@ -23,12 +23,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.mapping.model.MappingException;
import org.springframework.data.mapping.MappingException;
import org.springframework.data.redis.core.convert.ConversionTestEntities;
import org.springframework.data.redis.core.mapping.RedisPersistentEntity;
/**
* @author Christoph Strobl
* @author Mark Paluch
*/
@RunWith(MockitoJUnitRunner.class)
public class MappingRedisEntityInformationUnitTests<T, ID extends Serializable> {