From 7c5b663bdff184d547e8ee7ac0dba1f35376f625 Mon Sep 17 00:00:00 2001 From: Jeromy Cannon Date: Mon, 2 Oct 2023 17:07:26 +0100 Subject: [PATCH] better rename for options with multiple values Signed-off-by: Jeromy Cannon --- .../execution/HelmExecutionBuilder.java | 20 +++++++++---------- .../model/install/InstallChartOptions.java | 4 ++-- .../execution/HelmExecutionBuilderTest.java | 8 ++++---- .../model/InstallChartOptionsBuilderTest.java | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/execution/HelmExecutionBuilder.java b/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/execution/HelmExecutionBuilder.java index 70cedd1f9..d4bd2ad85 100644 --- a/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/execution/HelmExecutionBuilder.java +++ b/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/execution/HelmExecutionBuilder.java @@ -48,9 +48,9 @@ public final class HelmExecutionBuilder { private final HashMap arguments; /** - * The list of key value pairs where the value is a list of values for the given key. + * The list of options and a list of their one or more values. */ - private final List>> keyListOfValuesPairList; + private final List>> optionsWithMultipleValues; /** * The flags to be passed to the helm command. @@ -81,7 +81,7 @@ public HelmExecutionBuilder(final Path helmExecutable) { this.helmExecutable = Objects.requireNonNull(helmExecutable, "helmExecutable must not be null"); this.subcommands = new ArrayList<>(); this.arguments = new HashMap<>(); - this.keyListOfValuesPairList = new ArrayList<>(); + this.optionsWithMultipleValues = new ArrayList<>(); this.positionals = new ArrayList<>(); this.flags = new ArrayList<>(); this.environmentVariables = new HashMap<>(); @@ -120,18 +120,18 @@ public HelmExecutionBuilder argument(final String name, final String value) { } /** - * Adds a key with a provided list of values to the helm command. This is used for options that have can have - * multiple values for a single key. (e.g. --set and --values) + * Adds an option with a provided list of values to the helm command. This is used for options that have can have + * multiple values for a single option. (e.g. --set and --values) * - * @param name the key for the key/value pair. - * @param value the list of values for the given key. + * @param name the name of the option. + * @param value the list of values for the given option. * @return this builder. * @throws NullPointerException if either {@code name} or {@code value} is {@code null}. */ - public HelmExecutionBuilder keyListOfValuesPair(final String name, final List value) { + public HelmExecutionBuilder optionsWithMultipleValues(final String name, final List value) { Objects.requireNonNull(name, NAME_MUST_NOT_BE_NULL); Objects.requireNonNull(value, VALUE_MUST_NOT_BE_NULL); - this.keyListOfValuesPairList.add(new KeyValuePair<>(name, value)); + this.optionsWithMultipleValues.add(new KeyValuePair<>(name, value)); return this; } @@ -225,7 +225,7 @@ private String[] buildCommand() { command.add(value); }); - keyListOfValuesPairList.forEach(entry -> entry.value().forEach(value -> { + optionsWithMultipleValues.forEach(entry -> entry.value().forEach(value -> { command.add(String.format("--%s", entry.key())); command.add(value); })); diff --git a/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/model/install/InstallChartOptions.java b/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/model/install/InstallChartOptions.java index de5f1b034..2a3ac661e 100644 --- a/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/model/install/InstallChartOptions.java +++ b/fullstack-helm-client/src/main/java/com/hedera/fullstack/helm/client/model/install/InstallChartOptions.java @@ -98,7 +98,7 @@ public void apply(final HelmExecutionBuilder builder) { } if (set() != null) { - builder.keyListOfValuesPair("set", set()); + builder.optionsWithMultipleValues("set", set()); } if (timeout() != null) { @@ -110,7 +110,7 @@ public void apply(final HelmExecutionBuilder builder) { } if (values() != null) { - builder.keyListOfValuesPair("values", values()); + builder.optionsWithMultipleValues("values", values()); } if (version() != null) { diff --git a/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/execution/HelmExecutionBuilderTest.java b/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/execution/HelmExecutionBuilderTest.java index 3ddf11a49..ee443fc5e 100644 --- a/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/execution/HelmExecutionBuilderTest.java +++ b/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/execution/HelmExecutionBuilderTest.java @@ -25,14 +25,14 @@ class HelmExecutionBuilderTest { @Test - @DisplayName("Test keyListOfValuesPair null checks") - void testKeyListOfValuesPairNullChecks() { + @DisplayName("Test optionsWithMultipleValues null checks") + void testOptionsWithMultipleValuesNullChecks() { HelmExecutionBuilder builder = new HelmExecutionBuilder(new File(".").toPath()); assertThrows(NullPointerException.class, () -> { - builder.keyListOfValuesPair(null, null); + builder.optionsWithMultipleValues(null, null); }); assertThrows(NullPointerException.class, () -> { - builder.keyListOfValuesPair("test string", null); + builder.optionsWithMultipleValues("test string", null); }); } diff --git a/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/model/InstallChartOptionsBuilderTest.java b/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/model/InstallChartOptionsBuilderTest.java index d89022c5b..09442bb2c 100644 --- a/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/model/InstallChartOptionsBuilderTest.java +++ b/fullstack-helm-client/src/test/java/com/hedera/fullstack/helm/client/test/model/InstallChartOptionsBuilderTest.java @@ -81,6 +81,6 @@ void testInstallChartOptionsBuilder() { options.apply(builderMock); - verify(builderMock, times(2)).keyListOfValuesPair(anyString(), anyList()); + verify(builderMock, times(2)).optionsWithMultipleValues(anyString(), anyList()); } }