committed by
mikereiche
parent
140c169799
commit
e4e2f466c0
@@ -29,7 +29,6 @@ import org.springframework.data.couchbase.core.mapping.CouchbaseList;
|
|||||||
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty;
|
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty;
|
||||||
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
|
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
|
||||||
import org.springframework.data.mapping.model.EntityInstantiators;
|
import org.springframework.data.mapping.model.EntityInstantiators;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,12 +162,12 @@ public abstract class AbstractCouchbaseConverter implements CouchbaseConverter,
|
|||||||
// superseded by EnumCvtrs value = Enum.class.isAssignableFrom(value.getClass()) ? ((Enum<?>) value).name() :
|
// superseded by EnumCvtrs value = Enum.class.isAssignableFrom(value.getClass()) ? ((Enum<?>) value).name() :
|
||||||
// value;
|
// value;
|
||||||
} else if (value instanceof Collection || elementType.isArray()) {
|
} else if (value instanceof Collection || elementType.isArray()) {
|
||||||
TypeInformation<?> type = ClassTypeInformation.from(value.getClass());
|
TypeInformation<?> type = TypeInformation.of(value.getClass());
|
||||||
value = ((MappingCouchbaseConverter) this).writeCollectionInternal(MappingCouchbaseConverter.asCollection(value),
|
value = ((MappingCouchbaseConverter) this).writeCollectionInternal(MappingCouchbaseConverter.asCollection(value),
|
||||||
new CouchbaseList(conversions.getSimpleTypeHolder()), type, null, null);
|
new CouchbaseList(conversions.getSimpleTypeHolder()), type, null, null);
|
||||||
} else {
|
} else {
|
||||||
CouchbaseDocument embeddedDoc = new CouchbaseDocument();
|
CouchbaseDocument embeddedDoc = new CouchbaseDocument();
|
||||||
TypeInformation<?> type = ClassTypeInformation.from(value.getClass());
|
TypeInformation<?> type = TypeInformation.of(value.getClass());
|
||||||
((MappingCouchbaseConverter) this).writeInternalRoot(value, embeddedDoc, type, false, null, true);
|
((MappingCouchbaseConverter) this).writeInternalRoot(value, embeddedDoc, type, false, null, true);
|
||||||
value = embeddedDoc;
|
value = embeddedDoc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ import org.springframework.data.mapping.model.PropertyValueProvider;
|
|||||||
import org.springframework.data.mapping.model.SpELContext;
|
import org.springframework.data.mapping.model.SpELContext;
|
||||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||||
import org.springframework.data.mapping.model.SpELExpressionParameterValueProvider;
|
import org.springframework.data.mapping.model.SpELExpressionParameterValueProvider;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
@@ -206,7 +205,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R> R read(final Class<R> clazz, final CouchbaseDocument source) {
|
public <R> R read(final Class<R> clazz, final CouchbaseDocument source) {
|
||||||
return read(ClassTypeInformation.from(clazz), source, null);
|
return read(TypeInformation.of(clazz), source, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -438,7 +437,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isCustom = conversions.getCustomWriteTarget(source.getClass(), CouchbaseDocument.class).isPresent();
|
boolean isCustom = conversions.getCustomWriteTarget(source.getClass(), CouchbaseDocument.class).isPresent();
|
||||||
TypeInformation<?> type = ClassTypeInformation.from(source.getClass());
|
TypeInformation<?> type = TypeInformation.of(source.getClass());
|
||||||
|
|
||||||
if (!isCustom) {
|
if (!isCustom) {
|
||||||
typeMapper.writeType(type, target);
|
typeMapper.writeType(type, target);
|
||||||
@@ -472,7 +471,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Map.class.isAssignableFrom(source.getClass())) {
|
if (Map.class.isAssignableFrom(source.getClass())) {
|
||||||
writeMapInternal((Map<Object, Object>) source, target, ClassTypeInformation.MAP, property);
|
writeMapInternal((Map<Object, Object>) source, target, TypeInformation.MAP, property);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +638,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name = prop.getFieldName();
|
String name = prop.getFieldName();
|
||||||
TypeInformation<?> valueType = ClassTypeInformation.from(source.getClass());
|
TypeInformation<?> valueType = TypeInformation.of(source.getClass());
|
||||||
TypeInformation<?> type = prop.getTypeInformation();
|
TypeInformation<?> type = prop.getTypeInformation();
|
||||||
if (valueType.isCollectionLike()) {
|
if (valueType.isCollectionLike()) {
|
||||||
CouchbaseList collectionDoc = createCollection(asCollection(source), valueType, prop, accessor);
|
CouchbaseList collectionDoc = createCollection(asCollection(source), valueType, prop, accessor);
|
||||||
@@ -968,7 +967,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter implem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (conversions.hasCustomReadTarget(value.getClass(), rawType)) {
|
if (conversions.hasCustomReadTarget(value.getClass(), rawType)) {
|
||||||
TypeInformation ti = ClassTypeInformation.from(value.getClass());
|
TypeInformation ti = TypeInformation.of(value.getClass());
|
||||||
return (R) conversionService.convert(value, ti.toTypeDescriptor(), new TypeDescriptor(prop.getField()));
|
return (R) conversionService.convert(value, ti.toTypeDescriptor(), new TypeDescriptor(prop.getField()));
|
||||||
}
|
}
|
||||||
if (value instanceof CouchbaseDocument) {
|
if (value instanceof CouchbaseDocument) {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
|
|||||||
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentEntity;
|
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentEntity;
|
||||||
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty;
|
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty;
|
||||||
import org.springframework.data.mapping.context.MappingContext;
|
import org.springframework.data.mapping.context.MappingContext;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ public interface QueryIndexResolver {
|
|||||||
* @see 2.2
|
* @see 2.2
|
||||||
*/
|
*/
|
||||||
default Iterable<? extends IndexDefinition> resolveIndexFor(Class<?> entityType) {
|
default Iterable<? extends IndexDefinition> resolveIndexFor(Class<?> entityType) {
|
||||||
return resolveIndexFor(ClassTypeInformation.from(entityType));
|
return resolveIndexFor(TypeInformation.of(entityType));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import org.springframework.data.couchbase.repository.support.MappingCouchbaseEnt
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.mapping.Alias;
|
import org.springframework.data.mapping.Alias;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -383,7 +382,7 @@ public class Query {
|
|||||||
.getRequiredPersistentEntity(domainClass);
|
.getRequiredPersistentEntity(domainClass);
|
||||||
MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity);
|
MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity);
|
||||||
String typeValue = info.getJavaType().getName();
|
String typeValue = info.getJavaType().getName();
|
||||||
TypeInformation<?> typeInfo = ClassTypeInformation.from(info.getJavaType());
|
TypeInformation<?> typeInfo = TypeInformation.of(info.getJavaType());
|
||||||
Alias alias = converter.getTypeAlias(typeInfo);
|
Alias alias = converter.getTypeAlias(typeInfo);
|
||||||
if (alias != null && alias.isPresent()) {
|
if (alias != null && alias.isPresent()) {
|
||||||
typeValue = alias.toString();
|
typeValue = alias.toString();
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.springframework.data.couchbase.repository.support.MappingCouchbaseEnt
|
|||||||
import org.springframework.data.mapping.Alias;
|
import org.springframework.data.mapping.Alias;
|
||||||
import org.springframework.data.repository.query.ParameterAccessor;
|
import org.springframework.data.repository.query.ParameterAccessor;
|
||||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
|
||||||
@@ -118,7 +117,7 @@ public class StringQuery extends Query {
|
|||||||
.getRequiredPersistentEntity(domainClass);
|
.getRequiredPersistentEntity(domainClass);
|
||||||
MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity);
|
MappingCouchbaseEntityInformation<?, Object> info = new MappingCouchbaseEntityInformation<>(persistentEntity);
|
||||||
String typeValue = info.getJavaType().getName();
|
String typeValue = info.getJavaType().getName();
|
||||||
TypeInformation<?> typeInfo = ClassTypeInformation.from(info.getJavaType());
|
TypeInformation<?> typeInfo = TypeInformation.of(info.getJavaType());
|
||||||
Alias alias = converter.getTypeAlias(typeInfo);
|
Alias alias = converter.getTypeAlias(typeInfo);
|
||||||
if (alias != null && alias.isPresent()) {
|
if (alias != null && alias.isPresent()) {
|
||||||
typeValue = alias.toString();
|
typeValue = alias.toString();
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import org.springframework.data.repository.query.ParametersParameterAccessor;
|
|||||||
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
|
||||||
import org.springframework.data.repository.query.RepositoryQuery;
|
import org.springframework.data.repository.query.RepositoryQuery;
|
||||||
import org.springframework.data.repository.query.ResultProcessor;
|
import org.springframework.data.repository.query.ResultProcessor;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
@@ -122,8 +121,8 @@ public abstract class AbstractCouchbaseQueryBase<CouchbaseOperationsType> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Object execute(ParametersParameterAccessor parameterAccessor) {
|
private Object execute(ParametersParameterAccessor parameterAccessor) {
|
||||||
TypeInformation<?> returnType = ClassTypeInformation
|
TypeInformation<?> returnType = TypeInformation
|
||||||
.from(method.getResultProcessor().getReturnedType().getReturnedType());
|
.of(method.getResultProcessor().getReturnedType().getReturnedType());
|
||||||
ResultProcessor processor = method.getResultProcessor().withDynamicProjection(parameterAccessor);
|
ResultProcessor processor = method.getResultProcessor().withDynamicProjection(parameterAccessor);
|
||||||
Class<?> typeToRead = processor.getReturnedType().getTypeToRead();
|
Class<?> typeToRead = processor.getReturnedType().getTypeToRead();
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.mock.env.MockPropertySource;
|
import org.springframework.mock.env.MockPropertySource;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||||
@@ -41,7 +41,7 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
@Test
|
@Test
|
||||||
void testNoExpiryByDefault() {
|
void testNoExpiryByDefault() {
|
||||||
CouchbasePersistentEntity<DefaultExpiry> entity = new BasicCouchbasePersistentEntity<>(
|
CouchbasePersistentEntity<DefaultExpiry> entity = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(DefaultExpiry.class));
|
TypeInformation.of(DefaultExpiry.class));
|
||||||
|
|
||||||
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(0);
|
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(0);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
@Test
|
@Test
|
||||||
void testDefaultExpiryUnitIsSeconds() {
|
void testDefaultExpiryUnitIsSeconds() {
|
||||||
CouchbasePersistentEntity<DefaultExpiryUnit> entity = new BasicCouchbasePersistentEntity<>(
|
CouchbasePersistentEntity<DefaultExpiryUnit> entity = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(DefaultExpiryUnit.class));
|
TypeInformation.of(DefaultExpiryUnit.class));
|
||||||
|
|
||||||
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(78);
|
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(78);
|
||||||
}
|
}
|
||||||
@@ -57,14 +57,14 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
@Test
|
@Test
|
||||||
void testLargeExpiry30DaysStillInSeconds() {
|
void testLargeExpiry30DaysStillInSeconds() {
|
||||||
CouchbasePersistentEntity<LimitDaysExpiry> entityUnder = new BasicCouchbasePersistentEntity<>(
|
CouchbasePersistentEntity<LimitDaysExpiry> entityUnder = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(LimitDaysExpiry.class));
|
TypeInformation.of(LimitDaysExpiry.class));
|
||||||
assertThat(entityUnder.getExpiryDuration().getSeconds()).isEqualTo(30 * 24 * 60 * 60);
|
assertThat(entityUnder.getExpiryDuration().getSeconds()).isEqualTo(30 * 24 * 60 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLargeExpiry31DaysIsConvertedToUnixUtcTime() {
|
void testLargeExpiry31DaysIsConvertedToUnixUtcTime() {
|
||||||
CouchbasePersistentEntity<OverLimitDaysExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
CouchbasePersistentEntity<OverLimitDaysExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(OverLimitDaysExpiry.class));
|
TypeInformation.of(OverLimitDaysExpiry.class));
|
||||||
|
|
||||||
int expiryOver = (int) entityOver.getExpiry();
|
int expiryOver = (int) entityOver.getExpiry();
|
||||||
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
@@ -84,7 +84,7 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
@Test
|
@Test
|
||||||
void testLargeExpiryExpression31DaysIsConvertedToUnixUtcTime() {
|
void testLargeExpiryExpression31DaysIsConvertedToUnixUtcTime() {
|
||||||
BasicCouchbasePersistentEntity<OverLimitDaysExpiryExpression> entityOver = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<OverLimitDaysExpiryExpression> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(OverLimitDaysExpiryExpression.class));
|
TypeInformation.of(OverLimitDaysExpiryExpression.class));
|
||||||
entityOver.setEnvironment(environment);
|
entityOver.setEnvironment(environment);
|
||||||
|
|
||||||
int expiryOver = (int) entityOver.getExpiry();
|
int expiryOver = (int) entityOver.getExpiry();
|
||||||
@@ -105,7 +105,7 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
@Test
|
@Test
|
||||||
void testLargeExpiry31DaysInSecondsIsConvertedToUnixUtcTime() {
|
void testLargeExpiry31DaysInSecondsIsConvertedToUnixUtcTime() {
|
||||||
CouchbasePersistentEntity<OverLimitSecondsExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
CouchbasePersistentEntity<OverLimitSecondsExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(OverLimitSecondsExpiry.class));
|
TypeInformation.of(OverLimitSecondsExpiry.class));
|
||||||
|
|
||||||
int expiryOver = (int) entityOver.getExpiry();
|
int expiryOver = (int) entityOver.getExpiry();
|
||||||
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
@@ -182,7 +182,7 @@ public class BasicCouchbasePersistentEntityTests {
|
|||||||
|
|
||||||
private BasicCouchbasePersistentEntity getBasicCouchbasePersistentEntity(Class<?> clazz) {
|
private BasicCouchbasePersistentEntity getBasicCouchbasePersistentEntity(Class<?> clazz) {
|
||||||
BasicCouchbasePersistentEntity basicCouchbasePersistentEntity = new BasicCouchbasePersistentEntity(
|
BasicCouchbasePersistentEntity basicCouchbasePersistentEntity = new BasicCouchbasePersistentEntity(
|
||||||
ClassTypeInformation.from(clazz));
|
TypeInformation.of(clazz));
|
||||||
basicCouchbasePersistentEntity.setEnvironment(environment);
|
basicCouchbasePersistentEntity.setEnvironment(environment);
|
||||||
return basicCouchbasePersistentEntity;
|
return basicCouchbasePersistentEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.springframework.data.mapping.MappingException;
|
|||||||
import org.springframework.data.mapping.model.Property;
|
import org.springframework.data.mapping.model.Property;
|
||||||
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
||||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +48,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
*/
|
*/
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
entity = new BasicCouchbasePersistentEntity<>(ClassTypeInformation.from(Beer.class));
|
entity = new BasicCouchbasePersistentEntity<>(TypeInformation.of(Beer.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +72,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
@Test
|
@Test
|
||||||
void testSdkIdAnnotationEvaluatedAfterSpringIdAnnotationIsIgnored() {
|
void testSdkIdAnnotationEvaluatedAfterSpringIdAnnotationIsIgnored() {
|
||||||
BasicCouchbasePersistentEntity<Beer> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<Beer> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(Beer.class));
|
TypeInformation.of(Beer.class));
|
||||||
Field springIdField = ReflectionUtils.findField(Beer.class, "springId");
|
Field springIdField = ReflectionUtils.findField(Beer.class, "springId");
|
||||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
@Id private String springId;
|
@Id private String springId;
|
||||||
}
|
}
|
||||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(TestIdField.class));
|
TypeInformation.of(TestIdField.class));
|
||||||
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
||||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||||
test.addPersistentProperty(springIdProperty);
|
test.addPersistentProperty(springIdProperty);
|
||||||
@@ -108,7 +108,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
||||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(TestIdField.class));
|
TypeInformation.of(TestIdField.class));
|
||||||
test.addPersistentProperty(idProperty);
|
test.addPersistentProperty(idProperty);
|
||||||
assertThat(test.getIdProperty()).isEqualTo(idProperty);
|
assertThat(test.getIdProperty()).isEqualTo(idProperty);
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
private String id;
|
private String id;
|
||||||
}
|
}
|
||||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(TestIdField.class));
|
TypeInformation.of(TestIdField.class));
|
||||||
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
||||||
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
||||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||||
@@ -148,7 +148,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(TestIdField.class));
|
TypeInformation.of(TestIdField.class));
|
||||||
test.addPersistentProperty(springIdProperty);
|
test.addPersistentProperty(springIdProperty);
|
||||||
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
||||||
test.addPersistentProperty(idProperty);
|
test.addPersistentProperty(idProperty);
|
||||||
@@ -168,7 +168,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||||
ClassTypeInformation.from(TestIdField.class));
|
TypeInformation.of(TestIdField.class));
|
||||||
test.addPersistentProperty(springIdProperty);
|
test.addPersistentProperty(springIdProperty);
|
||||||
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
||||||
test.addPersistentProperty(idProperty);
|
test.addPersistentProperty(idProperty);
|
||||||
@@ -183,7 +183,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
|||||||
*/
|
*/
|
||||||
private CouchbasePersistentProperty getPropertyFor(Field field) {
|
private CouchbasePersistentProperty getPropertyFor(Field field) {
|
||||||
|
|
||||||
ClassTypeInformation<?> type = ClassTypeInformation.from(field.getDeclaringClass());
|
TypeInformation<?> type = TypeInformation.of(field.getDeclaringClass());
|
||||||
|
|
||||||
return new BasicCouchbasePersistentProperty(Property.of(type, field), entity, SimpleTypeHolder.DEFAULT,
|
return new BasicCouchbasePersistentProperty(Property.of(type, field), entity, SimpleTypeHolder.DEFAULT,
|
||||||
PropertyNameFieldNamingStrategy.INSTANCE);
|
PropertyNameFieldNamingStrategy.INSTANCE);
|
||||||
|
|||||||
Reference in New Issue
Block a user