diff --git a/java/client/src/main/java/glide/api/GlideClient.java b/java/client/src/main/java/glide/api/GlideClient.java index 32c5a5cc28..b2cdb33bde 100644 --- a/java/client/src/main/java/glide/api/GlideClient.java +++ b/java/client/src/main/java/glide/api/GlideClient.java @@ -50,7 +50,7 @@ import glide.api.models.GlideString; import glide.api.models.Transaction; import glide.api.models.commands.FlushMode; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.SortOptions; import glide.api.models.commands.SortOptionsBinary; import glide.api.models.commands.function.FunctionRestorePolicy; @@ -60,6 +60,7 @@ import java.util.Arrays; import java.util.Map; import java.util.concurrent.CompletableFuture; +import java.util.stream.Stream; import lombok.NonNull; import org.apache.commons.lang3.ArrayUtils; @@ -135,8 +136,11 @@ public CompletableFuture info() { } @Override - public CompletableFuture info(@NonNull InfoOptions options) { - return commandManager.submitNewCommand(Info, options.toArgs(), this::handleStringResponse); + public CompletableFuture info(@NonNull Section[] sections) { + return commandManager.submitNewCommand( + Info, + Stream.of(sections).map(Enum::toString).toArray(String[]::new), + this::handleStringResponse); } @Override diff --git a/java/client/src/main/java/glide/api/GlideClusterClient.java b/java/client/src/main/java/glide/api/GlideClusterClient.java index 2eb52c10ef..ac0cd0aa58 100644 --- a/java/client/src/main/java/glide/api/GlideClusterClient.java +++ b/java/client/src/main/java/glide/api/GlideClusterClient.java @@ -54,7 +54,7 @@ import glide.api.models.ClusterValue; import glide.api.models.GlideString; import glide.api.models.commands.FlushMode; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.SortClusterOptions; import glide.api.models.commands.function.FunctionRestorePolicy; import glide.api.models.commands.scan.ClusterScanCursor; @@ -70,6 +70,7 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.stream.Stream; import lombok.NonNull; import org.apache.commons.lang3.ArrayUtils; import response.ResponseOuterClass.Response; @@ -224,17 +225,19 @@ public CompletableFuture> info(@NonNull Route route) { } @Override - public CompletableFuture> info(@NonNull InfoOptions options) { + public CompletableFuture> info(@NonNull Section[] sections) { return commandManager.submitNewCommand( - Info, options.toArgs(), response -> ClusterValue.of(handleMapResponse(response))); + Info, + Stream.of(sections).map(Enum::toString).toArray(String[]::new), + response -> ClusterValue.of(handleMapResponse(response))); } @Override public CompletableFuture> info( - @NonNull InfoOptions options, @NonNull Route route) { + @NonNull Section[] sections, @NonNull Route route) { return commandManager.submitNewCommand( Info, - options.toArgs(), + Stream.of(sections).map(Enum::toString).toArray(String[]::new), route, response -> route instanceof SingleNodeRoute diff --git a/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java b/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java index 2d78572173..92293de532 100644 --- a/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/ServerManagementClusterCommands.java @@ -58,31 +58,33 @@ public interface ServerManagementClusterCommands { CompletableFuture> info(Route route); /** - * Gets information and statistics about the server. The command will be routed to all primary - * nodes. + * Gets information and statistics about the server.
+ * Starting from server version 7, command supports multiple section arguments.
+ * The command will be routed to all primary nodes. * * @see valkey.io for details. - * @param options A list of {@link InfoOptions.Section} values specifying which sections of + * @param sections A list of {@link InfoOptions.Section} values specifying which sections of * information to retrieve. When no parameter is provided, the {@link * InfoOptions.Section#DEFAULT} option is assumed. * @return A Map{@literal } with each address as the key and its * corresponding value is the information of the sections requested for the node. * @example *
{@code
-     * ClusterValue payload = clusterClient.info(InfoOptions.builder().section(STATS).build()).get();
+     * ClusterValue payload = clusterClient.info(new Section[] { Section.STATS }).get();
      * // By default, the command is sent to multiple nodes, expecting a MultiValue result.
      * for (Map.Entry entry : payload.getMultiValue().entrySet()) {
      *     System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue());
      * }
      * }
*/ - CompletableFuture> info(InfoOptions options); + CompletableFuture> info(Section[] sections); /** - * Gets information and statistics about the server. + * Gets information and statistics about the server.
+ * Starting from server version 7, command supports multiple section arguments. * * @see valkey.io for details. - * @param options A list of {@link InfoOptions.Section} values specifying which sections of + * @param sections A list of {@link InfoOptions.Section} values specifying which sections of * information to retrieve. When no parameter is provided, the {@link * InfoOptions.Section#DEFAULT} option is assumed. * @param route Specifies the routing configuration for the command. The client will route the @@ -93,12 +95,12 @@ public interface ServerManagementClusterCommands { * value is the information of the sections requested for the node. * @example *
{@code
-     * ClusterValue payload = clusterClient.info(InfoOptions.builder().section(STATS).build(), RANDOM).get();
+     * ClusterValue payload = clusterClient.info(new Section[] { Section.STATS }, RANDOM).get();
      * // Command sent to a single random node via RANDOM route, expecting SingleValue result.
      * assert data.getSingleValue().contains("total_net_input_bytes");
      * }
*/ - CompletableFuture> info(InfoOptions options, Route route); + CompletableFuture> info(Section[] sections, Route route); /** * Rewrites the configuration file with the current configuration.
diff --git a/java/client/src/main/java/glide/api/commands/ServerManagementCommands.java b/java/client/src/main/java/glide/api/commands/ServerManagementCommands.java index 68b4ac42a0..3617ce3af0 100644 --- a/java/client/src/main/java/glide/api/commands/ServerManagementCommands.java +++ b/java/client/src/main/java/glide/api/commands/ServerManagementCommands.java @@ -2,7 +2,6 @@ package glide.api.commands; import glide.api.models.commands.FlushMode; -import glide.api.models.commands.InfoOptions; import glide.api.models.commands.InfoOptions.Section; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -31,19 +30,20 @@ public interface ServerManagementCommands { CompletableFuture info(); /** - * Get information and statistics about the server. + * Get information and statistics about the server.
+ * Starting from server version 7, command supports multiple section arguments. * * @see valkey.io for details. - * @param options A list of {@link Section} values specifying which sections of information to + * @param sections A list of {@link Section} values specifying which sections of information to * retrieve. When no parameter is provided, the {@link Section#DEFAULT} option is assumed. * @return A String containing the information for the sections requested. * @example *
{@code
-     * String response = regularClient.info(InfoOptions.builder().section(STATS).build()).get();
+     * String response = regularClient.info(new Section[] { Section.STATS }).get();
      * assert response.contains("total_net_input_bytes");
      * }
*/ - CompletableFuture info(InfoOptions options); + CompletableFuture info(Section[] sections); /** * Changes the currently selected database. diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index d3ee0fe571..39f1314bd2 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -229,7 +229,6 @@ import glide.api.models.commands.ExpireOptions; import glide.api.models.commands.FlushMode; import glide.api.models.commands.GetExOptions; -import glide.api.models.commands.InfoOptions; import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.LInsertOptions.InsertPosition; import glide.api.models.commands.LPosOptions; @@ -406,15 +405,16 @@ public T info() { } /** - * Gets information and statistics about the server. + * Gets information and statistics about the server.
+ * Starting from server version 7, command supports multiple section arguments. * * @see valkey.io for details. - * @param options A list of {@link Section} values specifying which sections of information to + * @param sections A list of {@link Section} values specifying which sections of information to * retrieve. When no parameter is provided, the {@link Section#DEFAULT} option is assumed. * @return Command Response - A String containing the requested {@link Section}s. */ - public T info(@NonNull InfoOptions options) { - protobufTransaction.addCommands(buildCommand(Info, newArgsBuilder().add(options.toArgs()))); + public T info(@NonNull Section[] sections) { + protobufTransaction.addCommands(buildCommand(Info, newArgsBuilder().add(sections))); return getThis(); } diff --git a/java/client/src/main/java/glide/api/models/commands/InfoOptions.java b/java/client/src/main/java/glide/api/models/commands/InfoOptions.java index 081e11b7f8..45e088ab27 100644 --- a/java/client/src/main/java/glide/api/models/commands/InfoOptions.java +++ b/java/client/src/main/java/glide/api/models/commands/InfoOptions.java @@ -2,20 +2,14 @@ package glide.api.models.commands; import glide.api.commands.ServerManagementCommands; -import java.util.List; -import lombok.Builder; -import lombok.Singular; /** * Optional arguments to {@link ServerManagementCommands#info(InfoOptions)} * * @see valkey.io */ -@Builder public final class InfoOptions { - @Singular private final List
sections; - public enum Section { /** SERVER: General information about the server */ SERVER, @@ -52,13 +46,4 @@ public enum Section { /** EVERYTHING: Includes all and modules */ EVERYTHING, } - - /** - * Converts options enum into a String[] to add to the command request. - * - * @return String[] - */ - public String[] toArgs() { - return sections.stream().map(Object::toString).toArray(String[]::new); - } } diff --git a/java/client/src/test/java/glide/api/GlideClientTest.java b/java/client/src/test/java/glide/api/GlideClientTest.java index 37238ff997..284d5c356d 100644 --- a/java/client/src/test/java/glide/api/GlideClientTest.java +++ b/java/client/src/test/java/glide/api/GlideClientTest.java @@ -296,7 +296,7 @@ import glide.api.models.commands.ExpireOptions; import glide.api.models.commands.FlushMode; import glide.api.models.commands.GetExOptions; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.LPosOptions; import glide.api.models.commands.ListDirection; import glide.api.models.commands.RangeOptions; @@ -1692,8 +1692,7 @@ public void info_returns_success() { @Test public void info_with_multiple_InfoOptions_returns_success() { // setup - String[] arguments = - new String[] {InfoOptions.Section.ALL.toString(), InfoOptions.Section.DEFAULT.toString()}; + String[] arguments = new String[] {Section.ALL.toString(), Section.DEFAULT.toString()}; String testPayload = "Key: Value"; CompletableFuture testResponse = new CompletableFuture<>(); testResponse.complete(testPayload); @@ -1701,12 +1700,8 @@ public void info_with_multiple_InfoOptions_returns_success() { .thenReturn(testResponse); // exercise - InfoOptions options = - InfoOptions.builder() - .section(InfoOptions.Section.ALL) - .section(InfoOptions.Section.DEFAULT) - .build(); - CompletableFuture response = service.info(options); + Section[] sections = {Section.ALL, Section.DEFAULT}; + CompletableFuture response = service.info(sections); String payload = response.get(); // verify @@ -1725,7 +1720,7 @@ public void info_with_empty_InfoOptions_returns_success() { .thenReturn(testResponse); // exercise - CompletableFuture response = service.info(InfoOptions.builder().build()); + CompletableFuture response = service.info(new Section[0]); String payload = response.get(); // verify diff --git a/java/client/src/test/java/glide/api/GlideClusterClientTest.java b/java/client/src/test/java/glide/api/GlideClusterClientTest.java index 648c64bf33..64e57302ff 100644 --- a/java/client/src/test/java/glide/api/GlideClusterClientTest.java +++ b/java/client/src/test/java/glide/api/GlideClusterClientTest.java @@ -59,7 +59,7 @@ import glide.api.models.ClusterValue; import glide.api.models.GlideString; import glide.api.models.commands.FlushMode; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.SortBaseOptions.Limit; import glide.api.models.commands.SortClusterOptions; import glide.api.models.commands.function.FunctionLoadOptions; @@ -605,12 +605,8 @@ public void info_with_route_with_infoOptions_returns_string() { .thenReturn(testResponse); // exercise - InfoOptions options = - InfoOptions.builder() - .section(InfoOptions.Section.ALL) - .section(InfoOptions.Section.DEFAULT) - .build(); - CompletableFuture> response = service.info(options, route); + Section[] sections = {Section.ALL, Section.DEFAULT}; + CompletableFuture> response = service.info(sections, route); // verify assertEquals(testResponse.get(), response.get()); @@ -655,7 +651,7 @@ public void info_with_options_and_single_node_route_returns_single_value() { var data = "info string"; try (var client = new TestClient(commandManager, data)) { - var value = client.info(InfoOptions.builder().build(), RANDOM).get(); + var value = client.info(new Section[0], RANDOM).get(); assertAll( () -> assertTrue(value.hasSingleData()), () -> assertEquals(data, value.getSingleValue())); @@ -669,7 +665,7 @@ public void info_with_options_and_multi_node_route_returns_multi_value() { var data = Map.of("key1", "value1", "key2", "value2"); try (var client = new TestClient(commandManager, data)) { - var value = client.info(InfoOptions.builder().build(), ALL_NODES).get(); + var value = client.info(new Section[0], ALL_NODES).get(); assertAll( () -> assertTrue(value.hasMultiData()), () -> assertEquals(data, value.getMultiValue())); } diff --git a/java/integTest/src/test/java/glide/TestUtilities.java b/java/integTest/src/test/java/glide/TestUtilities.java index 40371498f7..053f60c9bd 100644 --- a/java/integTest/src/test/java/glide/TestUtilities.java +++ b/java/integTest/src/test/java/glide/TestUtilities.java @@ -14,7 +14,7 @@ import glide.api.GlideClusterClient; import glide.api.models.ClusterValue; import glide.api.models.GlideString; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.configuration.GlideClientConfiguration; import glide.api.models.configuration.GlideClusterClientConfiguration; import glide.api.models.configuration.NodeAddress; @@ -388,8 +388,7 @@ public static void waitForNotBusy(BaseClient client) { */ @SneakyThrows public static String getServerVersion(@NonNull final GlideClient glideClient) { - String infoResponse = - glideClient.info(InfoOptions.builder().section(InfoOptions.Section.SERVER).build()).get(); + String infoResponse = glideClient.info(new Section[] {Section.SERVER}).get(); Map infoResponseMap = parseInfoResponseToMap(infoResponse); if (infoResponseMap.containsKey(VALKEY_VERSION_KEY)) { return infoResponseMap.get(VALKEY_VERSION_KEY); diff --git a/java/integTest/src/test/java/glide/cluster/CommandTests.java b/java/integTest/src/test/java/glide/cluster/CommandTests.java index 989034d10a..4d8ae3f242 100644 --- a/java/integTest/src/test/java/glide/cluster/CommandTests.java +++ b/java/integTest/src/test/java/glide/cluster/CommandTests.java @@ -38,6 +38,7 @@ import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleSingleNodeRoute.RANDOM; import static glide.api.models.configuration.RequestRoutingConfiguration.SlotType.PRIMARY; import static glide.api.models.configuration.RequestRoutingConfiguration.SlotType.REPLICA; +import static glide.utils.ArrayTransformUtils.concatenateArrays; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -53,7 +54,7 @@ import glide.api.models.ClusterTransaction; import glide.api.models.ClusterValue; import glide.api.models.GlideString; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.ListDirection; import glide.api.models.commands.RangeOptions.RangeByIndex; import glide.api.models.commands.SortBaseOptions; @@ -305,16 +306,15 @@ public void info_with_multi_node_route() { @Test @SneakyThrows public void info_with_multiple_options() { - InfoOptions.InfoOptionsBuilder builder = InfoOptions.builder().section(CLUSTER); + Section[] sections = {CLUSTER}; if (SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0")) { - builder.section(CPU).section(MEMORY); + sections = concatenateArrays(sections, new Section[] {CPU, MEMORY}); } - InfoOptions options = builder.build(); - ClusterValue data = clusterClient.info(options).get(); + ClusterValue data = clusterClient.info(sections).get(); for (String info : data.getMultiValue().values()) { - for (String section : options.toArgs()) { + for (Section section : sections) { assertTrue( - info.toLowerCase().contains("# " + section.toLowerCase()), + info.toLowerCase().contains("# " + section.toString().toLowerCase()), "Section " + section + " is missing"); } } @@ -323,8 +323,7 @@ public void info_with_multiple_options() { @Test @SneakyThrows public void info_with_everything_option() { - InfoOptions options = InfoOptions.builder().section(EVERYTHING).build(); - ClusterValue data = clusterClient.info(options).get(); + ClusterValue data = clusterClient.info(new Section[] {EVERYTHING}).get(); assertTrue(data.hasMultiData()); for (String info : data.getMultiValue().values()) { for (String section : EVERYTHING_INFO_SECTIONS) { @@ -350,17 +349,16 @@ public void info_with_single_node_route_and_options() { var slotKey = (String) ((Object[]) ((Object[]) ((Object[]) slotData.getSingleValue())[0])[2])[2]; - InfoOptions.InfoOptionsBuilder builder = InfoOptions.builder().section(CLIENTS); + Section[] sections = {CLIENTS}; if (SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0")) { - builder.section(COMMANDSTATS).section(REPLICATION); + sections = concatenateArrays(sections, new Section[] {COMMANDSTATS, REPLICATION}); } - InfoOptions options = builder.build(); SlotKeyRoute routing = new SlotKeyRoute(slotKey, PRIMARY); - ClusterValue data = clusterClient.info(options, routing).get(); + ClusterValue data = clusterClient.info(sections, routing).get(); - for (String section : options.toArgs()) { + for (Section section : sections) { assertTrue( - data.getSingleValue().toLowerCase().contains("# " + section.toLowerCase()), + data.getSingleValue().toLowerCase().contains("# " + section.toString().toLowerCase()), "Section " + section + " is missing"); } } @@ -368,17 +366,16 @@ public void info_with_single_node_route_and_options() { @Test @SneakyThrows public void info_with_multi_node_route_and_options() { - InfoOptions.InfoOptionsBuilder builder = InfoOptions.builder().section(CLIENTS); + Section[] sections = {CLIENTS}; if (SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0")) { - builder.section(COMMANDSTATS).section(REPLICATION); + sections = concatenateArrays(sections, new Section[] {COMMANDSTATS, REPLICATION}); } - InfoOptions options = builder.build(); - ClusterValue data = clusterClient.info(options, ALL_NODES).get(); + ClusterValue data = clusterClient.info(sections, ALL_NODES).get(); for (String info : data.getMultiValue().values()) { - for (String section : options.toArgs()) { + for (Section section : sections) { assertTrue( - info.toLowerCase().contains("# " + section.toLowerCase()), + info.toLowerCase().contains("# " + section.toString().toLowerCase()), "Section " + section + " is missing"); } } @@ -447,14 +444,14 @@ public void clientGetName_with_multi_node_route() { @Test @SneakyThrows public void config_reset_stat() { - var data = clusterClient.info(InfoOptions.builder().section(STATS).build()).get(); + var data = clusterClient.info(new Section[] {STATS}).get(); String firstNodeInfo = getFirstEntryFromMultiValue(data); long value_before = getValueFromInfo(firstNodeInfo, "total_net_input_bytes"); var result = clusterClient.configResetStat().get(); assertEquals(OK, result); - data = clusterClient.info(InfoOptions.builder().section(STATS).build()).get(); + data = clusterClient.info(new Section[] {STATS}).get(); firstNodeInfo = getFirstEntryFromMultiValue(data); long value_after = getValueFromInfo(firstNodeInfo, "total_net_input_bytes"); assertTrue(value_after < value_before); @@ -463,7 +460,7 @@ public void config_reset_stat() { @Test @SneakyThrows public void config_rewrite_non_existent_config_file() { - var info = clusterClient.info(InfoOptions.builder().section(SERVER).build(), RANDOM).get(); + var info = clusterClient.info(new Section[] {SERVER}, RANDOM).get(); var configFile = parseInfoResponseToMap(info.getSingleValue()).get("config_file"); if (configFile.isEmpty()) { diff --git a/java/integTest/src/test/java/glide/standalone/CommandTests.java b/java/integTest/src/test/java/glide/standalone/CommandTests.java index 458c8edff1..a4cbd491ed 100644 --- a/java/integTest/src/test/java/glide/standalone/CommandTests.java +++ b/java/integTest/src/test/java/glide/standalone/CommandTests.java @@ -35,6 +35,7 @@ import static glide.api.models.commands.scan.ScanOptions.ObjectType.STRING; import static glide.cluster.CommandTests.DEFAULT_INFO_SECTIONS; import static glide.cluster.CommandTests.EVERYTHING_INFO_SECTIONS; +import static glide.utils.ArrayTransformUtils.concatenateArrays; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -48,7 +49,7 @@ import glide.api.GlideClient; import glide.api.models.GlideString; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.SortOptions; import glide.api.models.commands.SortOptionsBinary; import glide.api.models.commands.scan.ScanOptions; @@ -157,15 +158,14 @@ public void info_without_options() { @Test @SneakyThrows public void info_with_multiple_options() { - InfoOptions.InfoOptionsBuilder builder = InfoOptions.builder().section(CLUSTER); + Section[] sections = {CLUSTER}; if (SERVER_VERSION.isGreaterThanOrEqualTo("7.0.0")) { - builder.section(CPU).section(MEMORY); + sections = concatenateArrays(sections, new Section[] {CPU, MEMORY}); } - InfoOptions options = builder.build(); - String data = regularClient.info(options).get(); - for (String section : options.toArgs()) { + String data = regularClient.info(sections).get(); + for (Section section : sections) { assertTrue( - data.toLowerCase().contains("# " + section.toLowerCase()), + data.toLowerCase().contains("# " + section.toString().toLowerCase()), "Section " + section + " is missing"); } } @@ -173,8 +173,7 @@ public void info_with_multiple_options() { @Test @SneakyThrows public void info_with_everything_option() { - InfoOptions options = InfoOptions.builder().section(EVERYTHING).build(); - String data = regularClient.info(options).get(); + String data = regularClient.info(new Section[] {EVERYTHING}).get(); for (String section : EVERYTHING_INFO_SECTIONS) { assertTrue(data.contains("# " + section), "Section " + section + " is missing"); } @@ -285,13 +284,13 @@ public void clientGetName() { @Test @SneakyThrows public void config_reset_stat() { - String data = regularClient.info(InfoOptions.builder().section(STATS).build()).get(); + String data = regularClient.info(new Section[] {STATS}).get(); long value_before = getValueFromInfo(data, "total_net_input_bytes"); var result = regularClient.configResetStat().get(); assertEquals(OK, result); - data = regularClient.info(InfoOptions.builder().section(STATS).build()).get(); + data = regularClient.info(new Section[] {STATS}).get(); long value_after = getValueFromInfo(data, "total_net_input_bytes"); assertTrue(value_after < value_before); } @@ -299,7 +298,7 @@ public void config_reset_stat() { @Test @SneakyThrows public void config_rewrite_non_existent_config_file() { - var info = regularClient.info(InfoOptions.builder().section(SERVER).build()).get(); + var info = regularClient.info(new Section[] {SERVER}).get(); var configFile = parseInfoResponseToMap(info).get("config_file"); if (configFile.isEmpty()) { diff --git a/java/integTest/src/test/java/glide/standalone/TransactionTests.java b/java/integTest/src/test/java/glide/standalone/TransactionTests.java index e78f027c29..ff910673b1 100644 --- a/java/integTest/src/test/java/glide/standalone/TransactionTests.java +++ b/java/integTest/src/test/java/glide/standalone/TransactionTests.java @@ -7,6 +7,7 @@ import static glide.TestUtilities.generateLuaLibCode; import static glide.api.BaseClient.OK; import static glide.api.models.GlideString.gs; +import static glide.api.models.commands.InfoOptions.Section.CLUSTER; import static glide.api.models.commands.SortBaseOptions.OrderBy.DESC; import static glide.api.models.commands.scan.ScanOptions.ObjectType.HASH; import static glide.api.models.commands.scan.ScanOptions.ObjectType.LIST; @@ -28,7 +29,7 @@ import glide.api.GlideClient; import glide.api.models.GlideString; import glide.api.models.Transaction; -import glide.api.models.commands.InfoOptions; +import glide.api.models.commands.InfoOptions.Section; import glide.api.models.commands.SortOptions; import glide.api.models.commands.function.FunctionRestorePolicy; import glide.api.models.commands.scan.ScanOptions; @@ -77,10 +78,7 @@ public void custom_command_info() { @Test @SneakyThrows public void info_test() { - Transaction transaction = - new Transaction() - .info() - .info(InfoOptions.builder().section(InfoOptions.Section.CLUSTER).build()); + Transaction transaction = new Transaction().info().info(new Section[] {CLUSTER}); Object[] result = client.exec(transaction).get(); // sanity check