diff --git a/pom.xml b/pom.xml index 14734d8f2..75ec427af 100644 --- a/pom.xml +++ b/pom.xml @@ -18,10 +18,9 @@ https://github.com/spring-projects/spring-data-elasticsearch - 2.6 7.12.1 - 2.13.3 - 4.1.52.Final + 2.14.1 + 4.1.65.Final 2.6.0-SNAPSHOT 1.15.3 1.0.6.RELEASE @@ -132,22 +131,6 @@ test - - - commons-lang - commons-lang - ${commonslang} - test - - - - - joda-time - joda-time - ${jodatime} - true - - org.elasticsearch.client diff --git a/src/main/java/org/springframework/data/elasticsearch/core/convert/DateTimeConverters.java b/src/main/java/org/springframework/data/elasticsearch/core/convert/DateTimeConverters.java deleted file mode 100644 index 48cd5ade1..000000000 --- a/src/main/java/org/springframework/data/elasticsearch/core/convert/DateTimeConverters.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2013-2021 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.elasticsearch.core.convert; - -import java.util.Date; - -import org.joda.time.DateTimeZone; -import org.joda.time.LocalDateTime; -import org.joda.time.ReadableInstant; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; -import org.springframework.core.convert.converter.Converter; - -/** - * DateTimeConverters - * - * @author Rizwan Idrees - * @author Mohsin Husen - */ -public final class DateTimeConverters { - - private static DateTimeFormatter formatter = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC); - - public enum JavaDateConverter implements Converter { - INSTANCE; - - @Override - public String convert(Date source) { - if (source == null) { - return null; - } - - return formatter.print(source.getTime()); - } - - } -} diff --git a/src/test/java/org/springframework/data/elasticsearch/config/ElasticsearchConfigurationSupportUnitTests.java b/src/test/java/org/springframework/data/elasticsearch/config/ElasticsearchConfigurationSupportUnitTests.java index b45a1da2b..75cf5812c 100644 --- a/src/test/java/org/springframework/data/elasticsearch/config/ElasticsearchConfigurationSupportUnitTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/config/ElasticsearchConfigurationSupportUnitTests.java @@ -18,19 +18,18 @@ package org.springframework.data.elasticsearch.config; import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; -import org.springframework.context.annotation.Bean; import reactor.core.publisher.Mono; import java.util.Collection; import java.util.Collections; -import org.apache.commons.lang.ClassUtils; import org.elasticsearch.Version; import org.elasticsearch.action.main.MainResponse; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.cluster.ClusterName; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.data.elasticsearch.annotations.Document; @@ -52,7 +51,7 @@ public class ElasticsearchConfigurationSupportUnitTests { public void usesConfigClassPackageAsBaseMappingPackage() throws ClassNotFoundException { ElasticsearchConfigurationSupport configuration = new StubConfig(); - assertThat(configuration.getMappingBasePackages()).contains(ClassUtils.getPackageName(StubConfig.class)); + assertThat(configuration.getMappingBasePackages()).contains(StubConfig.class.getPackage().getName()); assertThat(configuration.getInitialEntitySet()).contains(Entity.class); } diff --git a/src/test/java/org/springframework/data/elasticsearch/core/convert/DateTimeConvertersTests.java b/src/test/java/org/springframework/data/elasticsearch/core/convert/DateTimeConvertersTests.java deleted file mode 100644 index d7eb9a4b9..000000000 --- a/src/test/java/org/springframework/data/elasticsearch/core/convert/DateTimeConvertersTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2021 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.elasticsearch.core.convert; - -import static org.assertj.core.api.Assertions.*; - -import java.util.Calendar; -import java.util.TimeZone; - -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.joda.time.LocalDateTime; -import org.junit.jupiter.api.Test; - -/** - * @author Rizwan Idrees - * @author Mohsin Husen - */ -public class DateTimeConvertersTests { - - @Test - public void testJavaDateConverterWithNullValue() { - assertThat(DateTimeConverters.JavaDateConverter.INSTANCE.convert(null)).isNull(); - } - - @Test - public void testJavaDateConverter() { - DateTime dateTime = new DateTime(2013, 1, 24, 6, 35, 0, DateTimeZone.UTC); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeZone(TimeZone.getTimeZone("UTC")); - calendar.setTimeInMillis(dateTime.getMillis()); - - assertThat(DateTimeConverters.JavaDateConverter.INSTANCE.convert(calendar.getTime())) - .isEqualTo("2013-01-24T06:35:00.000Z"); - } -} diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/IndexBuilder.java b/src/test/java/org/springframework/data/elasticsearch/utils/IndexBuilder.java index f365581e6..2fabc53b2 100644 --- a/src/test/java/org/springframework/data/elasticsearch/utils/IndexBuilder.java +++ b/src/test/java/org/springframework/data/elasticsearch/utils/IndexBuilder.java @@ -2,17 +2,21 @@ package org.springframework.data.elasticsearch.utils; import java.lang.reflect.Field; -import org.apache.commons.lang.ArrayUtils; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.core.query.IndexQuery; /** * Created by akonczak on 02/12/2015. + * + * @author Peter-Josef Meisch */ public class IndexBuilder { public static IndexQuery buildIndex(Object object) { for (Field f : object.getClass().getDeclaredFields()) { - if (ArrayUtils.isNotEmpty(f.getAnnotationsByType(org.springframework.data.annotation.Id.class))) { + + if (AnnotationUtils.findAnnotation(f, Id.class) != null) { try { f.setAccessible(true); IndexQuery indexQuery = new IndexQuery();