DATACASS-440 - Remove support for JodaTime's deprecated DateMidnight.

Related ticket: DATACMNS-1014.
This commit is contained in:
Mark Paluch
2017-05-03 08:32:28 +02:00
parent 9679506278
commit fee427e46c
6 changed files with 1 additions and 56 deletions

View File

@@ -20,7 +20,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.joda.time.DateMidnight;
import org.joda.time.LocalDate;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.ClassUtils;
@@ -54,8 +53,6 @@ public abstract class CassandraJodaTimeConverters {
converters.add(CassandraLocalDateToLocalDateConverter.INSTANCE);
converters.add(LocalDateToCassandraLocalDateConverter.INSTANCE);
converters.add(CassandraLocalDateToDateMidnightConverter.INSTANCE);
converters.add(DateMidnightToCassandraLocalDateConverter.INSTANCE);
return converters;
}
@@ -92,39 +89,4 @@ public abstract class CassandraJodaTimeConverters {
source.getDayOfMonth());
}
}
/**
* Simple singleton to convert {@link com.datastax.driver.core.LocalDate}s to their {@link DateMidnight}
* representation.
*
* @author Mark Paluch
*/
public enum CassandraLocalDateToDateMidnightConverter
implements Converter<com.datastax.driver.core.LocalDate, DateMidnight> {
INSTANCE;
@Override
public DateMidnight convert(com.datastax.driver.core.LocalDate source) {
return new DateMidnight(source.getYear(), source.getMonth(), source.getDay());
}
}
/**
* Simple singleton to convert {@link DateMidnight}s to their {@link com.datastax.driver.core.LocalDate}
* representation.
*
* @author Mark Paluch
*/
public enum DateMidnightToCassandraLocalDateConverter
implements Converter<DateMidnight, com.datastax.driver.core.LocalDate> {
INSTANCE;
@Override
public com.datastax.driver.core.LocalDate convert(DateMidnight source) {
return com.datastax.driver.core.LocalDate.fromYearMonthDay(source.getYear(), source.getMonthOfYear(),
source.getDayOfMonth());
}
}
}

View File

@@ -533,18 +533,6 @@ public class CassandraTypeMappingIntegrationTest extends AbstractKeyspaceCreatin
assertThat(loaded.getJodaLocalDate()).isEqualTo(entity.getJodaLocalDate());
}
@Test // DATACASS-296
public void shouldReadAndWriteJodaDateMidnight() {
AllPossibleTypes entity = new AllPossibleTypes("1");
entity.setJodaDateMidnight(new org.joda.time.DateMidnight(2010, 7, 4));
operations.insert(entity);
AllPossibleTypes loaded = load(entity);
assertThat(loaded.getJodaDateMidnight()).isEqualTo(entity.getJodaDateMidnight());
}
@Test // DATACASS-296
public void shouldReadAndWriteJodaDateTime() {

View File

@@ -101,7 +101,6 @@ public class AllPossibleTypes {
org.joda.time.LocalDate jodaLocalDate;
org.joda.time.LocalDateTime jodaLocalDateTime;
org.joda.time.DateTime jodaDateTime;
org.joda.time.DateMidnight jodaDateMidnight;
org.threeten.bp.LocalDate bpLocalDate;
org.threeten.bp.LocalDateTime bpLocalDateTime;

View File

@@ -210,7 +210,6 @@ public class CreateTableSpecificationBasicCassandraMappingContextUnitTests {
assertThat(getColumnType("date", specification)).isEqualTo(DataType.date());
assertThat(getColumnType("localDate", specification)).isEqualTo(DataType.date());
assertThat(getColumnType("jodaLocalDate", specification)).isEqualTo(DataType.date());
assertThat(getColumnType("jodaDateMidnight", specification)).isEqualTo(DataType.date());
assertThat(getColumnType("bpLocalDate", specification)).isEqualTo(DataType.date());
}

View File

@@ -262,7 +262,7 @@ public class RepositoryReturnTypesIntegrationTests extends AbstractSpringDataEmb
allPossibleTypesRepository.save(entity);
Map<String, Object> result = allPossibleTypesRepository.findEntityAsMapById(entity.getId());
assertThat(result).hasSize(43);
assertThat(result).hasSize(42);
assertThat(result.get("primitiveinteger")).isEqualTo((Object) Integer.valueOf(123));
assertThat(result.get("biginteger")).isEqualTo((Object) BigInteger.ONE);
}

View File

@@ -106,9 +106,6 @@ for further details.
(Joda, Java 8, JSR310-BackPort)
| `timestamp`
| `DateMidnight` (Joda)
| `date`
| `ZoneId` (Java 8, JSR310-BackPort)
| `text`