Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into update-driver
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
TharmiganK committed Aug 16, 2023
2 parents 7af0184 + 829aaeb commit 56e9edc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
22 changes: 11 additions & 11 deletions ballerina/tests/01-connection-init-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ isolated function testWithOptionsWithErroneousSSL() returns error? {

test:assertTrue(oracledbClient is error);
if oracledbClient is sql:ApplicationError {
test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " +
"IO Error: Connection closed"));
test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize " +
"pool: ORA-17002: I/O error: Connection closed,"), oracledbClient.message());
} else {
test:assertFail("Error Application Error expected");
}
Expand All @@ -178,8 +178,8 @@ isolated function testWithOptionsWithErroneousSSL() returns error? {

test:assertTrue(oracledbClient2 is error);
if oracledbClient2 is sql:ApplicationError {
test:assertTrue(oracledbClient2.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " +
"IO Error: Connection closed"));
test:assertTrue(oracledbClient2.message().startsWith("Error in SQL connector configuration: Failed to initialize " +
"pool: ORA-17002: I/O error: Connection closed,"), oracledbClient2.message());
} else {
test:assertFail("Error Application Error expected");
}
Expand All @@ -195,8 +195,8 @@ isolated function testWithOptionsWithErroneousSSL() returns error? {

test:assertTrue(oracledbClient3 is error);
if oracledbClient3 is sql:ApplicationError {
test:assertTrue(oracledbClient3.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " +
"IO Error: The Network Adapter could not establish the connection"));
test:assertTrue(oracledbClient3.message().startsWith("Error in SQL connector configuration: Failed to initialize " +
"pool: ORA-17957: Unable to initialize the key store."), oracledbClient3.message());
} else {
test:assertFail("Error ApplicatonError expected");
}
Expand Down Expand Up @@ -226,13 +226,14 @@ function testWithOptionsWithErroneousSSLCorrectPort() returns error? {
user = USER,
password = PASSWORD,
port = SSL_PORT,
database = DATABASE,
database = DATABASE,
options = options
);
test:assertTrue(oracledbClient is error);
if oracledbClient is sql:ApplicationError {
test:assertTrue(oracledbClient.message().startsWith("Error in SQL connector configuration: Failed to initialize pool: " +
"IO Error: IO Error PKIX path building failed: unable to find valid certification path to requested target"));
"ORA-17002: I/O error: IO Error PKIX path building failed: unable to find valid certification path to requested target"),
oracledbClient.message());
} else {
test:assertFail("Application Error expected");
}
Expand Down Expand Up @@ -262,10 +263,9 @@ function testWithOptionsWithErroneousSSLWrongPW() returns error? {
);
test:assertTrue(oracledbClient is error);
if oracledbClient is sql:ApplicationError {
test:assertTrue(oracledbClient.message().endsWith("The Network Adapter could not establish the connection Caused by " +
":Unable to initialize ssl context."));
test:assertTrue(oracledbClient.message().includes("keystore password was incorrect"), oracledbClient.message());
} else {
test:assertFail("Error ApplicatonError expected");
test:assertFail("Error ApplicationError expected");
}
}

Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/02-execute-basic-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ isolated function testUpdateTable() returns sql:Error? {
sql:ExecutionResult result = check executeQuery(
`UPDATE TestExecuteTable SET field2 = 'Hello, ballerina' WHERE field1 = 1`);
test:assertExactEquals(result.affectedRowCount, 1, "Affected row count is different.");
test:assertExactEquals(result.lastInsertId, (), "Last Insert Id should be null.");
test:assertTrue(result.lastInsertId is string);
}

@test:Config {
Expand Down
4 changes: 2 additions & 2 deletions ballerina/tests/12-custom-type-varray-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ isolated function insertVarrayWithMoreElements() returns sql:Error? {
sql:ParameterizedQuery insertQuery = `insert into TestVarrayTable (COL_CHARARR) values (${charVarray})`;
sql:ExecutionResult|sql:Error result = executeQuery(insertQuery);
if result is sql:DatabaseError {
test:assertTrue(result.message().includes("Error while executing SQL query: insert into TestVarrayTable " +
"(COL_CHARARR) values ( ? ). Exceeded maximum VARRAY limit ."));
test:assertTrue(result.message().includes("Error while executing SQL query: insert into TestVarrayTable " +
"(COL_CHARARR) values ( ? ). ORA-17071: Exceeded maximum VARRAY limit ."), result.message());
} else {
test:assertFail("Database Error expected.");
}
Expand Down
9 changes: 4 additions & 5 deletions ballerina/tests/14-error-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function TestLinkFailure() {
Client|error dbClient = new ("HOST", USER, PASSWORD, DATABASE, PORT);
test:assertTrue(dbClient is sql:ApplicationError);
sql:ApplicationError sqlerror = <sql:ApplicationError>dbClient;
test:assertTrue(strings:includes(sqlerror.message(), " IO Error: The Network Adapter could not establish " +
"the connection "), sqlerror.message());
test:assertTrue(strings:includes(sqlerror.message(), "Unknown host specified.: HOST:"), sqlerror.message());
}

@test:Config {
Expand All @@ -47,8 +46,8 @@ function TestInvalidDB() {
Client|error dbClient = new (HOST, USER, PASSWORD, "errorD", PORT);
test:assertTrue(dbClient is sql:ApplicationError);
sql:ApplicationError sqlerror = <sql:ApplicationError>dbClient;
test:assertTrue(strings:includes(sqlerror.message(), "TNS:listener does not currently know of service requested " +
"in connect descriptor"), sqlerror.message());
test:assertTrue(strings:includes(sqlerror.message(), "Service errorD is not registered with the listener at host "
+ "localhost port 1521."), sqlerror.message());
}

@test:Config {
Expand Down Expand Up @@ -303,6 +302,6 @@ function TestOverflowException() returns error? {
insertResult = dbClient->execute(insertQuery);
check dbClient.close();
sql:DatabaseError sqlerror = <sql:DatabaseError>insertResult;
test:assertTrue(strings:includes(sqlerror.message(), "Internal Error: Overflow Exception " +
test:assertTrue(strings:includes(sqlerror.message(), "Internal error: Overflow Exception " +
"trying to bind"), sqlerror.message());
}

0 comments on commit 56e9edc

Please sign in to comment.