diff --git a/CHANGELOG.md b/CHANGELOG.md index b243bd45..88c66cb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,4 +28,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * Refactor LifecycleComponent package path ([#377](https://github.com/opensearch-project/geospatial/pull/377)) * [Refactor] Strings utility methods to core library ([#379](https://github.com/opensearch-project/geospatial/pull/379)) * Fixed compilation errors after refactoring in core foundation classes ([#380](https://github.com/opensearch-project/geospatial/pull/380)) +* Update spotless from 5.6.1 to 6.21.0([#400](https://github.com/opensearch-project/geospatial/pull/400)) ### Refactoring diff --git a/build.gradle b/build.gradle index ca35448a..fce620ec 100644 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,7 @@ buildscript { dependencies { classpath "${opensearch_group}.gradle:build-tools:${opensearch_version}" - classpath "com.diffplug.spotless:spotless-plugin-gradle:5.6.1" + classpath "com.diffplug.spotless:spotless-plugin-gradle:6.21.0" classpath "io.freefair.gradle:lombok-plugin:6.4.3" } } @@ -158,7 +158,7 @@ dependencies { yamlRestTestRuntimeOnly "org.apache.logging.log4j:log4j-core:${versions.log4j}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" testImplementation 'org.json:json:20230227' - implementation "org.apache.commons:commons-lang3:3.12.0" + implementation "org.apache.commons:commons-lang3:3.13.0" implementation "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}" implementation "org.locationtech.jts:jts-core:${versions.jts}" implementation "org.apache.commons:commons-csv:1.10.0" diff --git a/src/main/java/org/opensearch/geospatial/action/upload/geojson/IndexManager.java b/src/main/java/org/opensearch/geospatial/action/upload/geojson/IndexManager.java index 9fc02bac..b8bba9db 100644 --- a/src/main/java/org/opensearch/geospatial/action/upload/geojson/IndexManager.java +++ b/src/main/java/org/opensearch/geospatial/action/upload/geojson/IndexManager.java @@ -8,9 +8,6 @@ import java.io.IOException; import java.util.Map; -import lombok.AllArgsConstructor; -import lombok.NonNull; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.action.StepListener; @@ -20,6 +17,9 @@ import org.opensearch.core.action.ActionListener; import org.opensearch.core.xcontent.XContentBuilder; +import lombok.AllArgsConstructor; +import lombok.NonNull; + /** * IndexManager is responsible for managing index operations like create, delete, etc... */ diff --git a/src/main/java/org/opensearch/geospatial/action/upload/geojson/PipelineManager.java b/src/main/java/org/opensearch/geospatial/action/upload/geojson/PipelineManager.java index dc98823c..e5ff71bf 100644 --- a/src/main/java/org/opensearch/geospatial/action/upload/geojson/PipelineManager.java +++ b/src/main/java/org/opensearch/geospatial/action/upload/geojson/PipelineManager.java @@ -8,10 +8,6 @@ import java.io.IOException; import java.util.function.Supplier; -import lombok.AllArgsConstructor; -import lombok.NonNull; -import lombok.extern.log4j.Log4j2; - import org.opensearch.action.StepListener; import org.opensearch.action.ingest.DeletePipelineRequest; import org.opensearch.action.ingest.PutPipelineRequest; @@ -25,6 +21,10 @@ import org.opensearch.geospatial.processor.FeatureProcessor; import org.opensearch.ingest.Pipeline; +import lombok.AllArgsConstructor; +import lombok.NonNull; +import lombok.extern.log4j.Log4j2; + /** * PipelineManager is responsible for managing pipeline operations like create and delete */ diff --git a/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequest.java b/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequest.java index fc05a2ae..db928136 100644 --- a/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequest.java +++ b/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequest.java @@ -14,10 +14,6 @@ import java.io.IOException; import java.util.Objects; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NonNull; - import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.core.common.bytes.BytesReference; @@ -25,6 +21,10 @@ import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.rest.RestRequest; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NonNull; + @AllArgsConstructor @Getter public class UploadGeoJSONRequest extends ActionRequest { diff --git a/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequestContent.java b/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequestContent.java index eae60881..adddc4bf 100644 --- a/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequestContent.java +++ b/src/main/java/org/opensearch/geospatial/action/upload/geojson/UploadGeoJSONRequestContent.java @@ -12,13 +12,13 @@ import java.util.Map; import java.util.Objects; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; - import org.opensearch.core.ParseField; import org.opensearch.core.common.Strings; import org.opensearch.geospatial.GeospatialParser; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; + /** * UploadGeoJSONRequestContent is the Data model for UploadGeoJSONRequest's body */ diff --git a/src/main/java/org/opensearch/geospatial/geojson/FeatureCollection.java b/src/main/java/org/opensearch/geospatial/geojson/FeatureCollection.java index 1e7cf426..7afcfdcb 100644 --- a/src/main/java/org/opensearch/geospatial/geojson/FeatureCollection.java +++ b/src/main/java/org/opensearch/geospatial/geojson/FeatureCollection.java @@ -9,11 +9,11 @@ import java.util.List; import java.util.Map; +import org.opensearch.geospatial.GeospatialParser; + import lombok.NonNull; import lombok.Value; -import org.opensearch.geospatial.GeospatialParser; - /** * FeatureCollection represents GEOJSON of type FeatureCollection. A FeatureCollection object has a member * with the name "features". The value of "features" is a List. diff --git a/src/main/java/org/opensearch/geospatial/geojson/FeatureFactory.java b/src/main/java/org/opensearch/geospatial/geojson/FeatureFactory.java index a7eddcb0..4da2d5d7 100644 --- a/src/main/java/org/opensearch/geospatial/geojson/FeatureFactory.java +++ b/src/main/java/org/opensearch/geospatial/geojson/FeatureFactory.java @@ -10,10 +10,10 @@ import java.util.Map; -import lombok.NonNull; - import org.opensearch.geospatial.geojson.Feature.FeatureBuilder; +import lombok.NonNull; + /** * FeatureFactory helps to create {@link Feature} instance based on user input */ diff --git a/src/main/java/org/opensearch/geospatial/index/common/xyshape/XYShapeConverter.java b/src/main/java/org/opensearch/geospatial/index/common/xyshape/XYShapeConverter.java index 10bff8cf..b38b088e 100644 --- a/src/main/java/org/opensearch/geospatial/index/common/xyshape/XYShapeConverter.java +++ b/src/main/java/org/opensearch/geospatial/index/common/xyshape/XYShapeConverter.java @@ -11,10 +11,6 @@ import java.util.stream.DoubleStream; import java.util.stream.IntStream; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; - import org.apache.lucene.geo.XYCircle; import org.apache.lucene.geo.XYLine; import org.apache.lucene.geo.XYPoint; @@ -26,6 +22,10 @@ import org.opensearch.geometry.Polygon; import org.opensearch.geometry.Rectangle; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.NonNull; + /** * Utility class to convert compatible shapes from opensearch to Lucene */ diff --git a/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPoint.java b/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPoint.java index 6b771271..262849f7 100644 --- a/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPoint.java +++ b/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPoint.java @@ -11,10 +11,6 @@ import java.util.Locale; import java.util.Objects; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - import org.opensearch.OpenSearchParseException; import org.opensearch.core.xcontent.ToXContentFragment; import org.opensearch.core.xcontent.XContentBuilder; @@ -25,6 +21,10 @@ import org.opensearch.geometry.utils.WellKnownText; import org.opensearch.index.mapper.AbstractPointGeometryFieldMapper; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + /** * Represents a point in a 2-dimensional planar coordinate system with no range limitations. */ diff --git a/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPointIndexer.java b/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPointIndexer.java index 744e0726..08ef7f02 100644 --- a/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPointIndexer.java +++ b/src/main/java/org/opensearch/geospatial/index/mapper/xypoint/XYPointIndexer.java @@ -9,8 +9,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import lombok.AllArgsConstructor; - import org.apache.lucene.document.XYPointField; import org.apache.lucene.geo.XYPoint; import org.apache.lucene.index.IndexableField; @@ -19,6 +17,8 @@ import org.opensearch.index.mapper.AbstractGeometryFieldMapper; import org.opensearch.index.mapper.ParseContext; +import lombok.AllArgsConstructor; + /** * Converts points into Lucene-compatible form{@link XYPoint} for indexing in a xy_point field. */ diff --git a/src/main/java/org/opensearch/geospatial/index/query/xypoint/XYPointQueryVisitor.java b/src/main/java/org/opensearch/geospatial/index/query/xypoint/XYPointQueryVisitor.java index ed30fd3b..df9d9eae 100644 --- a/src/main/java/org/opensearch/geospatial/index/query/xypoint/XYPointQueryVisitor.java +++ b/src/main/java/org/opensearch/geospatial/index/query/xypoint/XYPointQueryVisitor.java @@ -13,8 +13,6 @@ import java.util.Locale; import java.util.Objects; -import lombok.AllArgsConstructor; - import org.apache.lucene.document.XYDocValuesField; import org.apache.lucene.document.XYPointField; import org.apache.lucene.geo.XYCircle; @@ -42,6 +40,8 @@ import org.opensearch.index.query.QueryShardContext; import org.opensearch.index.query.QueryShardException; +import lombok.AllArgsConstructor; + /** * Geometry Visitor to create a query to find all cartesian XYPoints * that comply ShapeRelation with all other XYShapes objects diff --git a/src/main/java/org/opensearch/geospatial/index/query/xyshape/XYShapeQueryProcessor.java b/src/main/java/org/opensearch/geospatial/index/query/xyshape/XYShapeQueryProcessor.java index fc3f1e52..cc95b59f 100644 --- a/src/main/java/org/opensearch/geospatial/index/query/xyshape/XYShapeQueryProcessor.java +++ b/src/main/java/org/opensearch/geospatial/index/query/xyshape/XYShapeQueryProcessor.java @@ -8,8 +8,6 @@ import java.util.List; import java.util.Locale; -import lombok.NonNull; - import org.apache.lucene.document.ShapeField; import org.apache.lucene.document.XYShape; import org.apache.lucene.geo.XYGeometry; @@ -23,6 +21,8 @@ import org.opensearch.index.query.QueryShardContext; import org.opensearch.index.query.QueryShardException; +import lombok.NonNull; + /** * Query Processor to convert given Geometry into Lucene query */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequest.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequest.java index 80a8ad65..35a106de 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequest.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequest.java @@ -7,16 +7,16 @@ import java.io.IOException; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.geospatial.ip2geo.common.ParameterValidator; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + /** * GeoIP datasource delete request */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportAction.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportAction.java index cfd12ba3..d183b264 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportAction.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportAction.java @@ -7,8 +7,6 @@ import java.io.IOException; -import lombok.extern.log4j.Log4j2; - import org.opensearch.ResourceNotFoundException; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.HandledTransportAction; @@ -29,6 +27,8 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportService; +import lombok.extern.log4j.Log4j2; + /** * Transport action to delete datasource */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceRequest.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceRequest.java index 3cf94e55..34d72c58 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceRequest.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceRequest.java @@ -7,14 +7,14 @@ import java.io.IOException; -import lombok.Getter; -import lombok.Setter; - import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; +import lombok.Getter; +import lombok.Setter; + /** * Ip2Geo datasource get request */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceResponse.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceResponse.java index 03e6ec48..cab60553 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceResponse.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/GetDatasourceResponse.java @@ -9,10 +9,6 @@ import java.time.Instant; import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - import org.opensearch.core.ParseField; import org.opensearch.core.action.ActionResponse; import org.opensearch.core.common.io.stream.StreamInput; @@ -21,6 +17,10 @@ import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.geospatial.ip2geo.jobscheduler.Datasource; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + /** * Ip2Geo datasource get request */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceRequest.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceRequest.java index ddc83942..42072d6c 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceRequest.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceRequest.java @@ -12,10 +12,6 @@ import java.util.List; import java.util.Locale; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.log4j.Log4j2; - import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.unit.TimeValue; @@ -26,6 +22,10 @@ import org.opensearch.geospatial.ip2geo.common.DatasourceManifest; import org.opensearch.geospatial.ip2geo.common.ParameterValidator; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.log4j.Log4j2; + /** * Ip2Geo datasource creation request */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportAction.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportAction.java index 21440086..bb55d411 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportAction.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportAction.java @@ -10,8 +10,6 @@ import java.time.Instant; import java.util.concurrent.atomic.AtomicReference; -import lombok.extern.log4j.Log4j2; - import org.opensearch.ResourceAlreadyExistsException; import org.opensearch.action.StepListener; import org.opensearch.action.index.IndexResponse; @@ -33,6 +31,8 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportService; +import lombok.extern.log4j.Log4j2; + /** * Transport action to create datasource */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequest.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequest.java index 1d71bbbd..64d3deb0 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequest.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequest.java @@ -11,11 +11,6 @@ import java.net.URL; import java.util.Locale; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.log4j.Log4j2; - import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.unit.TimeValue; @@ -26,6 +21,11 @@ import org.opensearch.geospatial.ip2geo.common.DatasourceManifest; import org.opensearch.geospatial.ip2geo.common.ParameterValidator; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.log4j.Log4j2; + /** * Ip2Geo datasource update request */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportAction.java b/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportAction.java index e848a840..f60df625 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportAction.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportAction.java @@ -13,8 +13,6 @@ import java.util.List; import java.util.Locale; -import lombok.extern.log4j.Log4j2; - import org.opensearch.ResourceNotFoundException; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.HandledTransportAction; @@ -35,6 +33,8 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportService; +import lombok.extern.log4j.Log4j2; + /** * Transport action to update datasource */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifest.java b/src/main/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifest.java index 5382aa56..541906c1 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifest.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifest.java @@ -14,10 +14,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - import org.opensearch.SpecialPermission; import org.opensearch.common.SuppressForbidden; import org.opensearch.common.xcontent.json.JsonXContent; @@ -29,6 +25,10 @@ import org.opensearch.geospatial.annotation.VisibleForTesting; import org.opensearch.geospatial.shared.Constants; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + /** * Ip2Geo datasource manifest file object * diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/common/Ip2GeoLockService.java b/src/main/java/org/opensearch/geospatial/ip2geo/common/Ip2GeoLockService.java index f422caf8..89174f95 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/common/Ip2GeoLockService.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/common/Ip2GeoLockService.java @@ -13,8 +13,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import lombok.extern.log4j.Log4j2; - import org.opensearch.OpenSearchException; import org.opensearch.client.Client; import org.opensearch.cluster.service.ClusterService; @@ -22,6 +20,8 @@ import org.opensearch.jobscheduler.spi.LockModel; import org.opensearch.jobscheduler.spi.utils.LockService; +import lombok.extern.log4j.Log4j2; + /** * A wrapper of job scheduler's lock service for datasource */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDao.java b/src/main/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDao.java index a1230c69..24b75535 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDao.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDao.java @@ -16,8 +16,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import lombok.extern.log4j.Log4j2; - import org.opensearch.OpenSearchException; import org.opensearch.ResourceAlreadyExistsException; import org.opensearch.ResourceNotFoundException; @@ -57,6 +55,8 @@ import org.opensearch.index.query.QueryBuilders; import org.opensearch.search.SearchHit; +import lombok.extern.log4j.Log4j2; + /** * Data access object for datasource */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDao.java b/src/main/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDao.java index 47774b90..1c4627a4 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDao.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDao.java @@ -29,9 +29,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import lombok.NonNull; -import lombok.extern.log4j.Log4j2; - import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -65,6 +62,9 @@ import org.opensearch.geospatial.shared.StashedThreadContext; import org.opensearch.index.query.QueryBuilders; +import lombok.NonNull; +import lombok.extern.log4j.Log4j2; + /** * Data access object for GeoIp data */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java b/src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java index 8c2e686d..9f229377 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDao.java @@ -13,11 +13,6 @@ import java.util.concurrent.ExecutionException; import java.util.function.Function; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.extern.log4j.Log4j2; - import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.cache.Cache; import org.opensearch.common.cache.CacheBuilder; @@ -34,6 +29,11 @@ import org.opensearch.index.engine.Engine; import org.opensearch.index.shard.IndexingOperationListener; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.extern.log4j.Log4j2; + /** * Data access object for Datasource and GeoIP data with added caching layer * diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/Datasource.java b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/Datasource.java index 551c2a79..95343025 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/Datasource.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/Datasource.java @@ -14,14 +14,6 @@ import java.util.Locale; import java.util.Set; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - import org.opensearch.core.ParseField; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; @@ -38,6 +30,14 @@ import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; import org.opensearch.jobscheduler.spi.schedule.ScheduleParser; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + /** * Ip2Geo datasource job parameter */ diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunner.java b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunner.java index fe4aa36b..93ca317a 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunner.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunner.java @@ -11,8 +11,6 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; -import lombok.extern.log4j.Log4j2; - import org.opensearch.cluster.service.ClusterService; import org.opensearch.geospatial.annotation.VisibleForTesting; import org.opensearch.geospatial.ip2geo.common.DatasourceState; @@ -25,6 +23,8 @@ import org.opensearch.jobscheduler.spi.ScheduledJobRunner; import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; +import lombok.extern.log4j.Log4j2; + /** * Datasource update task * diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateService.java b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateService.java index 2abf8a79..97a5ae7b 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateService.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateService.java @@ -15,8 +15,6 @@ import java.util.UUID; import java.util.stream.Collectors; -import lombok.extern.log4j.Log4j2; - import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; import org.opensearch.OpenSearchException; @@ -29,6 +27,8 @@ import org.opensearch.geospatial.ip2geo.dao.GeoIpDataDao; import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; +import lombok.extern.log4j.Log4j2; + @Log4j2 public class DatasourceUpdateService { private static final int SLEEP_TIME_IN_MILLIS = 5000; // 5 seconds diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/listener/Ip2GeoListener.java b/src/main/java/org/opensearch/geospatial/ip2geo/listener/Ip2GeoListener.java index 19e1968a..791bb1fc 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/listener/Ip2GeoListener.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/listener/Ip2GeoListener.java @@ -13,9 +13,6 @@ import java.util.List; import java.util.stream.Collectors; -import lombok.AllArgsConstructor; -import lombok.extern.log4j.Log4j2; - import org.opensearch.action.bulk.BulkResponse; import org.opensearch.cluster.ClusterChangedEvent; import org.opensearch.cluster.ClusterStateListener; @@ -33,6 +30,9 @@ import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; import org.opensearch.threadpool.ThreadPool; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; + @Log4j2 @AllArgsConstructor(onConstructor = @__(@Inject)) public class Ip2GeoListener extends AbstractLifecycleComponent implements ClusterStateListener { diff --git a/src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java b/src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java index 72f07db0..03f90e88 100644 --- a/src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java +++ b/src/main/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessor.java @@ -18,9 +18,6 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; -import lombok.Getter; -import lombok.extern.log4j.Log4j2; - import org.opensearch.common.settings.ClusterSettings; import org.opensearch.geospatial.ip2geo.common.DatasourceState; import org.opensearch.geospatial.ip2geo.common.ParameterValidator; @@ -32,6 +29,9 @@ import org.opensearch.ingest.IngestService; import org.opensearch.ingest.Processor; +import lombok.Getter; +import lombok.extern.log4j.Log4j2; + /** * Ip2Geo processor */ diff --git a/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java b/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java index e38e846d..703c1952 100644 --- a/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java +++ b/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java @@ -13,8 +13,6 @@ import java.util.Map; import java.util.function.Supplier; -import lombok.extern.log4j.Log4j2; - import org.opensearch.action.ActionRequest; import org.opensearch.client.Client; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; @@ -88,6 +86,8 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.watcher.ResourceWatcherService; +import lombok.extern.log4j.Log4j2; + /** * Entry point for Geospatial features. It provides additional Processors, Actions * to interact with Cluster. diff --git a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java index e22d8f3a..c556f3f9 100644 --- a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java +++ b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexHelper.java @@ -14,10 +14,10 @@ import java.util.Locale; -import lombok.NonNull; - import org.opensearch.common.geo.GeoPoint; +import lombok.NonNull; + /** * Helper class for H3 library */ diff --git a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGrid.java b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGrid.java index cb74dba0..e7231c22 100644 --- a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGrid.java +++ b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGrid.java @@ -7,12 +7,12 @@ import java.io.IOException; -import lombok.NoArgsConstructor; - import org.opensearch.core.xcontent.ObjectParser; import org.opensearch.core.xcontent.XContentParser; import org.opensearch.geo.search.aggregations.bucket.geogrid.ParsedGeoGrid; +import lombok.NoArgsConstructor; + @NoArgsConstructor public class ParsedGeoHexGrid extends ParsedGeoGrid { private static final ObjectParser PARSER = createParser( diff --git a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGridBucket.java b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGridBucket.java index 8fc885cb..6ddb0734 100644 --- a/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGridBucket.java +++ b/src/main/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/ParsedGeoHexGridBucket.java @@ -7,12 +7,12 @@ import java.io.IOException; -import lombok.NoArgsConstructor; - import org.opensearch.common.geo.GeoPoint; import org.opensearch.core.xcontent.XContentParser; import org.opensearch.geo.search.aggregations.bucket.geogrid.ParsedGeoGridBucket; +import lombok.NoArgsConstructor; + @NoArgsConstructor public class ParsedGeoHexGridBucket extends ParsedGeoGridBucket { diff --git a/src/main/java/org/opensearch/geospatial/stats/upload/UploadMetric.java b/src/main/java/org/opensearch/geospatial/stats/upload/UploadMetric.java index 9f8b8e58..b9deeb79 100644 --- a/src/main/java/org/opensearch/geospatial/stats/upload/UploadMetric.java +++ b/src/main/java/org/opensearch/geospatial/stats/upload/UploadMetric.java @@ -9,8 +9,6 @@ import java.util.Locale; import java.util.Objects; -import lombok.Getter; - import org.opensearch.core.common.Strings; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; @@ -18,6 +16,8 @@ import org.opensearch.core.xcontent.ToXContentFragment; import org.opensearch.core.xcontent.XContentBuilder; +import lombok.Getter; + /** * UploadMetric stores metric for an upload API */ diff --git a/src/test/java/org/opensearch/geospatial/exceptions/ConcurrentModificationExceptionTests.java b/src/test/java/org/opensearch/geospatial/exceptions/ConcurrentModificationExceptionTests.java index ef57b94f..caaf6e89 100644 --- a/src/test/java/org/opensearch/geospatial/exceptions/ConcurrentModificationExceptionTests.java +++ b/src/test/java/org/opensearch/geospatial/exceptions/ConcurrentModificationExceptionTests.java @@ -5,13 +5,13 @@ package org.opensearch.geospatial.exceptions; -import lombok.SneakyThrows; - import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.BytesStreamInput; import org.opensearch.core.rest.RestStatus; import org.opensearch.test.OpenSearchTestCase; +import lombok.SneakyThrows; + public class ConcurrentModificationExceptionTests extends OpenSearchTestCase { public void testConstructor_whenCreated_thenSucceed() { ConcurrentModificationException exception = new ConcurrentModificationException("Resource is being modified by another processor"); diff --git a/src/test/java/org/opensearch/geospatial/exceptions/IncompatibleDatasourceExceptionTests.java b/src/test/java/org/opensearch/geospatial/exceptions/IncompatibleDatasourceExceptionTests.java index 69d026a7..009cc1a1 100644 --- a/src/test/java/org/opensearch/geospatial/exceptions/IncompatibleDatasourceExceptionTests.java +++ b/src/test/java/org/opensearch/geospatial/exceptions/IncompatibleDatasourceExceptionTests.java @@ -5,13 +5,13 @@ package org.opensearch.geospatial.exceptions; -import lombok.SneakyThrows; - import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.BytesStreamInput; import org.opensearch.core.rest.RestStatus; import org.opensearch.test.OpenSearchTestCase; +import lombok.SneakyThrows; + public class IncompatibleDatasourceExceptionTests extends OpenSearchTestCase { public void testConstructor_whenCreated_thenSucceed() { IncompatibleDatasourceException exception = new IncompatibleDatasourceException( diff --git a/src/test/java/org/opensearch/geospatial/exceptions/ResourceInUseExceptionTests.java b/src/test/java/org/opensearch/geospatial/exceptions/ResourceInUseExceptionTests.java index f63cdbc0..139566b0 100644 --- a/src/test/java/org/opensearch/geospatial/exceptions/ResourceInUseExceptionTests.java +++ b/src/test/java/org/opensearch/geospatial/exceptions/ResourceInUseExceptionTests.java @@ -5,13 +5,13 @@ package org.opensearch.geospatial.exceptions; -import lombok.SneakyThrows; - import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.BytesStreamInput; import org.opensearch.core.rest.RestStatus; import org.opensearch.test.OpenSearchTestCase; +import lombok.SneakyThrows; + public class ResourceInUseExceptionTests extends OpenSearchTestCase { public void testConstructor_whenCreated_thenSucceed() { ResourceInUseException exception = new ResourceInUseException("Resource is in use"); diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoDataServer.java b/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoDataServer.java index 459ef46e..2058ff75 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoDataServer.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoDataServer.java @@ -11,15 +11,15 @@ import java.nio.file.Files; import java.nio.file.Paths; -import lombok.SneakyThrows; -import lombok.extern.log4j.Log4j2; - import org.opensearch.common.SuppressForbidden; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import lombok.SneakyThrows; +import lombok.extern.log4j.Log4j2; + /** * Simple http server to serve static files under test/java/resources/ip2geo/server for integration testing */ diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoTestCase.java b/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoTestCase.java index b70b3f03..9e0b5133 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoTestCase.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/Ip2GeoTestCase.java @@ -22,8 +22,6 @@ import java.util.function.BiFunction; import java.util.stream.Collectors; -import lombok.SneakyThrows; - import org.junit.After; import org.junit.Before; import org.mockito.Mock; @@ -67,6 +65,8 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportService; +import lombok.SneakyThrows; + public abstract class Ip2GeoTestCase extends RestActionTestCase { @Mock protected ClusterService clusterService; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequestTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequestTests.java index 8f53472a..c2720fb9 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequestTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceRequestTests.java @@ -5,14 +5,14 @@ package org.opensearch.geospatial.ip2geo.action; -import lombok.SneakyThrows; - import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.core.common.io.stream.BytesStreamInput; import org.opensearch.geospatial.GeospatialTestHelper; import org.opensearch.geospatial.ip2geo.Ip2GeoTestCase; +import lombok.SneakyThrows; + public class DeleteDatasourceRequestTests extends Ip2GeoTestCase { @SneakyThrows public void testStreamInOut_whenValidInput_thenSucceed() { diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportActionTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportActionTests.java index aeb4e594..76604f1c 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportActionTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/DeleteDatasourceTransportActionTests.java @@ -20,8 +20,6 @@ import java.util.Arrays; import java.util.Collections; -import lombok.SneakyThrows; - import org.junit.Before; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; @@ -37,6 +35,8 @@ import org.opensearch.jobscheduler.spi.LockModel; import org.opensearch.tasks.Task; +import lombok.SneakyThrows; + public class DeleteDatasourceTransportActionTests extends Ip2GeoTestCase { private DeleteDatasourceTransportAction action; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportActionTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportActionTests.java index 63292dd8..c443615b 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportActionTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/PutDatasourceTransportActionTests.java @@ -15,8 +15,6 @@ import java.io.IOException; -import lombok.SneakyThrows; - import org.junit.Before; import org.mockito.ArgumentCaptor; import org.opensearch.ResourceAlreadyExistsException; @@ -33,6 +31,8 @@ import org.opensearch.jobscheduler.spi.LockModel; import org.opensearch.tasks.Task; +import lombok.SneakyThrows; + public class PutDatasourceTransportActionTests extends Ip2GeoTestCase { private PutDatasourceTransportAction action; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceIT.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceIT.java index 6c7baa2f..93d97b8c 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceIT.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceIT.java @@ -11,8 +11,6 @@ import java.util.Locale; import java.util.Map; -import lombok.SneakyThrows; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.opensearch.client.ResponseException; @@ -21,6 +19,8 @@ import org.opensearch.geospatial.GeospatialTestHelper; import org.opensearch.geospatial.ip2geo.Ip2GeoDataServer; +import lombok.SneakyThrows; + public class UpdateDatasourceIT extends GeospatialRestTestCase { // Use this value in resource name to avoid name conflict among tests private static final String PREFIX = UpdateDatasourceIT.class.getSimpleName().toLowerCase(Locale.ROOT); diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequestTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequestTests.java index 115c42b3..4c346d4c 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequestTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceRequestTests.java @@ -7,8 +7,6 @@ import java.util.Locale; -import lombok.SneakyThrows; - import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.Randomness; import org.opensearch.common.io.stream.BytesStreamOutput; @@ -17,6 +15,8 @@ import org.opensearch.geospatial.GeospatialTestHelper; import org.opensearch.geospatial.ip2geo.Ip2GeoTestCase; +import lombok.SneakyThrows; + public class UpdateDatasourceRequestTests extends Ip2GeoTestCase { public void testValidate_whenNullValues_thenFails() { diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportActionTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportActionTests.java index 53ee2b1c..2b1c941d 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportActionTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/action/UpdateDatasourceTransportActionTests.java @@ -19,8 +19,6 @@ import java.time.temporal.ChronoUnit; import java.util.List; -import lombok.SneakyThrows; - import org.junit.Before; import org.mockito.ArgumentCaptor; import org.opensearch.OpenSearchException; @@ -36,6 +34,8 @@ import org.opensearch.jobscheduler.spi.LockModel; import org.opensearch.tasks.Task; +import lombok.SneakyThrows; + public class UpdateDatasourceTransportActionTests extends Ip2GeoTestCase { private UpdateDatasourceTransportAction action; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifestTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifestTests.java index f7b689e1..c4cd3edb 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifestTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/common/DatasourceManifestTests.java @@ -13,12 +13,12 @@ import java.io.FileInputStream; import java.net.URLConnection; -import lombok.SneakyThrows; - import org.opensearch.common.SuppressForbidden; import org.opensearch.geospatial.ip2geo.Ip2GeoTestCase; import org.opensearch.geospatial.shared.Constants; +import lombok.SneakyThrows; + @SuppressForbidden(reason = "unit test") public class DatasourceManifestTests extends Ip2GeoTestCase { diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDaoTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDaoTests.java index 5857902e..500c3397 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDaoTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/dao/DatasourceDaoTests.java @@ -16,8 +16,6 @@ import java.util.Arrays; import java.util.List; -import lombok.SneakyThrows; - import org.apache.lucene.search.TotalHits; import org.junit.Before; import org.mockito.ArgumentCaptor; @@ -54,6 +52,8 @@ import org.opensearch.search.SearchHit; import org.opensearch.search.SearchHits; +import lombok.SneakyThrows; + public class DatasourceDaoTests extends Ip2GeoTestCase { private DatasourceDao datasourceDao; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDaoTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDaoTests.java index 3a985db1..a08554ef 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDaoTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/dao/GeoIpDataDaoTests.java @@ -23,8 +23,6 @@ import java.util.Locale; import java.util.Map; -import lombok.SneakyThrows; - import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -52,6 +50,8 @@ import org.opensearch.search.SearchHit; import org.opensearch.search.SearchHits; +import lombok.SneakyThrows; + @SuppressForbidden(reason = "unit test") public class GeoIpDataDaoTests extends Ip2GeoTestCase { private static final String IP_RANGE_FIELD_NAME = "_cidr"; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDaoTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDaoTests.java index 9ce2f792..d130d593 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDaoTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/dao/Ip2GeoCachedDaoTests.java @@ -15,8 +15,6 @@ import java.util.List; import java.util.Map; -import lombok.SneakyThrows; - import org.junit.Before; import org.opensearch.common.network.NetworkAddress; import org.opensearch.common.xcontent.XContentFactory; @@ -29,6 +27,8 @@ import org.opensearch.index.IndexNotFoundException; import org.opensearch.index.engine.Engine; +import lombok.SneakyThrows; + public class Ip2GeoCachedDaoTests extends Ip2GeoTestCase { private Ip2GeoCachedDao ip2GeoCachedDao; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunnerTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunnerTests.java index d4c460c4..9919e8b8 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunnerTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceRunnerTests.java @@ -20,8 +20,6 @@ import java.time.temporal.ChronoUnit; import java.util.Optional; -import lombok.SneakyThrows; - import org.junit.Before; import org.mockito.ArgumentCaptor; import org.opensearch.geospatial.GeospatialTestHelper; @@ -34,6 +32,8 @@ import org.opensearch.jobscheduler.spi.ScheduledJobParameter; import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; +import lombok.SneakyThrows; + public class DatasourceRunnerTests extends Ip2GeoTestCase { @Before public void init() { diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceTests.java index aaa0d29b..adb08297 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceTests.java @@ -13,13 +13,13 @@ import java.util.Arrays; import java.util.Locale; -import lombok.SneakyThrows; - import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.geospatial.GeospatialTestHelper; import org.opensearch.geospatial.ip2geo.Ip2GeoTestCase; import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; +import lombok.SneakyThrows; + public class DatasourceTests extends Ip2GeoTestCase { @SneakyThrows diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateServiceTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateServiceTests.java index 5e08400b..fa569ced 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateServiceTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/jobscheduler/DatasourceUpdateServiceTests.java @@ -23,8 +23,6 @@ import java.util.Iterator; import java.util.List; -import lombok.SneakyThrows; - import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.junit.Before; @@ -37,6 +35,8 @@ import org.opensearch.geospatial.ip2geo.common.DatasourceState; import org.opensearch.jobscheduler.spi.schedule.IntervalSchedule; +import lombok.SneakyThrows; + @SuppressForbidden(reason = "unit test") public class DatasourceUpdateServiceTests extends Ip2GeoTestCase { private DatasourceUpdateService datasourceUpdateService; diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorIT.java b/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorIT.java index d73893f3..abcad63f 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorIT.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorIT.java @@ -15,8 +15,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import lombok.SneakyThrows; - import org.opensearch.client.Response; import org.opensearch.client.ResponseException; import org.opensearch.common.Randomness; @@ -26,6 +24,8 @@ import org.opensearch.geospatial.ip2geo.Ip2GeoDataServer; import org.opensearch.geospatial.ip2geo.action.PutDatasourceRequest; +import lombok.SneakyThrows; + public class Ip2GeoProcessorIT extends GeospatialRestTestCase { // Use this value in resource name to avoid name conflict among tests private static final String PREFIX = Ip2GeoProcessorIT.class.getSimpleName().toLowerCase(Locale.ROOT); diff --git a/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorTests.java b/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorTests.java index 26cc78a0..b387ec97 100644 --- a/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorTests.java +++ b/src/test/java/org/opensearch/geospatial/ip2geo/processor/Ip2GeoProcessorTests.java @@ -20,8 +20,6 @@ import java.util.Map; import java.util.function.BiConsumer; -import lombok.SneakyThrows; - import org.junit.Before; import org.mockito.ArgumentCaptor; import org.opensearch.OpenSearchException; @@ -33,6 +31,8 @@ import org.opensearch.geospatial.ip2geo.jobscheduler.Datasource; import org.opensearch.ingest.IngestDocument; +import lombok.SneakyThrows; + public class Ip2GeoProcessorTests extends Ip2GeoTestCase { private static final String DEFAULT_TARGET_FIELD = "ip2geo"; private static final List SUPPORTED_FIELDS = Arrays.asList("city", "country"); diff --git a/src/test/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridAggregatorTests.java b/src/test/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridAggregatorTests.java index 354fd94a..33d47c72 100644 --- a/src/test/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridAggregatorTests.java +++ b/src/test/java/org/opensearch/geospatial/search/aggregations/bucket/geogrid/GeoHexGridAggregatorTests.java @@ -64,27 +64,17 @@ public class GeoHexGridAggregatorTests extends AggregatorTestCase { private static final double TOLERANCE = 1E-5D; public void testNoDocs() throws IOException { - testCase( - new MatchAllDocsQuery(), - GEO_POINT_FIELD_NAME, - randomPrecision(), - null, - geoGrid -> { assertEquals(0, geoGrid.getBuckets().size()); }, - iw -> { - // Intentionally not writing any docs - } - ); + testCase(new MatchAllDocsQuery(), GEO_POINT_FIELD_NAME, randomPrecision(), null, geoGrid -> { + assertEquals(0, geoGrid.getBuckets().size()); + }, iw -> { + // Intentionally not writing any docs + }); } public void testUnmapped() throws IOException { - testCase( - new MatchAllDocsQuery(), - randomLowerCaseString(), - randomPrecision(), - null, - geoGrid -> { assertEquals(0, geoGrid.getBuckets().size()); }, - iw -> { iw.addDocument(Collections.singleton(new LatLonDocValuesField(GEO_POINT_FIELD_NAME, 10D, 10D))); } - ); + testCase(new MatchAllDocsQuery(), randomLowerCaseString(), randomPrecision(), null, geoGrid -> { + assertEquals(0, geoGrid.getBuckets().size()); + }, iw -> { iw.addDocument(Collections.singleton(new LatLonDocValuesField(GEO_POINT_FIELD_NAME, 10D, 10D))); }); } public void testUnmappedMissing() throws IOException {