From 99e648bcb2d231665656f01ff428a9947dfc53c0 Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Thu, 3 Nov 2022 14:58:14 -0700 Subject: [PATCH] Refactor project package structure (#55) Brings query up one level from plugin to neuralsearch. Signed-off-by: John Mazanec --- .../opensearch/neuralsearch/plugin/NeuralSearch.java | 2 +- .../{plugin => }/query/NeuralQueryBuilder.java | 2 +- .../neuralsearch/{plugin => }/NeuralSearchIT.java | 3 +-- .../neuralsearch/{plugin => }/NeuralSearchTests.java | 2 +- .../neuralsearch/{plugin => }/TestUtils.java | 2 +- .../ValidateDependentPluginInstallationIT.java | 3 +-- .../{plugin => }/query/NeuralQueryBuilderTests.java | 12 ++++++------ .../{plugin => }/query/NeuralQueryIT.java | 6 +++--- 8 files changed, 15 insertions(+), 17 deletions(-) rename src/main/java/org/opensearch/neuralsearch/{plugin => }/query/NeuralQueryBuilder.java (99%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/NeuralSearchIT.java (89%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/NeuralSearchTests.java (90%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/TestUtils.java (97%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/ValidateDependentPluginInstallationIT.java (97%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/query/NeuralQueryBuilderTests.java (97%) rename src/test/java/org/opensearch/neuralsearch/{plugin => }/query/NeuralQueryIT.java (98%) diff --git a/src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java b/src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java index 3c23b3a28..792d85804 100644 --- a/src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java +++ b/src/main/java/org/opensearch/neuralsearch/plugin/NeuralSearch.java @@ -23,9 +23,9 @@ import org.opensearch.ingest.Processor; import org.opensearch.ml.client.MachineLearningNodeClient; import org.opensearch.neuralsearch.ml.MLCommonsClientAccessor; -import org.opensearch.neuralsearch.plugin.query.NeuralQueryBuilder; import org.opensearch.neuralsearch.processor.TextEmbeddingProcessor; import org.opensearch.neuralsearch.processor.factory.TextEmbeddingProcessorFactory; +import org.opensearch.neuralsearch.query.NeuralQueryBuilder; import org.opensearch.neuralsearch.transport.MLPredictAction; import org.opensearch.neuralsearch.transport.MLPredictTransportAction; import org.opensearch.plugins.ActionPlugin; diff --git a/src/main/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilder.java b/src/main/java/org/opensearch/neuralsearch/query/NeuralQueryBuilder.java similarity index 99% rename from src/main/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilder.java rename to src/main/java/org/opensearch/neuralsearch/query/NeuralQueryBuilder.java index f283cf2f5..cdd248195 100644 --- a/src/main/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilder.java +++ b/src/main/java/org/opensearch/neuralsearch/query/NeuralQueryBuilder.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin.query; +package org.opensearch.neuralsearch.query; import static org.opensearch.neuralsearch.common.VectorUtil.vectorAsListToArray; diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchIT.java b/src/test/java/org/opensearch/neuralsearch/NeuralSearchIT.java similarity index 89% rename from src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchIT.java rename to src/test/java/org/opensearch/neuralsearch/NeuralSearchIT.java index eb16ad7c0..9e8e2682c 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchIT.java +++ b/src/test/java/org/opensearch/neuralsearch/NeuralSearchIT.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin; +package org.opensearch.neuralsearch; import java.io.IOException; @@ -11,7 +11,6 @@ import org.junit.Assert; import org.opensearch.client.Request; import org.opensearch.client.Response; -import org.opensearch.neuralsearch.OpenSearchSecureRestTestCase; import org.opensearch.rest.RestRequest; public class NeuralSearchIT extends OpenSearchSecureRestTestCase { diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java b/src/test/java/org/opensearch/neuralsearch/NeuralSearchTests.java similarity index 90% rename from src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java rename to src/test/java/org/opensearch/neuralsearch/NeuralSearchTests.java index a3eddd3c8..905b32aaa 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/NeuralSearchTests.java +++ b/src/test/java/org/opensearch/neuralsearch/NeuralSearchTests.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin; +package org.opensearch.neuralsearch; import org.opensearch.knn.common.KNNConstants; import org.opensearch.knn.index.util.KNNEngine; diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/TestUtils.java b/src/test/java/org/opensearch/neuralsearch/TestUtils.java similarity index 97% rename from src/test/java/org/opensearch/neuralsearch/plugin/TestUtils.java rename to src/test/java/org/opensearch/neuralsearch/TestUtils.java index 75ac7a1eb..4a2b830ee 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/TestUtils.java +++ b/src/test/java/org/opensearch/neuralsearch/TestUtils.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin; +package org.opensearch.neuralsearch; import static org.opensearch.test.OpenSearchTestCase.randomFloat; diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/ValidateDependentPluginInstallationIT.java b/src/test/java/org/opensearch/neuralsearch/ValidateDependentPluginInstallationIT.java similarity index 97% rename from src/test/java/org/opensearch/neuralsearch/plugin/ValidateDependentPluginInstallationIT.java rename to src/test/java/org/opensearch/neuralsearch/ValidateDependentPluginInstallationIT.java index b0c0fd1b8..84707e868 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/ValidateDependentPluginInstallationIT.java +++ b/src/test/java/org/opensearch/neuralsearch/ValidateDependentPluginInstallationIT.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin; +package org.opensearch.neuralsearch; import java.io.BufferedReader; import java.io.IOException; @@ -18,7 +18,6 @@ import org.opensearch.common.Strings; import org.opensearch.common.settings.Settings; import org.opensearch.common.xcontent.XContentFactory; -import org.opensearch.neuralsearch.OpenSearchSecureRestTestCase; import org.opensearch.rest.RestRequest; /** diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilderTests.java b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryBuilderTests.java similarity index 97% rename from src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilderTests.java rename to src/test/java/org/opensearch/neuralsearch/query/NeuralQueryBuilderTests.java index b4ff4a1e8..64bab186a 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryBuilderTests.java +++ b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryBuilderTests.java @@ -3,18 +3,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin.query; +package org.opensearch.neuralsearch.query; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.opensearch.index.query.AbstractQueryBuilder.BOOST_FIELD; import static org.opensearch.index.query.AbstractQueryBuilder.NAME_FIELD; -import static org.opensearch.neuralsearch.plugin.TestUtils.xContentBuilderToMap; -import static org.opensearch.neuralsearch.plugin.query.NeuralQueryBuilder.K_FIELD; -import static org.opensearch.neuralsearch.plugin.query.NeuralQueryBuilder.MODEL_ID_FIELD; -import static org.opensearch.neuralsearch.plugin.query.NeuralQueryBuilder.NAME; -import static org.opensearch.neuralsearch.plugin.query.NeuralQueryBuilder.QUERY_TEXT_FIELD; +import static org.opensearch.neuralsearch.TestUtils.xContentBuilderToMap; +import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.K_FIELD; +import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.MODEL_ID_FIELD; +import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.NAME; +import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.QUERY_TEXT_FIELD; import java.io.IOException; import java.util.Arrays; diff --git a/src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryIT.java b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java similarity index 98% rename from src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryIT.java rename to src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java index 35afa9690..9a4d3268e 100644 --- a/src/test/java/org/opensearch/neuralsearch/plugin/query/NeuralQueryIT.java +++ b/src/test/java/org/opensearch/neuralsearch/query/NeuralQueryIT.java @@ -3,10 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.opensearch.neuralsearch.plugin.query; +package org.opensearch.neuralsearch.query; -import static org.opensearch.neuralsearch.plugin.TestUtils.createRandomVector; -import static org.opensearch.neuralsearch.plugin.TestUtils.objectToFloat; +import static org.opensearch.neuralsearch.TestUtils.createRandomVector; +import static org.opensearch.neuralsearch.TestUtils.objectToFloat; import java.io.IOException; import java.util.Collections;