-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Showing
26 changed files
with
1,809 additions
and
1,633 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
...egration/java/io/airbyte/integrations/destination/redshift/RedshiftConnectionHandler.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...ntegration/java/io/airbyte/integrations/destination/redshift/RedshiftConnectionHandler.kt
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,24 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
package io.airbyte.integrations.destination.redshift | ||
|
||
import java.sql.Connection | ||
import java.sql.SQLException | ||
|
||
object RedshiftConnectionHandler { | ||
/** | ||
* For to close a connection. Aimed to be use in test only. | ||
* | ||
* @param connection The connection to close | ||
*/ | ||
fun close(connection: Connection?) { | ||
try { | ||
connection!!.autoCommit = false | ||
connection.commit() | ||
connection.close() | ||
} catch (e: SQLException) { | ||
throw RuntimeException(e) | ||
} | ||
} | ||
} |
56 changes: 0 additions & 56 deletions
56
...integration/java/io/airbyte/integrations/destination/redshift/RedshiftConnectionTest.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
...t-integration/java/io/airbyte/integrations/destination/redshift/RedshiftConnectionTest.kt
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,54 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
package io.airbyte.integrations.destination.redshift | ||
|
||
import com.fasterxml.jackson.databind.node.ObjectNode | ||
import io.airbyte.commons.io.IOs.readFile | ||
import io.airbyte.commons.json.Jsons.deserialize | ||
import io.airbyte.protocol.models.v0.AirbyteConnectionStatus | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
import java.nio.file.Path | ||
|
||
class RedshiftConnectionTest { | ||
private val config = deserialize(readFile(Path.of("secrets/config_staging.json"))) | ||
private val destination = RedshiftStagingS3Destination() | ||
private var status: AirbyteConnectionStatus? = null | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testCheckIncorrectPasswordFailure() { | ||
(config as ObjectNode).put("password", "fake") | ||
status = destination.check(config) | ||
Assertions.assertEquals(AirbyteConnectionStatus.Status.FAILED, status!!.status) | ||
Assertions.assertTrue(status!!.message.contains("State code: 28000;")) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testCheckIncorrectUsernameFailure() { | ||
(config as ObjectNode).put("username", "") | ||
status = destination.check(config) | ||
Assertions.assertEquals(AirbyteConnectionStatus.Status.FAILED, status!!.status) | ||
Assertions.assertTrue(status!!.message.contains("State code: 28000;")) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testCheckIncorrectHostFailure() { | ||
(config as ObjectNode).put("host", "localhost2") | ||
status = destination.check(config) | ||
Assertions.assertEquals(AirbyteConnectionStatus.Status.FAILED, status!!.status) | ||
Assertions.assertTrue(status!!.message.contains("State code: 08001;")) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testCheckIncorrectDataBaseFailure() { | ||
(config as ObjectNode).put("database", "wrongdatabase") | ||
status = destination.check(config) | ||
Assertions.assertEquals(AirbyteConnectionStatus.Status.FAILED, status!!.status) | ||
Assertions.assertTrue(status!!.message.contains("State code: 3D000;")) | ||
} | ||
} |
Oops, something went wrong.