From d1a2c14dd37d554ec9a19f40a98d2aa8452522a5 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 2 Oct 2023 09:33:48 -0700 Subject: [PATCH] spotless apply Signed-off-by: Jackie Han --- .../exception/FlowFrameworkException.java | 1 + .../flowframework/indices/FlowFrameworkIndex.java | 8 ++++---- .../flowframework/indices/GlobalContextHandler.java | 5 ++++- .../flowframework/workflow/CreateIndexStep.java | 13 +++++++++++-- .../indices/GlobalContextHandlerTests.java | 1 - 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/exception/FlowFrameworkException.java b/src/main/java/org/opensearch/flowframework/exception/FlowFrameworkException.java index 27fe82306..4b45292e3 100644 --- a/src/main/java/org/opensearch/flowframework/exception/FlowFrameworkException.java +++ b/src/main/java/org/opensearch/flowframework/exception/FlowFrameworkException.java @@ -16,6 +16,7 @@ public class FlowFrameworkException extends RuntimeException { private final Response.Status restStatus; + /** * Constructor with error message. * diff --git a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndex.java b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndex.java index f85a904da..30261ae0e 100644 --- a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndex.java +++ b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndex.java @@ -20,9 +20,9 @@ */ public enum FlowFrameworkIndex { GLOBAL_CONTEXT( - GLOBAL_CONTEXT_INDEX, - ThrowingSupplierWrapper.throwingSupplierWrapper(GlobalContextHandler::getGlobalContextMappings), - GLOBAL_CONTEXT_INDEX_VERSION + GLOBAL_CONTEXT_INDEX, + ThrowingSupplierWrapper.throwingSupplierWrapper(GlobalContextHandler::getGlobalContextMappings), + GLOBAL_CONTEXT_INDEX_VERSION ); private final String indexName; @@ -46,4 +46,4 @@ public String getMapping() { public Integer getVersion() { return version; } -} \ No newline at end of file +} diff --git a/src/main/java/org/opensearch/flowframework/indices/GlobalContextHandler.java b/src/main/java/org/opensearch/flowframework/indices/GlobalContextHandler.java index 0e4068833..30c27954e 100644 --- a/src/main/java/org/opensearch/flowframework/indices/GlobalContextHandler.java +++ b/src/main/java/org/opensearch/flowframework/indices/GlobalContextHandler.java @@ -26,6 +26,7 @@ import org.opensearch.flowframework.workflow.CreateIndexStep; import javax.ws.rs.core.Response; + import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -73,7 +74,9 @@ private void initGlobalContextIndexIfAbsent(ActionListener listener) { public void putTemplateToGlobalContext(Template template, ActionListener listener) { initGlobalContextIndexIfAbsent(ActionListener.wrap(indexCreated -> { if (!indexCreated) { - listener.onFailure(new FlowFrameworkException("No response to create global_context index", Response.Status.INTERNAL_SERVER_ERROR)); + listener.onFailure( + new FlowFrameworkException("No response to create global_context index", Response.Status.INTERNAL_SERVER_ERROR) + ); return; } IndexRequest request = new IndexRequest(GLOBAL_CONTEXT_INDEX); diff --git a/src/main/java/org/opensearch/flowframework/workflow/CreateIndexStep.java b/src/main/java/org/opensearch/flowframework/workflow/CreateIndexStep.java index 0e26ec8ee..97c389c41 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/CreateIndexStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/CreateIndexStep.java @@ -29,6 +29,7 @@ import org.opensearch.flowframework.indices.FlowFrameworkIndex; import javax.ws.rs.core.Response; + import java.io.IOException; import java.net.URL; import java.util.HashMap; @@ -165,7 +166,10 @@ public void initIndexIfAbsent(FlowFrameworkIndex index, ActionListener internalListener.onResponse(true); } else { internalListener.onFailure( - new FlowFrameworkException("Failed to update index setting for: " + indexName, Response.Status.INTERNAL_SERVER_ERROR) + new FlowFrameworkException( + "Failed to update index setting for: " + indexName, + Response.Status.INTERNAL_SERVER_ERROR + ) ); } }, exception -> { @@ -173,7 +177,12 @@ public void initIndexIfAbsent(FlowFrameworkIndex index, ActionListener internalListener.onFailure(exception); })); } else { - internalListener.onFailure(new FlowFrameworkException("Failed to update index: " + indexName, Response.Status.INTERNAL_SERVER_ERROR)); + internalListener.onFailure( + new FlowFrameworkException( + "Failed to update index: " + indexName, + Response.Status.INTERNAL_SERVER_ERROR + ) + ); } }, exception -> { logger.error("Failed to update index " + indexName, exception); diff --git a/src/test/java/org/opensearch/flowframework/indices/GlobalContextHandlerTests.java b/src/test/java/org/opensearch/flowframework/indices/GlobalContextHandlerTests.java index ecf4cda26..0a3eb77da 100644 --- a/src/test/java/org/opensearch/flowframework/indices/GlobalContextHandlerTests.java +++ b/src/test/java/org/opensearch/flowframework/indices/GlobalContextHandlerTests.java @@ -24,7 +24,6 @@ import org.opensearch.flowframework.workflow.CreateIndexStep; import org.opensearch.test.OpenSearchTestCase; import org.opensearch.threadpool.ThreadPool; -import org.junit.Test; import java.io.IOException; import java.util.HashMap;