From 6ea3fd608a02bb6e7887ee3f1c54e8e5cdb6217a Mon Sep 17 00:00:00 2001 From: Pranshu Shukla Date: Tue, 3 Dec 2024 14:29:50 +0530 Subject: [PATCH] spotless - test framework Signed-off-by: Pranshu Shukla --- .../opensearch/test/InternalTestCluster.java | 1 - .../test/OpenSearchIntegTestCase.java | 9 +++++---- .../test/transport/MockTransportService.java | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index c73620c40bb28..14f0a30ef3f84 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -2322,7 +2322,6 @@ public List startNodes(int numOfNodes, Settings settings) { return startNodes(Collections.nCopies(numOfNodes, settings).toArray(new Settings[0])); } - /** * Starts multiple nodes with the given settings and returns their names */ diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java index c76da83df6cc9..1c26ea4ca2c91 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -181,7 +181,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; -import reactor.util.annotation.NonNull; import java.io.IOException; import java.lang.Runtime.Version; @@ -215,6 +214,8 @@ import java.util.function.Function; import java.util.stream.Collectors; +import reactor.util.annotation.NonNull; + import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS; import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS; import static org.opensearch.common.unit.TimeValue.timeValueMillis; @@ -2919,7 +2920,7 @@ protected static Settings buildRemoteStoreNodeAttributes( protected Settings buildRemotePublicationNodeAttributes( @NonNull String remoteStateRepoName, @NonNull String remoteStateRepoType, - @NonNull String routingTableRepoName, + @NonNull String routingTableRepoName, @NonNull String routingTableRepoType ) { String remoteStateRepositoryTypeAttributeKey = String.format( @@ -2948,8 +2949,8 @@ protected Settings buildRemotePublicationNodeAttributes( .put("node.attr." + REMOTE_STORE_ROUTING_TABLE_REPOSITORY_NAME_ATTRIBUTE_KEY, routingTableRepoName) .put(remoteStateRepositoryTypeAttributeKey, remoteStateRepoType) .put(routingTableRepositoryTypeAttributeKey, routingTableRepoType) - .put(remoteStateRepositorySettingsAttributeKeyPrefix+"location", randomRepoPath().toAbsolutePath()) - .put(routingTableRepositorySettingsAttributeKeyPrefix+"location", randomRepoPath().toAbsolutePath()) + .put(remoteStateRepositorySettingsAttributeKeyPrefix + "location", randomRepoPath().toAbsolutePath()) + .put(routingTableRepositorySettingsAttributeKeyPrefix + "location", randomRepoPath().toAbsolutePath()) .build(); } diff --git a/test/framework/src/main/java/org/opensearch/test/transport/MockTransportService.java b/test/framework/src/main/java/org/opensearch/test/transport/MockTransportService.java index 89e90bb044cc4..d8146e6f7d540 100644 --- a/test/framework/src/main/java/org/opensearch/test/transport/MockTransportService.java +++ b/test/framework/src/main/java/org/opensearch/test/transport/MockTransportService.java @@ -380,14 +380,22 @@ public void addFailToSendNoConnectRule(TransportAddress transportAddress, final /** * Adds a rule that will cause matching operations to throw provided OpenSearch Exceptions */ - public void addOpenSearchFailureException(TransportService transportService, final OpenSearchException exception, final String... blockedActions) { + public void addOpenSearchFailureException( + TransportService transportService, + final OpenSearchException exception, + final String... blockedActions + ) { addOpenSearchFailureException(transportService, exception, new HashSet<>(Arrays.asList(blockedActions))); } /** * Adds a rule that will cause matching operations to throw provided OpenSearch Exceptions */ - public void addOpenSearchFailureException(TransportService transportService, OpenSearchException exception, final Set blockedActions) { + public void addOpenSearchFailureException( + TransportService transportService, + OpenSearchException exception, + final Set blockedActions + ) { for (TransportAddress transportAddress : extractTransportAddresses(transportService)) { addOpenSearchFailureException(transportAddress, exception, blockedActions); } @@ -396,7 +404,11 @@ public void addOpenSearchFailureException(TransportService transportService, Ope /** * Adds a rule that will cause matching operations to throw provided OpenSearch Exceptions */ - public void addOpenSearchFailureException(TransportAddress transportAddress, OpenSearchException exception, final Set blockedActions) { + public void addOpenSearchFailureException( + TransportAddress transportAddress, + OpenSearchException exception, + final Set blockedActions + ) { transport().addSendBehavior(transportAddress, (connection, requestId, action, request, options) -> { if (blockedActions.contains(action)) { logger.info("--> preventing {} request", action);