Skip to content

Commit

Permalink
Merge pull request #11 from dinukaamarasinghe817/connection-uri
Browse files Browse the repository at this point in the history
Update configs to use Redis connector v3
  • Loading branch information
dinukaamarasinghe817 authored Mar 11, 2024
2 parents 3882e93 + ffcc09f commit 1f4179e
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Ballerina"]
keywords = ["persist", "redis", "experimental"]
repository = "https://github.com/ballerina-platform/module-ballerinax-persist.redis"
license = ["Apache-2.0"]
distribution = "2201.8.0"
distribution = "2201.9.0"

[platform.java17]
graalvmCompatible = true
Expand Down
41 changes: 39 additions & 2 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.2"
distribution-version = "2201.9.0-20240229-103900-a949e6d4"

[[package]]
org = "ballerina"
name = "crypto"
version = "2.6.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
]

[[package]]
org = "ballerina"
Expand All @@ -24,6 +33,26 @@ modules = [
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.__internal"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.object"}
]

[[package]]
org = "ballerina"
name = "lang.array"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.__internal"}
]

[[package]]
org = "ballerina"
name = "lang.error"
Expand All @@ -33,6 +62,12 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "lang.object"
version = "0.0.0"
scope = "testOnly"

[[package]]
org = "ballerina"
name = "lang.regexp"
Expand Down Expand Up @@ -92,6 +127,7 @@ version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.array"},
{org = "ballerina", name = "lang.error"}
]
modules = [
Expand Down Expand Up @@ -129,8 +165,9 @@ modules = [
[[package]]
org = "ballerinax"
name = "redis"
version = "2.6.0"
version = "3.0.0"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"}
]
modules = [
Expand Down
12 changes: 1 addition & 11 deletions ballerina/tests/Config.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
[redis]
host="localhost"
port=6379
password=""

[redis.connectionOptions]
connectionPooling = false
isClusterConnection = false
ssl = false
startTls = false
verifyPeer = false
connectionTimeout = 5000
connection = "redis://localhost:6379"
14 changes: 6 additions & 8 deletions ballerina/tests/init-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ import ballerina/time;
import ballerinax/redis;

configurable record {|
int port;
string host;
string password;
redis:Options connectionOptions = {};
|} redis = ?;
redis:ConnectionUri|redis:ConnectionParams connection?;
boolean connectionPooling = false;
boolean isClusterConnection = false;
redis:SecureSocket secureSocket?;
|} & readonly redis = ?;

@test:BeforeSuite
function initTests() returns error? {

redis:Client redisDbClient = check new (config = {host: string `${redis.host}:${redis.port}`,
password: redis.password, options: redis.connectionOptions});
redis:Client redisDbClient = check new (redis);
_ = check redisDbClient.close();
}

Expand Down
4 changes: 4 additions & 0 deletions ballerina/tests/persist/test_entities.bal
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type AllTypes record {|
string stringType;
time:Date dateType;
time:TimeOfDay timeOfDayType;
time:Utc utcType;
time:Civil civilType;
EnumType enumType;
boolean booleanTypeOptional?;
int intTypeOptional?;
Expand All @@ -40,6 +42,8 @@ type AllTypes record {|
string stringTypeOptional?;
time:Date dateTypeOptional?;
time:TimeOfDay timeOfDayTypeOptional?;
time:Utc utcTypeOptional?;
time:Civil civilTypeOptional?;
EnumType enumTypeOptional?;
|};

Expand Down
3 changes: 1 addition & 2 deletions ballerina/tests/redis_rainier_generated_client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ public isolated client class RedisRainierClient {
};

public isolated function init() returns persist:Error? {
redis:Client|error dbClient = new (config = { host: redis.host+":"+redis.port.toString(),
password: redis.password, options: redis.connectionOptions });
redis:Client|error dbClient = new (redis);
if dbClient is error {
return <persist:Error>error(dbClient.message());
}
Expand Down
3 changes: 1 addition & 2 deletions ballerina/tests/redis_test_entities_generated_client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ public isolated client class RedisTestEntitiesClient {
};

public isolated function init() returns persist:Error? {
redis:Client|error dbClient = new (config = { host: redis.host+":"+redis.port.toString(),
password: redis.password, options: redis.connectionOptions });
redis:Client|error dbClient = new (redis);
if dbClient is error {
return <persist:Error>error(dbClient.message());
}
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Ballerina"]
keywords = ["persist", "redis", "experimental"]
repository = "https://github.com/ballerina-platform/module-ballerinax-persist.redis"
license = ["Apache-2.0"]
distribution = "2201.8.0"
distribution = "2201.9.0"

[platform.java17]
graalvmCompatible = true
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ testngVersion=7.6.1
gsonVersion=2.10
ballerinaGradlePluginVersion=2.0.1

ballerinaLangVersion=2201.8.2
ballerinaLangVersion=2201.9.0-20240229-103900-a949e6d4

# Direct Dependencies
# Level 01
Expand Down Expand Up @@ -41,7 +41,7 @@ stdlibOAuth2Version=2.10.0
stdlibHttpVersion=2.10.0

# Level 08
stdlibRedisVersion=2.6.0
stdlibRedisVersion=3.0.0

# Level 09
stdlibPersistVersion=1.2.0
Expand Down

0 comments on commit 1f4179e

Please sign in to comment.