@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
@@ -43,7 +43,7 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
@Test
|
||||
void testNoExpiryByDefault() {
|
||||
CouchbasePersistentEntity<DefaultExpiry> entity = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(DefaultExpiry.class));
|
||||
TypeInformation.of(DefaultExpiry.class));
|
||||
|
||||
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(0);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
@Test
|
||||
void testDefaultExpiryUnitIsSeconds() {
|
||||
CouchbasePersistentEntity<DefaultExpiryUnit> entity = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(DefaultExpiryUnit.class));
|
||||
TypeInformation.of(DefaultExpiryUnit.class));
|
||||
|
||||
assertThat(entity.getExpiryDuration().getSeconds()).isEqualTo(78);
|
||||
}
|
||||
@@ -59,14 +59,14 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
@Test
|
||||
void testLargeExpiry30DaysStillInSeconds() {
|
||||
CouchbasePersistentEntity<LimitDaysExpiry> entityUnder = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(LimitDaysExpiry.class));
|
||||
TypeInformation.of(LimitDaysExpiry.class));
|
||||
assertThat(entityUnder.getExpiryDuration().getSeconds()).isEqualTo(30 * 24 * 60 * 60);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLargeExpiry31DaysIsConvertedToUnixUtcTime() {
|
||||
CouchbasePersistentEntity<OverLimitDaysExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(OverLimitDaysExpiry.class));
|
||||
TypeInformation.of(OverLimitDaysExpiry.class));
|
||||
|
||||
int expiryOver = (int) entityOver.getExpiry();
|
||||
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
@@ -86,7 +86,7 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
@Test
|
||||
void testLargeExpiryExpression31DaysIsConvertedToUnixUtcTime() {
|
||||
BasicCouchbasePersistentEntity<OverLimitDaysExpiryExpression> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(OverLimitDaysExpiryExpression.class));
|
||||
TypeInformation.of(OverLimitDaysExpiryExpression.class));
|
||||
entityOver.setEnvironment(environment);
|
||||
|
||||
int expiryOver = (int) entityOver.getExpiry();
|
||||
@@ -107,7 +107,7 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
@Test
|
||||
void testLargeExpiry31DaysInSecondsIsConvertedToUnixUtcTime() {
|
||||
CouchbasePersistentEntity<OverLimitSecondsExpiry> entityOver = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(OverLimitSecondsExpiry.class));
|
||||
TypeInformation.of(OverLimitSecondsExpiry.class));
|
||||
|
||||
int expiryOver = (int) entityOver.getExpiry();
|
||||
Calendar expected = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||
@@ -212,7 +212,7 @@ public class BasicCouchbasePersistentEntityTests {
|
||||
|
||||
private BasicCouchbasePersistentEntity getBasicCouchbasePersistentEntity(Class<?> clazz) {
|
||||
BasicCouchbasePersistentEntity basicCouchbasePersistentEntity = new BasicCouchbasePersistentEntity(
|
||||
ClassTypeInformation.from(clazz));
|
||||
TypeInformation.of(clazz));
|
||||
basicCouchbasePersistentEntity.setEnvironment(environment);
|
||||
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.PropertyNameFieldNamingStrategy;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
*/
|
||||
@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
|
||||
void testSdkIdAnnotationEvaluatedAfterSpringIdAnnotationIsIgnored() {
|
||||
BasicCouchbasePersistentEntity<Beer> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(Beer.class));
|
||||
TypeInformation.of(Beer.class));
|
||||
Field springIdField = ReflectionUtils.findField(Beer.class, "springId");
|
||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
@Id private String springId;
|
||||
}
|
||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(TestIdField.class));
|
||||
TypeInformation.of(TestIdField.class));
|
||||
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||
test.addPersistentProperty(springIdProperty);
|
||||
@@ -108,7 +108,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(TestIdField.class));
|
||||
TypeInformation.of(TestIdField.class));
|
||||
test.addPersistentProperty(idProperty);
|
||||
assertThat(test.getIdProperty()).isEqualTo(idProperty);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
private String id;
|
||||
}
|
||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(TestIdField.class));
|
||||
TypeInformation.of(TestIdField.class));
|
||||
Field springIdField = ReflectionUtils.findField(TestIdField.class, "springId");
|
||||
Field idField = ReflectionUtils.findField(TestIdField.class, "id");
|
||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||
@@ -148,7 +148,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(TestIdField.class));
|
||||
TypeInformation.of(TestIdField.class));
|
||||
test.addPersistentProperty(springIdProperty);
|
||||
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
||||
test.addPersistentProperty(idProperty);
|
||||
@@ -168,7 +168,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
CouchbasePersistentProperty idProperty = getPropertyFor(idField);
|
||||
CouchbasePersistentProperty springIdProperty = getPropertyFor(springIdField);
|
||||
BasicCouchbasePersistentEntity<TestIdField> test = new BasicCouchbasePersistentEntity<>(
|
||||
ClassTypeInformation.from(TestIdField.class));
|
||||
TypeInformation.of(TestIdField.class));
|
||||
test.addPersistentProperty(springIdProperty);
|
||||
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> {
|
||||
test.addPersistentProperty(idProperty);
|
||||
@@ -183,7 +183,7 @@ public class BasicCouchbasePersistentPropertyTests {
|
||||
*/
|
||||
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,
|
||||
PropertyNameFieldNamingStrategy.INSTANCE);
|
||||
|
||||
Reference in New Issue
Block a user