diff --git a/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataCommands.java b/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataCommands.java index 20236ee0d..49ea3ae6b 100644 --- a/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataCommands.java +++ b/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataCommands.java @@ -3,14 +3,14 @@ /** The list of supported commands for the metadata tool */ public enum MetadataCommands { /** Migrates items from a source and recreates them on the target cluster */ - Migrate, + MIGRATE, /** Inspects items from a source to determine which can be placed on a target cluster */ - Evaluate; + EVALUATE; public static MetadataCommands fromString(String s) { for (var command : values()) { - if (command.name().toLowerCase().equals(s.toLowerCase())) { + if (command.name().equalsIgnoreCase(s)) { return command; } } diff --git a/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataMigration.java b/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataMigration.java index 7823e1e04..2c8436966 100644 --- a/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataMigration.java +++ b/MetadataMigration/src/main/java/org/opensearch/migrations/MetadataMigration.java @@ -54,11 +54,11 @@ public static void main(String[] args) throws Exception { var command = Optional.ofNullable(jCommander.getParsedCommand()) .map(MetadataCommands::fromString) - .orElse(MetadataCommands.Migrate); + .orElse(MetadataCommands.MIGRATE); Result result; switch (command) { default: - case Migrate: + case MIGRATE: if (migrateArgs.help) { printCommandUsage(jCommander); return; @@ -67,7 +67,7 @@ public static void main(String[] args) throws Exception { log.info("Starting Metadata Migration"); result = meta.migrate(migrateArgs).execute(context); break; - case Evaluate: + case EVALUATE: if (evaluateArgs.help) { printCommandUsage(jCommander); return; diff --git a/MetadataMigration/src/test/java/org/opensearch/migrations/EndToEndTest.java b/MetadataMigration/src/test/java/org/opensearch/migrations/EndToEndTest.java index f438aef2c..0c28b30d1 100644 --- a/MetadataMigration/src/test/java/org/opensearch/migrations/EndToEndTest.java +++ b/MetadataMigration/src/test/java/org/opensearch/migrations/EndToEndTest.java @@ -44,9 +44,9 @@ class EndToEndTest { private static Stream scenarios() { return Stream.of( - Arguments.of(TransferMedium.Http, MetadataCommands.Evaluate), - Arguments.of(TransferMedium.SnapshotImage, MetadataCommands.Migrate), - Arguments.of(TransferMedium.Http, MetadataCommands.Migrate) + Arguments.of(TransferMedium.Http, MetadataCommands.EVALUATE), + Arguments.of(TransferMedium.SnapshotImage, MetadataCommands.MIGRATE), + Arguments.of(TransferMedium.Http, MetadataCommands.MIGRATE) ); } @@ -183,7 +183,7 @@ private void migrateFrom_ES( var metadata = new MetadataMigration(); MigrationItemResult result; - if (MetadataCommands.Migrate.equals(command)) { + if (MetadataCommands.MIGRATE.equals(command)) { result = metadata.migrate(arguments).execute(metadataContext); } else { result = metadata.evaluate(arguments).execute(metadataContext); @@ -223,7 +223,7 @@ private void verifyTargetCluster( boolean sourceIsES6_8, TestData testData ) { - var expectUpdatesOnTarget = MetadataCommands.Migrate.equals(command); + var expectUpdatesOnTarget = MetadataCommands.MIGRATE.equals(command); // If the command was migrate, the target cluster should have the items, if not they var verifyResponseCode = expectUpdatesOnTarget ? equalTo(200) : equalTo(404);