@@ -38,10 +38,10 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.data.convert.CustomConversions;
|
||||
import org.springframework.data.mapping.AssociationHandler;
|
||||
import org.springframework.data.mapping.InstanceCreatorMetadata;
|
||||
import org.springframework.data.mapping.MappingException;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.mapping.PersistentPropertyPath;
|
||||
import org.springframework.data.mapping.PreferredConstructor;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.mapping.model.EntityInstantiator;
|
||||
import org.springframework.data.mapping.model.EntityInstantiators;
|
||||
@@ -55,7 +55,6 @@ import org.springframework.data.redis.core.mapping.RedisMappingContext;
|
||||
import org.springframework.data.redis.core.mapping.RedisPersistentEntity;
|
||||
import org.springframework.data.redis.core.mapping.RedisPersistentProperty;
|
||||
import org.springframework.data.redis.util.ByteUtils;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.ProxyUtils;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -177,7 +176,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <R> R read(Class<R> type, RedisData source) {
|
||||
|
||||
TypeInformation<?> readType = typeMapper.readType(source.getBucket().getPath(), ClassTypeInformation.from(type));
|
||||
TypeInformation<?> readType = typeMapper.readType(source.getBucket().getPath(), TypeInformation.of(type));
|
||||
|
||||
return readType.isCollectionLike()
|
||||
? (R) readCollectionOrArray("", ArrayList.class, Object.class, source.getBucket())
|
||||
@@ -193,7 +192,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
@SuppressWarnings("unchecked")
|
||||
private <R> R doReadInternal(String path, Class<R> type, RedisData source) {
|
||||
|
||||
TypeInformation<?> readType = typeMapper.readType(source.getBucket().getPath(), ClassTypeInformation.from(type));
|
||||
TypeInformation<?> readType = typeMapper.readType(source.getBucket().getPath(), TypeInformation.of(type));
|
||||
|
||||
if (customConversions.hasCustomReadTarget(Map.class, readType.getType())) {
|
||||
|
||||
@@ -237,9 +236,9 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
|
||||
entity.doWithProperties((PropertyHandler<RedisPersistentProperty>) persistentProperty -> {
|
||||
|
||||
PreferredConstructor<?, RedisPersistentProperty> constructor = entity.getPersistenceConstructor();
|
||||
InstanceCreatorMetadata<RedisPersistentProperty> creator = entity.getInstanceCreatorMetadata();
|
||||
|
||||
if (constructor != null && constructor.isConstructorParameter(persistentProperty)) {
|
||||
if (creator != null && creator.isCreatorParameter(persistentProperty)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -490,10 +489,10 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
|
||||
targetProperty = getTargetPropertyOrNullForPath(path.replaceAll("\\.\\[.*\\]", ""), update.getTarget());
|
||||
|
||||
TypeInformation<?> ti = targetProperty == null ? ClassTypeInformation.OBJECT
|
||||
TypeInformation<?> ti = targetProperty == null ? TypeInformation.OBJECT
|
||||
: (targetProperty.isMap() ? (targetProperty.getTypeInformation().getMapValueType() != null
|
||||
? targetProperty.getTypeInformation().getRequiredMapValueType()
|
||||
: ClassTypeInformation.OBJECT) : targetProperty.getTypeInformation().getActualType());
|
||||
: TypeInformation.OBJECT) : targetProperty.getTypeInformation().getActualType());
|
||||
|
||||
writeInternal(entity.getKeySpace(), pUpdate.getPropertyPath(), pUpdate.getValue(), ti, sink);
|
||||
return;
|
||||
@@ -820,7 +819,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
Bucket elementData = bucket.extract(key);
|
||||
|
||||
TypeInformation<?> typeInformation = typeMapper.readType(elementData.getPropertyPath(key),
|
||||
ClassTypeInformation.from(valueType));
|
||||
TypeInformation.of(valueType));
|
||||
|
||||
Class<?> typeToUse = typeInformation.getType();
|
||||
if (conversionService.canConvert(byte[].class, typeToUse)) {
|
||||
@@ -863,7 +862,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
if (customConversions.hasCustomWriteTarget(entry.getValue().getClass())) {
|
||||
writeToBucket(currentPath, entry.getValue(), sink, mapValueType);
|
||||
} else {
|
||||
writeInternal(keyspace, currentPath, entry.getValue(), ClassTypeInformation.from(mapValueType), sink);
|
||||
writeInternal(keyspace, currentPath, entry.getValue(), TypeInformation.of(mapValueType), sink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -930,7 +929,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
Object mapKey = extractMapKeyForPath(path, key, keyType);
|
||||
|
||||
TypeInformation<?> typeInformation = typeMapper.readType(source.getBucket().getPropertyPath(key),
|
||||
ClassTypeInformation.from(valueType));
|
||||
TypeInformation.of(valueType));
|
||||
|
||||
Object o = readInternal(key, typeInformation.getType(), new RedisData(partial));
|
||||
target.put(mapKey, o);
|
||||
@@ -963,7 +962,7 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean {
|
||||
private Class<?> getTypeHint(String path, Bucket bucket, Class<?> fallback) {
|
||||
|
||||
TypeInformation<?> typeInformation = typeMapper.readType(bucket.getPropertyPath(path),
|
||||
ClassTypeInformation.from(fallback));
|
||||
TypeInformation.of(fallback));
|
||||
return typeInformation.getType();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.springframework.data.redis.core.index.SimpleIndexDefinition;
|
||||
import org.springframework.data.redis.core.mapping.RedisMappingContext;
|
||||
import org.springframework.data.redis.core.mapping.RedisPersistentEntity;
|
||||
import org.springframework.data.redis.core.mapping.RedisPersistentProperty;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -162,7 +161,7 @@ public class PathIndexResolver implements IndexResolver {
|
||||
}
|
||||
|
||||
else if (persistentProperty.isEntity()
|
||||
|| persistentProperty.getTypeInformation().getActualType().equals(ClassTypeInformation.OBJECT)) {
|
||||
|| persistentProperty.getTypeInformation().getActualType().equals(TypeInformation.OBJECT)) {
|
||||
|
||||
typeHint = updateTypeHintForActualValue(typeHint, propertyValue);
|
||||
indexes.addAll(
|
||||
@@ -175,7 +174,7 @@ public class PathIndexResolver implements IndexResolver {
|
||||
|
||||
private TypeInformation<?> updateTypeHintForActualValue(TypeInformation<?> typeHint, Object propertyValue) {
|
||||
|
||||
if (typeHint.equals(ClassTypeInformation.OBJECT) || typeHint.getClass().isInterface()) {
|
||||
if (typeHint.equals(TypeInformation.OBJECT) || typeHint.getClass().isInterface()) {
|
||||
try {
|
||||
typeHint = mappingContext.getRequiredPersistentEntity(propertyValue.getClass()).getTypeInformation();
|
||||
} catch (Exception e) {
|
||||
@@ -201,7 +200,7 @@ public class PathIndexResolver implements IndexResolver {
|
||||
if (indexConfiguration.hasIndexFor(keyspace, path)) {
|
||||
|
||||
IndexingContext context = new IndexingContext(keyspace, path,
|
||||
property != null ? property.getTypeInformation() : ClassTypeInformation.OBJECT);
|
||||
property != null ? property.getTypeInformation() : TypeInformation.OBJECT);
|
||||
|
||||
for (IndexDefinition indexDefinition : indexConfiguration.getIndexDefinitionsFor(keyspace, path)) {
|
||||
|
||||
|
||||
@@ -215,9 +215,7 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
|
||||
unit = ttlProperty.getRequiredAnnotation(TimeToLive.class).unit();
|
||||
}
|
||||
|
||||
if (source instanceof PartialUpdate) {
|
||||
|
||||
PartialUpdate<?> update = (PartialUpdate<?>) source;
|
||||
if (source instanceof PartialUpdate<?> update) {
|
||||
|
||||
if (ttlProperty != null && !update.getPropertyUpdates().isEmpty()) {
|
||||
for (PropertyUpdate pUpdate : update.getPropertyUpdates()) {
|
||||
@@ -232,7 +230,7 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
|
||||
|
||||
} else if (ttlProperty != null) {
|
||||
|
||||
RedisPersistentEntity entity = mappingContext.getRequiredPersistentEntity(type);
|
||||
RedisPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(type);
|
||||
|
||||
Object ttlPropertyValue = entity.getPropertyAccessor(source).getProperty(ttlProperty);
|
||||
if (ttlPropertyValue != null) {
|
||||
@@ -245,9 +243,7 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
|
||||
|
||||
if (timeoutMethod != null) {
|
||||
|
||||
if (!timeoutMethod.isAccessible()) {
|
||||
ReflectionUtils.makeAccessible(timeoutMethod);
|
||||
}
|
||||
ReflectionUtils.makeAccessible(timeoutMethod);
|
||||
|
||||
TimeToLive ttl = AnnotationUtils.findAnnotation(timeoutMethod, TimeToLive.class);
|
||||
try {
|
||||
@@ -309,7 +305,6 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
|
||||
return defaultTimeout;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
@Nullable
|
||||
private PersistentProperty<?> resolveTtlProperty(Class<?> type) {
|
||||
|
||||
@@ -317,7 +312,7 @@ public class RedisMappingContext extends KeyValueMappingContext<RedisPersistentE
|
||||
return timeoutProperties.get(type);
|
||||
}
|
||||
|
||||
RedisPersistentEntity entity = mappingContext.getRequiredPersistentEntity(type);
|
||||
RedisPersistentEntity<?> entity = mappingContext.getRequiredPersistentEntity(type);
|
||||
PersistentProperty<?> ttlProperty = entity.getPersistentProperty(TimeToLive.class);
|
||||
|
||||
if (ttlProperty != null) {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class RedisRepositoryFactory extends KeyValueRepositoryFactory {
|
||||
MappingRedisEntityInformation<?, ?> entityInformation = new MappingRedisEntityInformation<>(persistentEntity);
|
||||
|
||||
fragments = fragments.append(RepositoryFragment.implemented(QueryByExampleExecutor.class,
|
||||
getTargetRepositoryViaReflection(QueryByExampleRedisExecutor.class, entityInformation, operations)));
|
||||
instantiateClass(QueryByExampleRedisExecutor.class, entityInformation, operations)));
|
||||
}
|
||||
|
||||
return fragments;
|
||||
|
||||
@@ -198,7 +198,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void writeDoesNotAddClassTypeInformationCorrectlyForMatchingTypes() {
|
||||
void writeDoesNotAddTypeInformationCorrectlyForMatchingTypes() {
|
||||
|
||||
Address address = new Address();
|
||||
address.city = "two rivers";
|
||||
@@ -211,7 +211,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425, DATAREDIS-543
|
||||
void writeAddsClassTypeInformationCorrectlyForNonMatchingTypes() {
|
||||
void writeAddsTypeInformationCorrectlyForNonMatchingTypes() {
|
||||
|
||||
AddressWithPostcode address = new AddressWithPostcode();
|
||||
address.city = "two rivers";
|
||||
@@ -225,7 +225,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void readConsidersClassTypeInformationCorrectlyForNonMatchingTypes() {
|
||||
void readConsidersTypeInformationCorrectlyForNonMatchingTypes() {
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("address._class", AddressWithPostcode.class.getName());
|
||||
@@ -262,7 +262,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void writeAddsClassTypeInformationCorrectlyForNonMatchingTypesInCollections() {
|
||||
void writeAddsTypeInformationCorrectlyForNonMatchingTypesInCollections() {
|
||||
|
||||
Person mat = new TaVeren();
|
||||
mat.firstname = "mat";
|
||||
@@ -381,7 +381,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void readListComplexPropertyCorrectlyAndConsidersClassTypeInformation() {
|
||||
void readListComplexPropertyCorrectlyAndConsidersTypeInformation() {
|
||||
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("coworkers.[0]._class", TaVeren.class.getName());
|
||||
@@ -569,7 +569,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void writeAppendsClassTypeInformationCorrectlyForMapWithComplexObjects() {
|
||||
void writeAppendsTypeInformationCorrectlyForMapWithComplexObjects() {
|
||||
|
||||
Map<String, Person> map = new LinkedHashMap<>();
|
||||
Person lews = new TaVeren();
|
||||
@@ -584,7 +584,7 @@ class MappingRedisConverterUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
void readConsidersClassTypeInformationCorrectlyForMapWithComplexObjects() {
|
||||
void readConsidersTypeInformationCorrectlyForMapWithComplexObjects() {
|
||||
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("relatives.[previous-incarnation]._class", TaVeren.class.getName());
|
||||
|
||||
@@ -36,13 +36,12 @@ import org.mockito.quality.Strictness;
|
||||
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
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;
|
||||
import org.springframework.data.redis.core.index.SimpleIndexDefinition;
|
||||
import org.springframework.data.redis.core.mapping.RedisMappingContext;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
@@ -76,7 +75,7 @@ class PathIndexResolverUnitTests {
|
||||
Address address = new Address();
|
||||
address.country = "andor";
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Address.class), address);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Address.class), address);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes).contains(new SimpleIndexedPropertyValue(Address.class.getName(), "country", "andor"));
|
||||
@@ -88,7 +87,7 @@ class PathIndexResolverUnitTests {
|
||||
Address address = new Address();
|
||||
address.country = null;
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Address.class), address);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Address.class), address);
|
||||
|
||||
assertThat(indexes).isEmpty();
|
||||
}
|
||||
@@ -100,7 +99,7 @@ class PathIndexResolverUnitTests {
|
||||
person.address = new Address();
|
||||
person.address.country = "andor";
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Person.class), person);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Person.class), person);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes).contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "address.country", "andor"));
|
||||
@@ -123,7 +122,7 @@ class PathIndexResolverUnitTests {
|
||||
twot.mainCharacters.add(rand);
|
||||
twot.mainCharacters.add(zarine);
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TheWheelOfTime.class), twot);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TheWheelOfTime.class), twot);
|
||||
|
||||
assertThat(indexes).hasSize(2);
|
||||
assertThat(indexes).contains(
|
||||
@@ -145,7 +144,7 @@ class PathIndexResolverUnitTests {
|
||||
|
||||
twot.places.put("stone-of-tear", stoneOfTear);
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TheWheelOfTime.class), twot);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TheWheelOfTime.class), twot);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes)
|
||||
@@ -161,7 +160,7 @@ class PathIndexResolverUnitTests {
|
||||
rand.physicalAttributes = new LinkedHashMap<>();
|
||||
rand.physicalAttributes.put("eye-color", "grey");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Person.class), rand);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Person.class), rand);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes)
|
||||
@@ -181,7 +180,7 @@ class PathIndexResolverUnitTests {
|
||||
|
||||
rand.relatives.put("father", janduin);
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Person.class), rand);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Person.class), rand);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes)
|
||||
@@ -197,7 +196,7 @@ class PathIndexResolverUnitTests {
|
||||
rand.physicalAttributes = new LinkedHashMap<>();
|
||||
rand.physicalAttributes.put("eye-color", null);
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Person.class), rand);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Person.class), rand);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes.iterator().next()).isInstanceOf(RemoveIndexedData.class);
|
||||
@@ -212,7 +211,7 @@ class PathIndexResolverUnitTests {
|
||||
rand.addressRef.country = "andor";
|
||||
|
||||
Set<IndexedData> indexes = indexResolver
|
||||
.resolveIndexesFor(ClassTypeInformation.from(PersonWithAddressReference.class), rand);
|
||||
.resolveIndexesFor(TypeInformation.of(PersonWithAddressReference.class), rand);
|
||||
|
||||
assertThat(indexes).isEmpty();
|
||||
}
|
||||
@@ -287,7 +286,7 @@ class PathIndexResolverUnitTests {
|
||||
TaVeren mat = new TaVeren();
|
||||
mat.feature = hat;
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TaVeren.class), mat);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TaVeren.class), mat);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes).contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "feature.type", "hat"));
|
||||
@@ -302,7 +301,7 @@ class PathIndexResolverUnitTests {
|
||||
TaVeren mat = new TaVeren();
|
||||
mat.feature = hat;
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TaVeren.class), mat);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TaVeren.class), mat);
|
||||
|
||||
assertThat(indexes).isEmpty();
|
||||
}
|
||||
@@ -318,7 +317,7 @@ class PathIndexResolverUnitTests {
|
||||
mat.characteristics.put("clothing", hat);
|
||||
mat.characteristics.put("gambling", "owns the dark one's luck");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TaVeren.class), mat);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TaVeren.class), mat);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes)
|
||||
@@ -336,7 +335,7 @@ class PathIndexResolverUnitTests {
|
||||
mat.items.add(hat);
|
||||
mat.items.add("foxhead medallion");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TaVeren.class), mat);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TaVeren.class), mat);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes).contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "items.type", "hat"));
|
||||
@@ -355,7 +354,7 @@ class PathIndexResolverUnitTests {
|
||||
mat.items.add(hat);
|
||||
mat.items.add("foxhead medallion");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(TaVeren.class), mat);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(TaVeren.class), mat);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
assertThat(indexes).contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "itemsType", "hat"));
|
||||
@@ -369,7 +368,7 @@ class PathIndexResolverUnitTests {
|
||||
size.length = 20;
|
||||
size.width = 30;
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(Size.class), size);
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(Size.class), size);
|
||||
assertThat(indexes).isEmpty();
|
||||
}
|
||||
|
||||
@@ -382,7 +381,7 @@ class PathIndexResolverUnitTests {
|
||||
source.values.put("jon", "snow");
|
||||
source.values.put("arya", "stark");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(IndexedOnMapField.class),
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnMapField.class),
|
||||
source);
|
||||
|
||||
assertThat(indexes).hasSize(2);
|
||||
@@ -400,7 +399,7 @@ class PathIndexResolverUnitTests {
|
||||
source.values.add("jon");
|
||||
source.values.add("arya");
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(IndexedOnListField.class),
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnListField.class),
|
||||
source);
|
||||
|
||||
assertThat(indexes).hasSize(2);
|
||||
@@ -415,7 +414,7 @@ class PathIndexResolverUnitTests {
|
||||
source.values = new int[] { 1, 2, 3 };
|
||||
|
||||
Set<IndexedData> indexes = indexResolver
|
||||
.resolveIndexesFor(ClassTypeInformation.from(IndexedOnPrimitiveArrayField.class), source);
|
||||
.resolveIndexesFor(TypeInformation.of(IndexedOnPrimitiveArrayField.class), source);
|
||||
|
||||
assertThat(indexes).hasSize(3);
|
||||
assertThat(indexes).contains(
|
||||
@@ -454,7 +453,7 @@ class PathIndexResolverUnitTests {
|
||||
GeoIndexedOnPoint source = new GeoIndexedOnPoint();
|
||||
source.location = new Point(1D, 2D);
|
||||
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(ClassTypeInformation.from(GeoIndexedOnPoint.class),
|
||||
Set<IndexedData> indexes = indexResolver.resolveIndexesFor(TypeInformation.of(GeoIndexedOnPoint.class),
|
||||
source);
|
||||
|
||||
assertThat(indexes).hasSize(1);
|
||||
@@ -469,7 +468,7 @@ class PathIndexResolverUnitTests {
|
||||
source.location = new double[] { 10D, 20D };
|
||||
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> indexResolver.resolveIndexesFor(ClassTypeInformation.from(GeoIndexedOnArray.class), source))
|
||||
.isThrownBy(() -> indexResolver.resolveIndexesFor(TypeInformation.of(GeoIndexedOnArray.class), source))
|
||||
.withMessageContaining("GeoIndexed property needs to be of type Point or GeoLocation");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.redis.core.index.IndexConfiguration;
|
||||
import org.springframework.data.redis.core.index.SpelIndexDefinition;
|
||||
import org.springframework.data.redis.core.mapping.RedisMappingContext;
|
||||
import org.springframework.data.redis.core.mapping.RedisPersistentEntity;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.expression.spel.SpelEvaluationException;
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ public class SpelIndexResolverUnitTests {
|
||||
|
||||
private Session session;
|
||||
|
||||
private ClassTypeInformation<?> typeInformation;
|
||||
private TypeInformation<?> typeInformation;
|
||||
|
||||
private String securityContextAttrName;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SpelIndexResolverUnitTests {
|
||||
indexName = "principalName";
|
||||
securityContextAttrName = "SPRING_SECURITY_CONTEXT";
|
||||
|
||||
typeInformation = ClassTypeInformation.from(Session.class);
|
||||
typeInformation = TypeInformation.of(Session.class);
|
||||
session = createSession();
|
||||
|
||||
resolver = createWithExpression("getAttribute('" + securityContextAttrName + "')?.authentication?.name");
|
||||
@@ -93,7 +93,7 @@ public class SpelIndexResolverUnitTests {
|
||||
@Test // DATAREDIS-425
|
||||
void wrongKeyspace() {
|
||||
|
||||
typeInformation = ClassTypeInformation.from(String.class);
|
||||
typeInformation = TypeInformation.of(String.class);
|
||||
Set<IndexedData> indexes = resolver.resolveIndexesFor(typeInformation, "");
|
||||
|
||||
assertThat(indexes.size()).isEqualTo(0);
|
||||
|
||||
Reference in New Issue
Block a user