diff --git a/server/src/test/java/org/opensearch/cluster/routing/remote/NoopRemoteRoutingTableServiceTests.java b/server/src/test/java/org/opensearch/cluster/routing/remote/NoopRemoteRoutingTableServiceTests.java new file mode 100644 index 0000000000000..dbabb872bd0c7 --- /dev/null +++ b/server/src/test/java/org/opensearch/cluster/routing/remote/NoopRemoteRoutingTableServiceTests.java @@ -0,0 +1,66 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.cluster.routing.remote; + +import org.opensearch.action.LatchedActionListener; +import org.opensearch.cluster.Diff; +import org.opensearch.cluster.routing.IndexRoutingTable; +import org.opensearch.cluster.routing.RoutingTable; +import org.opensearch.common.util.TestCapturingListener; +import org.opensearch.gateway.remote.ClusterMetadataManifest; +import org.opensearch.test.OpenSearchTestCase; +import org.junit.Before; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class NoopRemoteRoutingTableServiceTests extends OpenSearchTestCase { + private NoopRemoteRoutingTableService service; + + @Before + public void setup() { + service = new NoopRemoteRoutingTableService(); + } + + public void testGetAsyncIndexRoutingWriteAction() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + TestCapturingListener capturingListener = new TestCapturingListener<>(); + LatchedActionListener listener = new LatchedActionListener<>(capturingListener, latch); + service.getAsyncIndexRoutingWriteAction("clusterUUID", 1, 1, null, listener); + latch.await(100, TimeUnit.MILLISECONDS); + assertNull(capturingListener.getResult()); + } + + public void testGetAsyncIndexRoutingReadAction() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + TestCapturingListener capturingListener = new TestCapturingListener<>(); + LatchedActionListener listener = new LatchedActionListener<>(capturingListener, latch); + service.getAsyncIndexRoutingReadAction("clusterUUID", "filename", listener); + latch.await(100, TimeUnit.MILLISECONDS); + assertNull(capturingListener.getResult()); + } + + public void testGetAsyncIndexRoutingDiffWriteAction() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + TestCapturingListener capturingListener = new TestCapturingListener<>(); + LatchedActionListener listener = new LatchedActionListener<>(capturingListener, latch); + service.getAsyncIndexRoutingDiffWriteAction("clusterUUID", 1, 1, null, listener); + latch.await(100, TimeUnit.MILLISECONDS); + assertNull(capturingListener.getResult()); + } + + public void testGetAsyncIndexRoutingDiffReadAction() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + TestCapturingListener> capturingListener = new TestCapturingListener<>(); + LatchedActionListener> listener = new LatchedActionListener<>(capturingListener, latch); + service.getAsyncIndexRoutingTableDiffReadAction("clusterUUID", "filename", listener); + latch.await(100, TimeUnit.MILLISECONDS); + assertNull(capturingListener.getResult()); + } +}