-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c7ec4d
commit 42f5484
Showing
13 changed files
with
868 additions
and
578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
java/client/src/main/java/glide/api/models/configuration/ProtocolVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ | ||
package glide.api.models.configuration; | ||
|
||
/** Represents the communication protocol with the server. */ | ||
public enum ProtocolVersion { | ||
/** Use RESP2 to communicate with the server nodes. */ | ||
RESP3, | ||
/** Use RESP3 to communicate with the server nodes. */ | ||
RESP2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ | ||
package glide; | ||
|
||
import static glide.TestUtilities.commonClientConfig; | ||
import static glide.TestUtilities.commonClusterClientConfig; | ||
|
||
import glide.api.GlideClient; | ||
import glide.api.models.configuration.GlideClientConfiguration; | ||
import glide.api.models.configuration.NodeAddress; | ||
import glide.api.GlideClusterClient; | ||
import glide.api.models.configuration.ProtocolVersion; | ||
import lombok.SneakyThrows; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.Timeout; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.EnumSource; | ||
|
||
@Timeout(10) // seconds | ||
public class ConnectionTests { | ||
|
||
@Test | ||
@ParameterizedTest | ||
@EnumSource(ProtocolVersion.class) | ||
@SneakyThrows | ||
public void basic_client() { | ||
public void basic_client(ProtocolVersion protocol) { | ||
var regularClient = | ||
GlideClient.createClient( | ||
GlideClientConfiguration.builder() | ||
.address( | ||
NodeAddress.builder().port(TestConfiguration.STANDALONE_PORTS[0]).build()) | ||
.build()) | ||
.get(); | ||
GlideClient.createClient(commonClientConfig().protocol(protocol).build()).get(); | ||
regularClient.close(); | ||
} | ||
|
||
@Test | ||
@ParameterizedTest | ||
@EnumSource(ProtocolVersion.class) | ||
@SneakyThrows | ||
public void cluster_client() { | ||
var regularClient = | ||
GlideClient.createClient( | ||
GlideClientConfiguration.builder() | ||
.address(NodeAddress.builder().port(TestConfiguration.CLUSTER_PORTS[0]).build()) | ||
.build()) | ||
public void cluster_client(ProtocolVersion protocol) { | ||
var clusterClient = | ||
GlideClusterClient.createClient(commonClusterClientConfig().protocol(protocol).build()) | ||
.get(); | ||
regularClient.close(); | ||
clusterClient.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.