committed by
GitHub
parent
5c862e80bf
commit
bd047776e2
@@ -99,6 +99,6 @@ public class CriteriaQueryMappingTests {
|
||||
@Field(name = "first-name") String firstName;
|
||||
@Field(name = "last-name") String lastName;
|
||||
@Field(name = "birth-date", type = FieldType.Date, format = DateFormat.custom,
|
||||
pattern = "dd.MM.yyyy") LocalDate birthDate;
|
||||
pattern = "dd.MM.uuuu") LocalDate birthDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ElasticsearchDateConverterTests {
|
||||
if (dateFormat == DateFormat.none) {
|
||||
return;
|
||||
}
|
||||
String pattern = (dateFormat != DateFormat.custom) ? dateFormat.name() : "dd.MM.yyyy";
|
||||
String pattern = (dateFormat != DateFormat.custom) ? dateFormat.name() : "dd.MM.uuuu";
|
||||
|
||||
ElasticsearchDateConverter converter = ElasticsearchDateConverter.of(pattern);
|
||||
|
||||
|
||||
@@ -643,7 +643,7 @@ public class MappingElasticsearchConverterUnitTests {
|
||||
@Field(name = "first-name") String firstName;
|
||||
@Field(name = "last-name") String lastName;
|
||||
@Field(name = "birth-date", type = FieldType.Date, format = DateFormat.custom,
|
||||
pattern = "dd.MM.yyyy") LocalDate birthDate;
|
||||
pattern = "dd.MM.uuuu") LocalDate birthDate;
|
||||
Gender gender;
|
||||
Address address;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -39,7 +40,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||
public class SimpleElasticsearchDateMappingTests extends MappingContextBaseTests {
|
||||
|
||||
private static final String EXPECTED_MAPPING = "{\"properties\":{\"message\":{\"store\":true,"
|
||||
+ "\"type\":\"text\",\"index\":false,\"analyzer\":\"standard\"},\"customFormatDate\":{\"type\":\"date\",\"format\":\"dd.MM.yyyy hh:mm\"},"
|
||||
+ "\"type\":\"text\",\"index\":false,\"analyzer\":\"standard\"},\"customFormatDate\":{\"type\":\"date\",\"format\":\"dd.MM.uuuu hh:mm\"},"
|
||||
+ "\"defaultFormatDate\":{\"type\":\"date\"},\"basicFormatDate\":{\""
|
||||
+ "type\":\"date\",\"format\":\"basic_date\"}}}";
|
||||
|
||||
@@ -64,10 +65,10 @@ public class SimpleElasticsearchDateMappingTests extends MappingContextBaseTests
|
||||
@Field(type = Text, index = false, store = true, analyzer = "standard") private String message;
|
||||
|
||||
@Field(type = Date, format = DateFormat.custom,
|
||||
pattern = "dd.MM.yyyy hh:mm") private java.util.Date customFormatDate;
|
||||
pattern = "dd.MM.uuuu hh:mm") private LocalDateTime customFormatDate;
|
||||
|
||||
@Field(type = FieldType.Date) private Date defaultFormatDate;
|
||||
@Field(type = FieldType.Date) private LocalDateTime defaultFormatDate;
|
||||
|
||||
@Field(type = FieldType.Date, format = DateFormat.basic_date) private Date basicFormatDate;
|
||||
@Field(type = FieldType.Date, format = DateFormat.basic_date) private LocalDateTime basicFormatDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SimpleElasticsearchPersistentPropertyUnitTests {
|
||||
|
||||
static class DatesProperty {
|
||||
@Field(type = FieldType.Date, format = DateFormat.basic_date) Date date;
|
||||
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd.MM.yyyy") LocalDate localDate;
|
||||
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "dd.MM.uuuu") LocalDate localDate;
|
||||
@Field(type = FieldType.Date, format = DateFormat.basic_date_time) LocalDateTime localDateTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user