Skip to content

Commit 43fa229

Browse files
committed
Remove duplicate methods
Signed-off-by: Craig Perkins <[email protected]>
1 parent 7b7d162 commit 43fa229

File tree

2 files changed

+6
-46
lines changed

2 files changed

+6
-46
lines changed

server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceFFEnabledTests.java

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import org.opensearch.common.settings.ClusterSettings;
4747
import org.opensearch.common.settings.IndexScopedSettings;
4848
import org.opensearch.common.settings.Settings;
49-
import org.opensearch.common.unit.TimeValue;
5049
import org.opensearch.common.util.FeatureFlags;
5150
import org.opensearch.common.xcontent.json.JsonXContent;
5251
import org.opensearch.core.xcontent.DeprecationHandler;
@@ -59,7 +58,6 @@
5958
import org.opensearch.indices.IndexCreationException;
6059
import org.opensearch.indices.IndicesService;
6160
import org.opensearch.indices.InvalidIndexContextException;
62-
import org.opensearch.indices.ShardLimitValidator;
6361
import org.opensearch.indices.SystemIndices;
6462
import org.opensearch.indices.replication.common.ReplicationType;
6563
import org.opensearch.node.remotestore.RemoteStoreNodeService;
@@ -85,20 +83,17 @@
8583
import java.util.function.BiConsumer;
8684
import java.util.function.Supplier;
8785

88-
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_SEGMENT_STORE_REPOSITORY;
89-
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED;
90-
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY;
91-
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE;
9286
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED;
9387
import static org.opensearch.cluster.metadata.MetadataCreateIndexService.aggregateIndexSettings;
88+
import static org.opensearch.cluster.metadata.MetadataCreateIndexServiceTests.getRemoteNode;
89+
import static org.opensearch.cluster.metadata.MetadataCreateIndexServiceTests.randomShardLimitService;
90+
import static org.opensearch.cluster.metadata.MetadataCreateIndexServiceTests.verifyRemoteStoreIndexSettings;
9491
import static org.opensearch.index.IndexSettings.INDEX_MERGE_POLICY;
9592
import static org.opensearch.index.IndexSettings.INDEX_REFRESH_INTERVAL_SETTING;
96-
import static org.opensearch.index.IndexSettings.INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING;
9793
import static org.opensearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING;
9894
import static org.opensearch.indices.ShardLimitValidatorTests.createTestShardLimitService;
9995
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY;
10096
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY;
101-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY;
10297
import static org.opensearch.node.remotestore.RemoteStoreNodeService.MIGRATION_DIRECTION_SETTING;
10398
import static org.opensearch.node.remotestore.RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING;
10499
import static org.hamcrest.Matchers.containsString;
@@ -109,7 +104,6 @@ public class MetadataCreateIndexServiceFFEnabledTests extends OpenSearchTestCase
109104

110105
private CreateIndexClusterStateUpdateRequest request;
111106
private IndicesService indicesServices;
112-
private RepositoriesService repositoriesService;
113107
private Supplier<RepositoriesService> repositoriesServiceSupplier;
114108

115109
@BeforeClass
@@ -132,7 +126,6 @@ public void setup() throws Exception {
132126
super.setUp();
133127
indicesServices = mock(IndicesService.class);
134128
repositoriesServiceSupplier = mock(Supplier.class);
135-
repositoriesService = mock(RepositoriesService.class);
136129
}
137130

138131
@Before
@@ -451,10 +444,6 @@ public void testApplyContextWithSettingsOverlap() throws IOException {
451444
});
452445
}
453446

454-
private ShardLimitValidator randomShardLimitService() {
455-
return createTestShardLimitService(randomIntBetween(10, 10000), false);
456-
}
457-
458447
private void withTemporaryClusterService(BiConsumer<ClusterService, ThreadPool> consumer) {
459448
ThreadPool threadPool = new TestThreadPool(getTestName());
460449
try {
@@ -465,33 +454,4 @@ private void withTemporaryClusterService(BiConsumer<ClusterService, ThreadPool>
465454
}
466455
}
467456

468-
private void verifyRemoteStoreIndexSettings(
469-
Settings indexSettings,
470-
String isRemoteSegmentEnabled,
471-
String remoteSegmentRepo,
472-
String remoteTranslogRepo,
473-
String replicationType,
474-
TimeValue translogBufferInterval
475-
) {
476-
assertEquals(replicationType, indexSettings.get(SETTING_REPLICATION_TYPE));
477-
assertEquals(isRemoteSegmentEnabled, indexSettings.get(SETTING_REMOTE_STORE_ENABLED));
478-
assertEquals(remoteSegmentRepo, indexSettings.get(SETTING_REMOTE_SEGMENT_STORE_REPOSITORY));
479-
assertEquals(remoteTranslogRepo, indexSettings.get(SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY));
480-
assertEquals(translogBufferInterval, indexSettings.get(INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.getKey()));
481-
}
482-
483-
private DiscoveryNode getRemoteNode() {
484-
Map<String, String> attributes = new HashMap<>();
485-
attributes.put(REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-cluster-rep-1");
486-
attributes.put(REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-segment-repo-1");
487-
attributes.put(REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-translog-repo-1");
488-
return new DiscoveryNode(
489-
UUIDs.base64UUID(),
490-
buildNewFakeTransportAddress(),
491-
attributes,
492-
DiscoveryNodeRole.BUILT_IN_ROLES,
493-
Version.CURRENT
494-
);
495-
}
496-
497457
}

server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ private CompressedXContent createMapping(String fieldName, String fieldType) {
22442244
}
22452245
}
22462246

2247-
private ShardLimitValidator randomShardLimitService() {
2247+
public static ShardLimitValidator randomShardLimitService() {
22482248
return createTestShardLimitService(randomIntBetween(10, 10000), false);
22492249
}
22502250

@@ -2258,7 +2258,7 @@ private void withTemporaryClusterService(BiConsumer<ClusterService, ThreadPool>
22582258
}
22592259
}
22602260

2261-
private void verifyRemoteStoreIndexSettings(
2261+
public static void verifyRemoteStoreIndexSettings(
22622262
Settings indexSettings,
22632263
String isRemoteSegmentEnabled,
22642264
String remoteSegmentRepo,
@@ -2273,7 +2273,7 @@ private void verifyRemoteStoreIndexSettings(
22732273
assertEquals(translogBufferInterval, indexSettings.get(INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.getKey()));
22742274
}
22752275

2276-
private DiscoveryNode getRemoteNode() {
2276+
public static DiscoveryNode getRemoteNode() {
22772277
Map<String, String> attributes = new HashMap<>();
22782278
attributes.put(REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-cluster-rep-1");
22792279
attributes.put(REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-segment-repo-1");

0 commit comments

Comments
 (0)