From 59afca76f51d5076c45fe05643773a1967073f9d Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Mon, 11 Dec 2023 22:20:25 -0800 Subject: [PATCH] Fix compiler warnings (#270) Signed-off-by: Daniel Widdis --- .../flowframework/model/ResourceCreatedTests.java | 14 +++++++------- .../CreateWorkflowTransportActionTests.java | 6 +----- .../transport/GetWorkflowTransportActionTests.java | 5 ----- .../SearchWorkflowTransportActionTests.java | 5 +---- .../workflow/CreateIndexStepTests.java | 4 ---- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/test/java/org/opensearch/flowframework/model/ResourceCreatedTests.java b/src/test/java/org/opensearch/flowframework/model/ResourceCreatedTests.java index a8536dd43..c38d6f81c 100644 --- a/src/test/java/org/opensearch/flowframework/model/ResourceCreatedTests.java +++ b/src/test/java/org/opensearch/flowframework/model/ResourceCreatedTests.java @@ -20,17 +20,17 @@ public void setUp() throws Exception { } public void testParseFeature() throws IOException { - ResourceCreated ResourceCreated = new ResourceCreated("A", "B"); - assertEquals(ResourceCreated.workflowStepName(), "A"); - assertEquals(ResourceCreated.resourceId(), "B"); + ResourceCreated resourceCreated = new ResourceCreated("A", "B"); + assertEquals(resourceCreated.workflowStepName(), "A"); + assertEquals(resourceCreated.resourceId(), "B"); String expectedJson = "{\"workflow_step_name\":\"A\",\"resource_id\":\"B\"}"; - String json = TemplateTestJsonUtil.parseToJson(ResourceCreated); + String json = TemplateTestJsonUtil.parseToJson(resourceCreated); assertEquals(expectedJson, json); - ResourceCreated ResourceCreatedTwo = ResourceCreated.parse(TemplateTestJsonUtil.jsonToParser(json)); - assertEquals("A", ResourceCreatedTwo.workflowStepName()); - assertEquals("B", ResourceCreatedTwo.resourceId()); + ResourceCreated resourceCreatedTwo = ResourceCreated.parse(TemplateTestJsonUtil.jsonToParser(json)); + assertEquals("A", resourceCreatedTwo.workflowStepName()); + assertEquals("B", resourceCreatedTwo.resourceId()); } public void testExceptions() throws IOException { diff --git a/src/test/java/org/opensearch/flowframework/transport/CreateWorkflowTransportActionTests.java b/src/test/java/org/opensearch/flowframework/transport/CreateWorkflowTransportActionTests.java index 70c066c0e..26c62b854 100644 --- a/src/test/java/org/opensearch/flowframework/transport/CreateWorkflowTransportActionTests.java +++ b/src/test/java/org/opensearch/flowframework/transport/CreateWorkflowTransportActionTests.java @@ -24,7 +24,6 @@ import org.opensearch.flowframework.model.Workflow; import org.opensearch.flowframework.model.WorkflowEdge; import org.opensearch.flowframework.model.WorkflowNode; -import org.opensearch.flowframework.util.ParseUtils; import org.opensearch.flowframework.workflow.WorkflowProcessSorter; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.tasks.Task; @@ -44,8 +43,8 @@ import static org.opensearch.flowframework.common.FlowFrameworkSettings.MAX_WORKFLOWS; import static org.opensearch.flowframework.common.FlowFrameworkSettings.WORKFLOW_REQUEST_TIMEOUT; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -61,8 +60,6 @@ public class CreateWorkflowTransportActionTests extends OpenSearchTestCase { private Template template; private Client client = mock(Client.class); private ThreadPool threadPool; - private ParseUtils parseUtils; - private ThreadContext threadContext; private Settings settings; @Override @@ -200,7 +197,6 @@ public void testMaxWorkflow() { } public void testMaxWorkflowWithNoIndex() { - @SuppressWarnings("unchecked") ActionListener listener = new ActionListener() { @Override public void onResponse(Boolean booleanResponse) { diff --git a/src/test/java/org/opensearch/flowframework/transport/GetWorkflowTransportActionTests.java b/src/test/java/org/opensearch/flowframework/transport/GetWorkflowTransportActionTests.java index c3991783d..ab6d0a68f 100644 --- a/src/test/java/org/opensearch/flowframework/transport/GetWorkflowTransportActionTests.java +++ b/src/test/java/org/opensearch/flowframework/transport/GetWorkflowTransportActionTests.java @@ -19,7 +19,6 @@ import org.opensearch.core.xcontent.ToXContent; import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.flowframework.TestHelpers; -import org.opensearch.flowframework.indices.FlowFrameworkIndicesHandler; import org.opensearch.flowframework.model.WorkflowState; import org.opensearch.tasks.Task; import org.opensearch.test.OpenSearchTestCase; @@ -40,10 +39,7 @@ public class GetWorkflowTransportActionTests extends OpenSearchTestCase { private GetWorkflowTransportAction getWorkflowTransportAction; - private FlowFrameworkIndicesHandler flowFrameworkIndicesHandler; private Client client; - private ThreadPool threadPool; - private ThreadContext threadContext; private ActionListener response; private Task task; @@ -51,7 +47,6 @@ public class GetWorkflowTransportActionTests extends OpenSearchTestCase { public void setUp() throws Exception { super.setUp(); this.client = mock(Client.class); - this.threadPool = mock(ThreadPool.class); this.getWorkflowTransportAction = new GetWorkflowTransportAction( mock(TransportService.class), mock(ActionFilters.class), diff --git a/src/test/java/org/opensearch/flowframework/transport/SearchWorkflowTransportActionTests.java b/src/test/java/org/opensearch/flowframework/transport/SearchWorkflowTransportActionTests.java index b237aefbc..d60316085 100644 --- a/src/test/java/org/opensearch/flowframework/transport/SearchWorkflowTransportActionTests.java +++ b/src/test/java/org/opensearch/flowframework/transport/SearchWorkflowTransportActionTests.java @@ -15,7 +15,6 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.core.action.ActionListener; -import org.opensearch.flowframework.indices.FlowFrameworkIndicesHandler; import org.opensearch.tasks.Task; import org.opensearch.test.OpenSearchTestCase; import org.opensearch.threadpool.ThreadPool; @@ -23,7 +22,7 @@ import org.mockito.ArgumentCaptor; -import static org.mockito.Mockito.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -33,10 +32,8 @@ public class SearchWorkflowTransportActionTests extends OpenSearchTestCase { private SearchWorkflowTransportAction searchWorkflowTransportAction; - private FlowFrameworkIndicesHandler flowFrameworkIndicesHandler; private Client client; private ThreadPool threadPool; - private ThreadContext threadContext; @Override public void setUp() throws Exception { diff --git a/src/test/java/org/opensearch/flowframework/workflow/CreateIndexStepTests.java b/src/test/java/org/opensearch/flowframework/workflow/CreateIndexStepTests.java index 8be5c5787..3b9233c95 100644 --- a/src/test/java/org/opensearch/flowframework/workflow/CreateIndexStepTests.java +++ b/src/test/java/org/opensearch/flowframework/workflow/CreateIndexStepTests.java @@ -42,12 +42,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@SuppressWarnings("deprecation") public class CreateIndexStepTests extends OpenSearchTestCase { - private static final String META = "_meta"; - private static final String SCHEMA_VERSION_FIELD = "schemaVersion"; - private WorkflowData inputData = WorkflowData.EMPTY; private Client client; private AdminClient adminClient;