Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipinofficial11 committed Oct 10, 2024
1 parent 3c675f4 commit ae059c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public String getConnectionString() {
@Nullable
public String useSSL;


@Override
protected int getDefaultPort() {
return 1521;
Expand All @@ -114,7 +113,6 @@ public String getSSlMode() {
return useSSL;
}


@Override
public Properties getConnectionArgumentsProperties() {
Properties prop = super.getConnectionArgumentsProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ private OracleConstants() {
}

public static final String PLUGIN_NAME = "Oracle";
// Updating connection strings to accept protocol (e.g., jdbc:oracle:thin:@<protocol>://<host>:<port>:<SID>)
public static final String ORACLE_CONNECTION_STRING_SID_FORMAT = "jdbc:oracle:thin:@%s://%s:%d:%s";
public static final String ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT = "jdbc:oracle:thin:@%s://%s:%d/%s";
// Updating connection strings to accept protocol (e.g., jdbc:oracle:thin:@<protocol>://<host>:<port>/<SID>)
public static final String ORACLE_CONNECTION_STRING_SID_FORMAT = "jdbc:oracle:thin:@%s:%s:%s/%s";
public static final String ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT = "jdbc:oracle:thin:@%s://%s:%s/%s";
public static final String ORACLE_CONNECTION_STRING_TNS_FORMAT = "jdbc:oracle:thin:@%s";
public static final String DEFAULT_BATCH_VALUE = "defaultBatchValue";
public static final String DEFAULT_ROW_PREFETCH = "defaultRowPrefetch";
Expand Down Expand Up @@ -60,10 +60,10 @@ public static String getConnectionString(String connectionType,
}
if (OracleConstants.SERVICE_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT,
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
}
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SID_FORMAT,
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
}

/**
Expand All @@ -74,7 +74,7 @@ public static String getConnectionString(String connectionType,
* @param host Host name of the oracle server
* @param port Port of the oracle server
* @param database Database to connect to
* @param useSSL Whether SSL/TLS is required(YES/NO)
* @param useSSL Whether SSL/TLS is required(YES/NO)
* @return Connection String based on the given parameters and connection type.
*/
public static String getConnectionString(String connectionType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void test() throws ClassNotFoundException, IOException {
new OracleConnectorConfig("localhost", 1521, "username", "password", "jdbc", "", "database"));

super.test(JDBC_DRIVER_CLASS_NAME, connector, "Failed to create connection to database via connection string:" +
" jdbc:oracle:thin:@localhost:1521:database and arguments: " +
" jdbc:oracle:thin:@tcp:localhost:1521/database and arguments: " +
"{user=username, oracle.jdbc.timezoneAsRegion=false, " +
"internal_logon=normal}. Error: ConnectException: Connection " +
"refused.");
Expand Down

0 comments on commit ae059c4

Please sign in to comment.