Skip to content

Commit

Permalink
Merge pull request #18 from aashikam/codecov
Browse files Browse the repository at this point in the history
Increase code cov
  • Loading branch information
niveathika authored Feb 13, 2024
2 parents 3526298 + 3c6ea8a commit f06f132
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerinax"
name = "aws.redshift"
version = "1.0.1"
version = "1.0.2"
authors = ["Ballerina"]
keywords = ["Data Warehouse", "Columnar Storage", "Cost/Paid", "vendor/aws"]
repository = "https://github.com/ballerina-platform/module-ballerinax-aws.redshift"
Expand All @@ -15,8 +15,8 @@ graalvmCompatible = true
[[platform.java11.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "aws.redshift-native"
version = "1.0.1"
path = "../native/build/libs/aws.redshift-native-1.0.1.jar"
version = "1.0.2-SNAPSHOT"
path = "../native/build/libs/aws.redshift-native-1.0.2-SNAPSHOT.jar"

[[platform.java11.dependency]]
groupId = "io.ballerina.stdlib"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ dependencies = [
[[package]]
org = "ballerinax"
name = "aws.redshift"
version = "1.0.1"
version = "1.0.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "log"},
Expand Down
29 changes: 29 additions & 0 deletions ballerina/tests/query-basic-tests.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2024 WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/sql;
import ballerina/test;

@test:Config {
groups: ["query-row"]
}
function TestConnectionClose() returns error? {
sql:ParameterizedQuery sqlQuery = `SELECT username FROM users WHERE user_id = 2;`;
Client dbClient = check new (jdbcUrl, user, password);
string stringVal = check dbClient->queryRow(sqlQuery);
test:assertEquals(stringVal, "JaneSmith");
check dbClient.close();
}
15 changes: 15 additions & 0 deletions ballerina/tests/setup-tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,20 @@ function beforeFunction() returns error? {
END;
$$;
`);
_ = check dbClient->execute(`
CREATE TABLE IF NOT EXISTS users (
user_id INT,
username VARCHAR(255),
email VARCHAR(255),
age INT
);
`);

_ = check dbClient->execute(`
INSERT INTO users (user_id, username, email, age) VALUES
(1, 'JohnDoe', '[email protected]', 25),
(2, 'JaneSmith', '[email protected]', 30),
(3, 'BobJohnson', '[email protected]', 22);
`);
check dbClient.close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,4 @@ public static final class SSL {
}
public static final String CONNECT_TIMEOUT = ".*(connect).*(timeout).*";
public static final String POOL_CONNECTION_TIMEOUT = "ConnectionTimeout";

/**
* Constants for Request Generated Keys field.
*/
public static final class RequestGeneratedKeysValues {
public static final String ALL = "ALL";
public static final String EXECUTE = "EXECUTE";
public static final String BATCH_EXECUTE = "BATCH_EXECUTE";
}
}

0 comments on commit f06f132

Please sign in to comment.