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

support geodist, getbit, setbit and xack with GlideString #1635

Merged

Conversation

alon-arenberg
Copy link
Collaborator

support geodist, getbit, setbit and xack with GlideString

@alon-arenberg alon-arenberg requested a review from a team as a code owner June 24, 2024 11:01
@Yury-Fridlyand Yury-Fridlyand added the java issues and fixes related to the java client label Jun 24, 2024
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

Add IT

* members do not exist, or if the key does not exist, returns <code>null</code>.
* @example
* <pre>{@code
* Double result = client.geodist("mySortedSet", "Palermo", "Catania", GeoUnit.KILOMETERS).get();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Double result = client.geodist("mySortedSet", "Palermo", "Catania", GeoUnit.KILOMETERS).get();
* Double result = client.geodist(gs("mySortedSet"), gs("Palermo"), gs("Catania"), GeoUnit.KILOMETERS).get();

@@ -4737,6 +4755,8 @@ public void setbit(BaseClient client) {

assertEquals(0, client.setbit(key1, 0, 1).get());
assertEquals(1, client.setbit(key1, 0, 0).get());
assertEquals(0, client.setbit(gs(key1.getBytes()), 0, 1).get());
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use gs(key1) no need for getBytes

assertEquals(OK, client.set(key1, value).get());
assertEquals(1, client.getbit(key1, 1).get());
assertEquals(0, client.getbit(key1, 1000).get());
assertEquals(0, client.getbit(missingKey, 1).get());
assertEquals(1, client.getbit(gs(key1.getBytes()), 1).get());
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Double actualKM = client.geodist(key1, member1, member2, geoUnitKM).get();
Double actualKM =
client
.geodist(gs(key1.getBytes()), gs(member1.getBytes()), gs(member2.getBytes()), geoUnitKM)
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment below: gs can accept string directly

Comment on lines +3652 to +3656
assertEquals(
2L,
client
.xack(gs(key), gs(groupName), new GlideString[] {gs(streamid_1), gs(streamid_2)})
.get());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please duplicate the test instead of leaving old xack untested - like you did for setbit.

Comment on lines +4633 to +4637
Double actual = client.geodist(gs(key1), gs(member1), gs(member2)).get();
assertEquals(expected, actual, delta);

// assert correct result with manual metric specification kilometers
Double actualKM = client.geodist(key1, member1, member2, geoUnitKM).get();
Double actualKM = client.geodist(gs(key1), gs(member1), gs(member2), geoUnitKM).get();
Copy link
Collaborator

Choose a reason for hiding this comment

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

same for geodist

@alon-arenberg alon-arenberg merged commit 5b3f7ca into valkey-io:main Jun 26, 2024
12 checks passed
jduo pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 28, 2024
…1635)

* support geodist, getbit, setbit and xack with GlideString

* add to integration tests the use of the API with GlideString parameters

* nit: apply spotlessApply

* remove calls to getBytes()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues and fixes related to the java client
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants