@ -222,6 +222,15 @@ public class MongoPersistentEntityIndexResolverUnitTests {
assertThat ( indexDefinitions . get ( 0 ) . getIndexOptions ( ) ) . containsEntry ( "expireAfterSeconds" , 600L ) ;
assertThat ( indexDefinitions . get ( 0 ) . getIndexOptions ( ) ) . containsEntry ( "expireAfterSeconds" , 600L ) ;
}
}
@Test // GH-4844
public void shouldResolveZeroTimeoutFromString ( ) {
List < IndexDefinitionHolder > indexDefinitions = prepareMappingContextAndResolveIndexForType (
WithExpireAfterZeroSecondsAsPlainString . class ) ;
assertThat ( indexDefinitions . get ( 0 ) . getIndexOptions ( ) ) . containsEntry ( "expireAfterSeconds" , 0L ) ;
}
@Test // DATAMONGO-2112
@Test // DATAMONGO-2112
public void shouldResolveTimeoutFromIso8601String ( ) {
public void shouldResolveTimeoutFromIso8601String ( ) {
@ -383,6 +392,11 @@ public class MongoPersistentEntityIndexResolverUnitTests {
@Indexed ( expireAfter = "10m" ) String withTimeout ;
@Indexed ( expireAfter = "10m" ) String withTimeout ;
}
}
@Document
class WithExpireAfterZeroSecondsAsPlainString {
@Indexed ( expireAfter = "0s" ) String withTimeout ;
}
@Document
@Document
class WithIso8601Style {
class WithIso8601Style {
@Indexed ( expireAfter = "P1D" ) String withTimeout ;
@Indexed ( expireAfter = "P1D" ) String withTimeout ;