Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Fix lpopCount null handling #3025

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Go: Add `BZPopMin` ([#2849](https://github.com/valkey-io/valkey-glide/pull/2849))
* Java: Shadow `protobuf` dependency ([#2931](https://github.com/valkey-io/valkey-glide/pull/2931))
* Java: Add `RESP2` support ([#2383](https://github.com/valkey-io/valkey-glide/pull/2383))
* Java: Fix `lpopCount` null handling ([#3025](https://github.com/valkey-io/valkey-glide/pull/3025))
jamesx-improving marked this conversation as resolved.
Show resolved Hide resolved
* Node, Python: Add `IFEQ` option ([#2909](https://github.com/valkey-io/valkey-glide/pull/2909), [#2962](https://github.com/valkey-io/valkey-glide/pull/2962))

#### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions java/client/src/main/java/glide/api/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1384,15 +1384,15 @@ public CompletableFuture<String[]> lpopCount(@NonNull String key, long count) {
return commandManager.submitNewCommand(
LPop,
new String[] {key, Long.toString(count)},
response -> castArray(handleArrayResponse(response), String.class));
response -> castArray(handleArrayOrNullResponse(response), String.class));
}

@Override
public CompletableFuture<GlideString[]> lpopCount(@NonNull GlideString key, long count) {
return commandManager.submitNewCommand(
LPop,
new GlideString[] {key, gs(Long.toString(count))},
response -> castArray(handleArrayResponseBinary(response), GlideString.class));
response -> castArray(handleArrayOrNullResponseBinary(response), GlideString.class));
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions java/integTest/src/test/java/glide/SharedCommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@ public void lpush_lpop_lrange_existing_non_existing_key(BaseClient client) {
assertArrayEquals(new String[] {"value2", "value3"}, client.lpopCount(key, 2).get());
assertArrayEquals(new String[] {}, client.lrange("non_existing_key", 0, -1).get());
assertNull(client.lpop("non_existing_key").get());
assertNull(client.lpopCount("non_existing_key", 2).get());
}

@SneakyThrows
Expand All @@ -1714,6 +1715,7 @@ public void lpush_lpop_lrange_binary_existing_non_existing_key(BaseClient client
new GlideString[] {gs("value2"), gs("value3")}, client.lpopCount(key, 2).get());
assertArrayEquals(new GlideString[] {}, client.lrange(gs("non_existing_key"), 0, -1).get());
assertNull(client.lpop(gs("non_existing_key")).get());
assertNull(client.lpopCount(gs("non_existing_key"), 2).get());
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Comment on lines -26 to -27
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collateral spotless damage from #3022


@Timeout(10) // seconds
public class StandaloneClientTests {
Expand Down
Loading