-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10719] Destination Oracle: custom JDBC parameters #13841
Changes from all commits
daac436
92581fa
026d5c2
9ff19cb
1e551a0
a998887
aaf989d
4bd070a
626363a
ed8b4c7
dc7fc33
7d267c6
61552c4
fdb2902
b78c2a3
0563aab
7faa356
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
package io.airbyte.integrations.destination.oracle; | ||
|
||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
|
@@ -18,7 +20,7 @@ | |
import java.sql.SQLException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class NneOracleDestinationAcceptanceTest extends UnencryptedOracleDestinationAcceptanceTest { | ||
|
||
|
@@ -48,7 +50,7 @@ public void testEncryption() throws SQLException { | |
final List<JsonNode> collect = database.queryJsons(networkServiceBanner); | ||
|
||
assertThat(collect.get(2).get("NETWORK_SERVICE_BANNER").asText(), | ||
equals("Oracle Advanced Security: " + algorithm + " encryption")); | ||
is(equalTo("AES256 Encryption service adapter for Linux: Version 18.0.0.0.0 - Production"))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does this PR change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
private Map<String, String> getAdditionalProperties(final String algorithm) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,11 @@ | |
|
||
package io.airbyte.integrations.destination.oracle; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static io.airbyte.integrations.util.HostPortResolver.resolveHost; | ||
import static io.airbyte.integrations.util.HostPortResolver.resolvePort; | ||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
@@ -22,11 +26,12 @@ | |
import io.airbyte.integrations.standardtest.destination.DestinationAcceptanceTest; | ||
import io.airbyte.integrations.standardtest.destination.comparator.TestDataComparator; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import javax.sql.DataSource; | ||
import org.jooq.DSLContext; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Test; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above - not sure about the reason for changing the unit test library |
||
|
||
public class UnencryptedOracleDestinationAcceptanceTest extends DestinationAcceptanceTest { | ||
|
||
|
@@ -43,8 +48,8 @@ protected String getImageName() { | |
private JsonNode getConfig(final OracleContainer db) { | ||
|
||
return Jsons.jsonNode(ImmutableMap.builder() | ||
.put(JdbcUtils.HOST_KEY, db.getHost()) | ||
.put(JdbcUtils.PORT_KEY, db.getFirstMappedPort()) | ||
.put(JdbcUtils.HOST_KEY, resolveHost(db)) | ||
.put(JdbcUtils.PORT_KEY, resolvePort(db)) | ||
.put("sid", db.getSid()) | ||
.put(JdbcUtils.USERNAME_KEY, db.getUsername()) | ||
.put(JdbcUtils.PASSWORD_KEY, db.getPassword()) | ||
|
@@ -62,9 +67,9 @@ protected JsonNode getConfig() { | |
|
||
@Override | ||
protected List<JsonNode> retrieveRecords(final TestDestinationEnv env, | ||
final String streamName, | ||
final String namespace, | ||
final JsonNode streamSchema) | ||
final String streamName, | ||
final String namespace, | ||
final JsonNode streamSchema) | ||
throws Exception { | ||
return retrieveRecordsFromTable(namingResolver.getRawTableName(streamName), namespace) | ||
.stream() | ||
|
@@ -105,8 +110,8 @@ protected boolean supportObjectDataTypeTest() { | |
|
||
@Override | ||
protected List<JsonNode> retrieveNormalizedRecords(final TestDestinationEnv env, | ||
final String streamName, | ||
final String namespace) | ||
final String streamName, | ||
final String namespace) | ||
throws Exception { | ||
final String tableName = namingResolver.getIdentifier(streamName); | ||
return retrieveRecordsFromTable(tableName, namespace); | ||
|
@@ -123,11 +128,9 @@ private List<JsonNode> retrieveRecordsFromTable(final String tableName, final St | |
throws SQLException { | ||
try (final DSLContext dslContext = getDSLContext(config)) { | ||
final List<org.jooq.Record> result = getDatabase(dslContext) | ||
.query(ctx -> ctx.fetch( | ||
.query(ctx -> new ArrayList<>(ctx.fetch( | ||
String.format("SELECT * FROM %s.%s ORDER BY %s ASC", schemaName, tableName, | ||
OracleDestination.COLUMN_NAME_EMITTED_AT)) | ||
.stream() | ||
.collect(Collectors.toList())); | ||
OracleDestination.COLUMN_NAME_EMITTED_AT)))); | ||
return result | ||
.stream() | ||
.map(r -> r.formatJSON(JdbcUtils.getDefaultJSONFormat())) | ||
|
@@ -194,8 +197,8 @@ public void testNoneEncryption() throws SQLException { | |
"select network_service_banner from v$session_connect_info where sid in (select distinct sid from v$mystat)"; | ||
final List<JsonNode> collect = database.queryJsons(networkServiceBanner); | ||
|
||
assertTrue(collect.get(1).get("NETWORK_SERVICE_BANNER").asText() | ||
.contains("Oracle Advanced Security: encryption")); | ||
assertThat(collect.get(1).get("NETWORK_SERVICE_BANNER").asText(), | ||
is(equalTo("Encryption service for Linux: Version 18.0.0.0.0 - Production"))); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this change doing and why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our main test suite is running on the Junit5 version, but the
Test
annotation was added from the Junit4 version, that's why it was not triggered by/test
in the past, this update fixes the described issue