diff --git a/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopier.kt b/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopier.kt index 251c39131b74..c1932fbe672b 100644 --- a/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopier.kt +++ b/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopier.kt @@ -66,7 +66,7 @@ abstract class AzureBlobStorageStreamCopier( } } - override fun prepareStagingFile(): String? { + override fun prepareStagingFile(): String { currentFile = prepareAzureStagingFile() val currentFile = this.currentFile!! if (!azureStagingFiles.contains(currentFile)) { diff --git a/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopierFactory.kt b/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopierFactory.kt index 5547d4eb28b5..c7f26567aa24 100644 --- a/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopierFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/azure-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/azure/AzureBlobStorageStreamCopierFactory.kt @@ -22,7 +22,7 @@ abstract class AzureBlobStorageStreamCopierFactory : StreamCopierFactory { - @Throws(SQLException::class) fun query(context: DSLContext?): T + @Throws(SQLException::class) fun query(context: DSLContext): T } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/DataTypeUtils.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/DataTypeUtils.kt index 167e5fc797f7..0efd0ba2bdae 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/DataTypeUtils.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/DataTypeUtils.kt @@ -49,13 +49,13 @@ object DataTypeUtils { @JvmStatic fun returnNullIfInvalid(valueProducer: DataTypeSupplier): T? { - return returnNullIfInvalid(valueProducer, Function { _: T? -> true }) + return returnNullIfInvalid(valueProducer, Function { _: T -> true }) } @JvmStatic fun returnNullIfInvalid( valueProducer: DataTypeSupplier, - isValidFn: Function + isValidFn: Function ): T? { // Some edge case values (e.g: Infinity, NaN) have no java or JSON equivalent, and will // throw an @@ -72,13 +72,13 @@ object DataTypeUtils { @JvmStatic fun throwExceptionIfInvalid(valueProducer: DataTypeSupplier): T? { - return throwExceptionIfInvalid(valueProducer, Function { _: T? -> true }) + return throwExceptionIfInvalid(valueProducer, Function { _: T -> true }) } @JvmStatic fun throwExceptionIfInvalid( valueProducer: DataTypeSupplier, - isValidFn: Function + isValidFn: Function ): T? { // Some edge case values (e.g: Infinity, NaN) have no java or JSON equivalent, and will // throw an diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/Database.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/Database.kt index 1cc63dfb35bc..de1427d710f3 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/Database.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/Database.kt @@ -9,7 +9,7 @@ import org.jooq.DSLContext import org.jooq.impl.DSL /** Database object for interacting with a Jooq connection. */ -open class Database(private val dslContext: DSLContext?) { +open class Database(protected val dslContext: DSLContext) { @Throws(SQLException::class) open fun query(transform: ContextQueryFunction): T? { return transform.query(dslContext) @@ -17,7 +17,7 @@ open class Database(private val dslContext: DSLContext?) { @Throws(SQLException::class) open fun transaction(transform: ContextQueryFunction): T? { - return dslContext!!.transactionResult { configuration: Configuration? -> + return dslContext.transactionResult { configuration: Configuration -> transform.query(DSL.using(configuration)) } } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/SqlDatabase.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/SqlDatabase.kt index 66aa08ad4789..3271f804a06a 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/SqlDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/SqlDatabase.kt @@ -10,5 +10,5 @@ abstract class SqlDatabase : AbstractDatabase() { @Throws(Exception::class) abstract fun execute(sql: String?) @Throws(Exception::class) - abstract fun unsafeQuery(sql: String?, vararg params: String?): Stream + abstract fun unsafeQuery(sql: String?, vararg params: String): Stream } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/AbstractJdbcCompatibleSourceOperations.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/AbstractJdbcCompatibleSourceOperations.kt index 675cd4a0e7ab..49696e37ef2f 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/AbstractJdbcCompatibleSourceOperations.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/AbstractJdbcCompatibleSourceOperations.kt @@ -175,7 +175,7 @@ abstract class AbstractJdbcCompatibleSourceOperations : columnName, DataTypeUtils.returnNullIfInvalid( { resultSet.getDouble(index) }, - { d: Double? -> java.lang.Double.isFinite(d!!) }, + { d: Double -> java.lang.Double.isFinite(d) }, ), ) } @@ -191,7 +191,7 @@ abstract class AbstractJdbcCompatibleSourceOperations : columnName, DataTypeUtils.returnNullIfInvalid( { resultSet.getFloat(index) }, - { f: Float? -> java.lang.Float.isFinite(f!!) }, + { f: Float -> java.lang.Float.isFinite(f) }, ), ) } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/DefaultJdbcDatabase.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/DefaultJdbcDatabase.kt index f3fbe2ee9cc3..0cd8733c0847 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/DefaultJdbcDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/DefaultJdbcDatabase.kt @@ -80,7 +80,7 @@ constructor( } } - override fun executeMetadataQuery(query: Function): T { + override fun executeMetadataQuery(query: Function): T { try { dataSource.connection.use { connection -> val metaData = connection.metaData diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/JdbcDatabase.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/JdbcDatabase.kt index 9f4ca36ca76d..93cc71c41cff 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/JdbcDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/db/jdbc/JdbcDatabase.kt @@ -168,7 +168,7 @@ abstract class JdbcDatabase(protected val sourceOperations: JdbcCompatibleSource */ @MustBeClosed @Throws(SQLException::class) - override fun unsafeQuery(sql: String?, vararg params: String?): Stream { + override fun unsafeQuery(sql: String?, vararg params: String): Stream { return unsafeQuery( { connection: Connection -> val statement = connection.prepareStatement(sql) @@ -188,7 +188,7 @@ abstract class JdbcDatabase(protected val sourceOperations: JdbcCompatibleSource * syntactic sugar. */ @Throws(SQLException::class) - fun queryJsons(sql: String?, vararg params: String?): List { + fun queryJsons(sql: String?, vararg params: String): List { unsafeQuery(sql, *params).use { stream -> return stream.toList() } @@ -208,7 +208,7 @@ abstract class JdbcDatabase(protected val sourceOperations: JdbcCompatibleSource @get:Throws(SQLException::class) abstract val metaData: DatabaseMetaData @Throws(SQLException::class) - abstract fun executeMetadataQuery(query: Function): T + abstract fun executeMetadataQuery(query: Function): T companion object { /** diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/AirbyteTraceMessageUtility.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/AirbyteTraceMessageUtility.kt index c72bc8d08643..905c4330bb1e 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/AirbyteTraceMessageUtility.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/AirbyteTraceMessageUtility.kt @@ -85,7 +85,7 @@ object AirbyteTraceMessageUtility { // Not sure why defaultOutputRecordCollector is under Destination specifically, // but this matches usage elsewhere in base-java val outputRecordCollector = - Consumer { m: AirbyteMessage? -> + Consumer { m: AirbyteMessage -> Destination.Companion.defaultOutputRecordCollector(m) } outputRecordCollector.accept(message) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt index 888d53475737..9a71536782b1 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunner.kt @@ -174,7 +174,7 @@ internal constructor( val catalog = parseConfig(parsed.getCatalogPath(), ConfiguredAirbyteCatalog::class.java)!! val stateOptional = - parsed.getStatePath().map { path: Path? -> parseConfig(path) } + parsed.getStatePath().map { path: Path -> parseConfig(path) } try { if (featureFlags.concurrentSourceStreamRead()) { LOGGER.info("Concurrent source stream read enabled.") @@ -251,11 +251,11 @@ internal constructor( messageIterator: AutoCloseableIterator, recordCollector: Consumer ) { - messageIterator.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + messageIterator.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("Producing messages for stream {}...", s) } messageIterator.forEachRemaining(recordCollector) - messageIterator.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + messageIterator.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("Finished producing messages for stream {}...", s) } } @@ -332,7 +332,7 @@ internal constructor( ) produceMessages(stream, streamStatusTrackingRecordConsumer) } catch (e: Exception) { - stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.error("Failed to consume from stream {}.", s, e) } throw RuntimeException(e) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnel.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnel.kt index eec3b24b6c0c..6d6d6f891620 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnel.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnel.kt @@ -519,7 +519,7 @@ constructor( portKey: List, wrapped: CheckedConsumer ) { - sshWrap(config, hostKey, portKey) { configInTunnel: JsonNode? -> + sshWrap(config, hostKey, portKey) { configInTunnel: JsonNode -> wrapped.accept(configInTunnel) null } @@ -532,7 +532,7 @@ constructor( endPointKey: String, wrapped: CheckedConsumer ) { - sshWrap(config, endPointKey) { configInTunnel: JsonNode? -> + sshWrap(config, endPointKey) { configInTunnel: JsonNode -> wrapped.accept(configInTunnel) null } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/CheckAndRemoveRecordWriter.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/CheckAndRemoveRecordWriter.kt index 3934b9659c4e..33ca98776fd0 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/CheckAndRemoveRecordWriter.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/CheckAndRemoveRecordWriter.kt @@ -12,5 +12,5 @@ fun interface CheckAndRemoveRecordWriter { * of the new file where the record will be sent will be returned. */ @Throws(Exception::class) - fun apply(stream: AirbyteStreamNameNamespacePair?, stagingFileName: String?): String? + fun apply(stream: AirbyteStreamNameNamespacePair, stagingFileName: String?): String? } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopier.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopier.kt index bb8530eb46b7..b3a7c8d756eb 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopier.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopier.kt @@ -62,7 +62,7 @@ interface StreamCopier { * @return A string that unqiuely identifies the file. E.g. the filename, or a unique suffix * that is appended to a shared filename prefix */ - fun prepareStagingFile(): String? + fun prepareStagingFile(): String /** @return current staging file name */ val currentFile: String? diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopierFactory.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopierFactory.kt index 12ffa9b5160a..eb0e9889504c 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopierFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/StreamCopierFactory.kt @@ -17,7 +17,7 @@ interface StreamCopierFactory { nameTransformer: StandardNameTransformer?, db: JdbcDatabase?, sqlOperations: SqlOperations? - ): StreamCopier? + ): StreamCopier companion object { @JvmStatic diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/normalization/NormalizationLogParser.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/normalization/NormalizationLogParser.kt index 025027218aa0..fb3ebd34736e 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/normalization/NormalizationLogParser.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/normalization/NormalizationLogParser.kt @@ -29,12 +29,12 @@ import org.apache.logging.log4j.util.Strings class NormalizationLogParser { val dbtErrors: MutableList = ArrayList() - fun create(bufferedReader: BufferedReader): Stream { + fun create(bufferedReader: BufferedReader): Stream { return bufferedReader.lines().flatMap { line: String -> this.toMessages(line) } } @VisibleForTesting - fun toMessages(line: String): Stream { + fun toMessages(line: String): Stream { if (Strings.isEmpty(line)) { return Stream.of(logMessage(AirbyteLogMessage.Level.INFO, "")) } @@ -51,7 +51,7 @@ class NormalizationLogParser { * * This is needed for dbt < 1.0.0, which don't support json-format logs. */ - private fun nonJsonLineToMessage(line: String): Stream { + private fun nonJsonLineToMessage(line: String): Stream { // Super hacky thing to try and detect error lines if (line.contains("[error]")) { dbtErrors.add(line) @@ -64,7 +64,7 @@ class NormalizationLogParser { * emit it without change), or it's dbt json log, and we need to do some extra work to convert * it to a log message + aggregate error logs. */ - private fun jsonToMessage(jsonLine: JsonNode): Stream { + private fun jsonToMessage(jsonLine: JsonNode): Stream { val message = Jsons.tryObject(jsonLine, AirbyteMessage::class.java) if (message.isPresent) { // This line is already an AirbyteMessage; we can just return it directly @@ -117,7 +117,7 @@ class NormalizationLogParser { normalizationLogParser.create( BufferedReader(InputStreamReader(System.`in`, StandardCharsets.UTF_8)) ) - airbyteMessageStream.forEachOrdered { message: AirbyteMessage? -> + airbyteMessageStream.forEachOrdered { message: AirbyteMessage -> println(Jsons.serialize(message)) } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/InMemoryRecordBufferingStrategy.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/InMemoryRecordBufferingStrategy.kt index 2e5efbb4a54d..70dfaffbf1e9 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/InMemoryRecordBufferingStrategy.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/InMemoryRecordBufferingStrategy.kt @@ -52,7 +52,7 @@ class InMemoryRecordBufferingStrategy( } val bufferedRecords = - streamBuffer.computeIfAbsent(stream) { _: AirbyteStreamNameNamespacePair? -> + streamBuffer.computeIfAbsent(stream) { _: AirbyteStreamNameNamespacePair -> ArrayList() } bufferedRecords.add(message.record) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategy.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategy.kt index ad91b9449d37..5249d5313f0c 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategy.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategy.kt @@ -89,7 +89,7 @@ class SerializedBufferingStrategy * computed buffer */ private fun getOrCreateBuffer(stream: AirbyteStreamNameNamespacePair): SerializableBuffer { - return allBuffers.computeIfAbsent(stream) { _: AirbyteStreamNameNamespacePair? -> + return allBuffers.computeIfAbsent(stream) { _: AirbyteStreamNameNamespacePair -> LOGGER.info( "Starting a new buffer for stream {} (current state: {} in {} buffers)", stream.name, diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/ConnectorExceptionUtil.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/ConnectorExceptionUtil.kt index c38c74a79d66..a3a900c25b8a 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/ConnectorExceptionUtil.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/ConnectorExceptionUtil.kt @@ -83,7 +83,7 @@ object ConnectorExceptionUtil { val stacktraces = throwables .stream() - .map { throwable: Throwable? -> ExceptionUtils.getStackTrace(throwable) } + .map { throwable: Throwable -> ExceptionUtils.getStackTrace(throwable) } .collect(Collectors.joining("\n")) LOGGER.error("$initialMessage$stacktraces\nRethrowing first exception.") throw throwables.iterator().next() diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/concurrent/ConcurrentStreamConsumer.kt b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/concurrent/ConcurrentStreamConsumer.kt index d1e9e6928f64..2fec67748569 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/concurrent/ConcurrentStreamConsumer.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/util/concurrent/ConcurrentStreamConsumer.kt @@ -181,18 +181,18 @@ class ConcurrentStreamConsumer( private fun executeStream(stream: AutoCloseableIterator) { try { stream.use { - stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("Consuming from stream {}...", s) } StreamStatusUtils.emitStartStreamStatus(stream, streamStatusEmitter) streamConsumer.accept(stream) StreamStatusUtils.emitCompleteStreamStatus(stream, streamStatusEmitter) - stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("Consumption from stream {} complete.", s) } } } catch (e: Exception) { - stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + stream.airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.error("Unable to consume from stream {}.", s, e) } StreamStatusUtils.emitIncompleteStreamStatus(stream, streamStatusEmitter) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/CommonFactoryTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/CommonFactoryTest.kt index de8866e8ff99..f7202491aeea 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/CommonFactoryTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/CommonFactoryTest.kt @@ -20,13 +20,13 @@ internal open class CommonFactoryTest { @BeforeAll fun dbSetup(): Unit { container.withDatabaseName(DATABASE_NAME).withUsername("docker").withPassword("docker") - container!!.start() + container.start() } @JvmStatic @AfterAll fun dbDown(): Unit { - container!!.close() + container.close() } } } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DSLContextFactoryTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DSLContextFactoryTest.kt index 0eb418038851..d9f1464b6b46 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DSLContextFactoryTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DSLContextFactoryTest.kt @@ -4,7 +4,6 @@ package io.airbyte.cdk.db.factory import io.airbyte.cdk.integrations.JdbcConnector -import java.util.Map import org.jooq.SQLDialect import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -15,10 +14,10 @@ internal class DSLContextFactoryTest : CommonFactoryTest() { fun testCreatingADslContext() { val dataSource = DataSourceFactory.create( - CommonFactoryTest.Companion.container!!.getUsername(), - CommonFactoryTest.Companion.container!!.getPassword(), - CommonFactoryTest.Companion.container!!.getDriverClassName(), - CommonFactoryTest.Companion.container!!.getJdbcUrl() + container.username, + container.password, + container.driverClassName, + container.getJdbcUrl() ) val dialect = SQLDialect.POSTGRES val dslContext = DSLContextFactory.create(dataSource, dialect) @@ -31,10 +30,10 @@ internal class DSLContextFactoryTest : CommonFactoryTest() { val dialect = SQLDialect.POSTGRES val dslContext = DSLContextFactory.create( - CommonFactoryTest.Companion.container!!.getUsername(), - CommonFactoryTest.Companion.container!!.getPassword(), - CommonFactoryTest.Companion.container!!.getDriverClassName(), - CommonFactoryTest.Companion.container!!.getJdbcUrl(), + container.username, + container.password, + container.driverClassName, + container.getJdbcUrl(), dialect ) Assertions.assertNotNull(dslContext) @@ -43,14 +42,14 @@ internal class DSLContextFactoryTest : CommonFactoryTest() { @Test fun testCreatingADslContextWithIndividualConfigurationAndConnectionProperties() { - val connectionProperties = Map.of("foo", "bar") + val connectionProperties = mapOf("foo" to "bar") val dialect = SQLDialect.POSTGRES val dslContext = DSLContextFactory.create( - CommonFactoryTest.Companion.container!!.getUsername(), - CommonFactoryTest.Companion.container!!.getPassword(), - CommonFactoryTest.Companion.container!!.getDriverClassName(), - CommonFactoryTest.Companion.container!!.getJdbcUrl(), + container.username, + container.password, + container.driverClassName, + container.getJdbcUrl(), dialect, connectionProperties, JdbcConnector.CONNECT_TIMEOUT_DEFAULT diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DataSourceFactoryTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DataSourceFactoryTest.kt index 2839249c5cbf..0f1fc5ec49ee 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DataSourceFactoryTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/factory/DataSourceFactoryTest.kt @@ -5,7 +5,6 @@ package io.airbyte.cdk.db.factory import com.zaxxer.hikari.HikariDataSource import io.airbyte.cdk.integrations.JdbcConnector -import java.util.Map import javax.sql.DataSource import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -16,7 +15,7 @@ import org.testcontainers.containers.MySQLContainer internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingDataSourceWithConnectionTimeoutSetAboveDefault() { - val connectionProperties = Map.of(CONNECT_TIMEOUT, "61") + val connectionProperties = mapOf(CONNECT_TIMEOUT to "61") val dataSource = DataSourceFactory.create( username, @@ -36,7 +35,7 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingPostgresDataSourceWithConnectionTimeoutSetBelowDefault() { - val connectionProperties = Map.of(CONNECT_TIMEOUT, "30") + val connectionProperties = mapOf(CONNECT_TIMEOUT to "30") val dataSource = DataSourceFactory.create( username, @@ -58,17 +57,17 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { fun testCreatingMySQLDataSourceWithConnectionTimeoutSetBelowDefault() { MySQLContainer("mysql:8.0").use { mySQLContainer -> mySQLContainer.start() - val connectionProperties = Map.of(CONNECT_TIMEOUT, "5000") + val connectionProperties = mapOf(CONNECT_TIMEOUT to "5000") val dataSource = DataSourceFactory.create( - mySQLContainer.getUsername(), - mySQLContainer.getPassword(), - mySQLContainer.getDriverClassName(), + mySQLContainer.username, + mySQLContainer.password, + mySQLContainer.driverClassName, mySQLContainer.getJdbcUrl(), connectionProperties, JdbcConnector.getConnectionTimeout( connectionProperties, - mySQLContainer.getDriverClassName() + mySQLContainer.driverClassName ) ) Assertions.assertNotNull(dataSource) @@ -82,7 +81,7 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingDataSourceWithConnectionTimeoutSetWithZero() { - val connectionProperties = Map.of(CONNECT_TIMEOUT, "0") + val connectionProperties = mapOf(CONNECT_TIMEOUT to "0") val dataSource = DataSourceFactory.create( username, @@ -102,7 +101,7 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingPostgresDataSourceWithConnectionTimeoutNotSet() { - val connectionProperties = Map.of() + val connectionProperties = mapOf() val dataSource = DataSourceFactory.create( username, @@ -124,17 +123,17 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { fun testCreatingMySQLDataSourceWithConnectionTimeoutNotSet() { MySQLContainer("mysql:8.0").use { mySQLContainer -> mySQLContainer.start() - val connectionProperties = Map.of() + val connectionProperties = mapOf() val dataSource = DataSourceFactory.create( - mySQLContainer.getUsername(), - mySQLContainer.getPassword(), - mySQLContainer.getDriverClassName(), + mySQLContainer.username, + mySQLContainer.password, + mySQLContainer.driverClassName, mySQLContainer.getJdbcUrl(), connectionProperties, JdbcConnector.getConnectionTimeout( connectionProperties, - mySQLContainer.getDriverClassName() + mySQLContainer.driverClassName ) ) Assertions.assertNotNull(dataSource) @@ -159,7 +158,7 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingADataSourceWithJdbcUrlAndConnectionProperties() { - val connectionProperties = Map.of("foo", "bar") + val connectionProperties = mapOf("foo" to "bar") val dataSource = DataSourceFactory.create( @@ -192,7 +191,7 @@ internal class DataSourceFactoryTest : CommonFactoryTest() { @Test fun testCreatingADataSourceWithHostPortAndConnectionProperties() { - val connectionProperties = Map.of("foo", "bar") + val connectionProperties = mapOf("foo" to "bar") val dataSource = DataSourceFactory.create( diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestDefaultJdbcDatabase.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestDefaultJdbcDatabase.kt index 30c8f1c9ad43..ffc54ce72d0f 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestDefaultJdbcDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestDefaultJdbcDatabase.kt @@ -62,7 +62,7 @@ internal class TestDefaultJdbcDatabase { @Throws(SQLException::class) fun testBufferedResultQuery() { val actual = - database!!.bufferedResultSetQuery( + database.bufferedResultSetQuery( { connection: Connection -> connection.createStatement().executeQuery("SELECT * FROM id_and_name;") }, @@ -75,7 +75,7 @@ internal class TestDefaultJdbcDatabase { @Test @Throws(SQLException::class) fun testResultSetQuery() { - database!! + database .unsafeResultSetQuery( { connection: Connection -> connection.createStatement().executeQuery("SELECT * FROM id_and_name;") @@ -89,7 +89,7 @@ internal class TestDefaultJdbcDatabase { @Throws(SQLException::class) fun testQuery() { val actual = - database!!.queryJsons( + database.queryJsons( { connection: Connection -> connection.prepareStatement("SELECT * FROM id_and_name;") }, diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestJdbcUtils.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestJdbcUtils.kt index 931b9edaac35..ed15fe586a8a 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestJdbcUtils.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/db/jdbc/TestJdbcUtils.kt @@ -106,7 +106,7 @@ internal class TestJdbcUtils { @Test @Throws(SQLException::class) fun testRowToJson() { - dataSource!!.connection.use { connection -> + dataSource.connection.use { connection -> val rs = connection.createStatement().executeQuery("SELECT * FROM id_and_name;") rs.next() Assertions.assertEquals(RECORDS_AS_JSON[0], sourceOperations.rowToJson(rs)) @@ -116,7 +116,7 @@ internal class TestJdbcUtils { @Test @Throws(SQLException::class) fun testToStream() { - dataSource!!.connection.use { connection -> + dataSource.connection.use { connection -> val rs = connection.createStatement().executeQuery("SELECT * FROM id_and_name;") val actual = JdbcDatabase.toUnsafeStream(rs) { queryContext: ResultSet -> @@ -131,7 +131,7 @@ internal class TestJdbcUtils { @Test @Throws(SQLException::class) fun testSetJsonField() { - dataSource!!.connection.use { connection -> + dataSource.connection.use { connection -> createTableWithAllTypes(connection) insertRecordOfEachType(connection) assertExpectedOutputValues(connection, jsonFieldExpectedValues()) @@ -143,7 +143,7 @@ internal class TestJdbcUtils { @Test @Throws(SQLException::class) fun testSetStatementField() { - dataSource!!.connection.use { connection -> + dataSource.connection.use { connection -> createTableWithAllTypes(connection) val ps = connection.prepareStatement( @@ -307,7 +307,7 @@ internal class TestJdbcUtils { ) @Throws(SQLException::class) fun testSetStatementSpecialValues(colValue: String, value: Long) { - dataSource!!.connection.use { connection -> + dataSource.connection.use { connection -> createTableWithAllTypes(connection) val ps = connection.prepareStatement("INSERT INTO data(bigint) VALUES(?);") diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteExceptionHandlerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteExceptionHandlerTest.kt index 2c05cb12d472..cac4ed6708ca 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteExceptionHandlerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteExceptionHandlerTest.kt @@ -234,7 +234,7 @@ class AirbyteExceptionHandlerTest { .dropLastWhile { it.isEmpty() } .toTypedArray() ) - .map { line: String? -> + .map { line: String -> // these tests sometimes emit non-json stdout (e.g. log4j warnings) // so we try-catch to handle those malformed lines. try { diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteLogMessageTemplateTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteLogMessageTemplateTest.kt index c8585437ac48..ae6485f813a7 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteLogMessageTemplateTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/AirbyteLogMessageTemplateTest.kt @@ -37,13 +37,13 @@ class AirbyteLogMessageTemplateTest { // produced by code and assert that it matches the expected format. loggerContext = Configurator.initialize(null, "log4j2.xml") - val configuration = loggerContext.getConfiguration() + val configuration = loggerContext.configuration rootLoggerConfig = configuration.getLoggerConfig("") outputContent = ByteArrayOutputStream() outputStreamAppender = OutputStreamAppender.createAppender( - rootLoggerConfig.getAppenders()[CONSOLE_JSON_APPENDER]!!.layout, + rootLoggerConfig.appenders[CONSOLE_JSON_APPENDER]!!.layout, null, outputContent, OUTPUT_STREAM_APPENDER, @@ -58,19 +58,19 @@ class AirbyteLogMessageTemplateTest { @AfterEach fun closeLogger() { - outputStreamAppender!!.stop() - rootLoggerConfig!!.removeAppender(OUTPUT_STREAM_APPENDER) - loggerContext!!.close() + outputStreamAppender.stop() + rootLoggerConfig.removeAppender(OUTPUT_STREAM_APPENDER) + loggerContext.close() } @Test @Throws(IOException::class) fun testAirbyteLogMessageFormat() { getLogger() - logger!!.info("hello") + logger.info("hello") - outputContent!!.flush() - val logMessage = outputContent!!.toString(StandardCharsets.UTF_8) + outputContent.flush() + val logMessage = outputContent.toString(StandardCharsets.UTF_8) val airbyteMessage = validateLogIsAirbyteMessage(logMessage) val airbyteLogMessage = validateAirbyteMessageIsLog(airbyteMessage) @@ -113,9 +113,9 @@ class AirbyteLogMessageTemplateTest { for (i in 0 until stringRepetitions) { sb.append("abcd") } - logger!!.info(sb.toString(), RuntimeException("aaaaa bbbbbb ccccccc dddddd")) - outputContent!!.flush() - val logMessage = outputContent!!.toString(StandardCharsets.UTF_8) + logger.info(sb.toString(), RuntimeException("aaaaa bbbbbb ccccccc dddddd")) + outputContent.flush() + val logMessage = outputContent.toString(StandardCharsets.UTF_8) val airbyteMessage = validateLogIsAirbyteMessage(logMessage) val airbyteLogMessage = validateAirbyteMessageIsLog(airbyteMessage) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt index 59d06c53b744..70e6d57e2ac5 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/IntegrationRunnerTest.kt @@ -77,8 +77,8 @@ internal class IntegrationRunnerTest { val intConfig = IntegrationConfig.spec() val output = ConnectorSpecification().withDocumentationUrl(URI("https://docs.airbyte.io/")) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.spec()).thenReturn(output) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.spec()).thenReturn(output) IntegrationRunner(cliParser, stdoutConsumer, null, source).run(ARGS) @@ -93,8 +93,8 @@ internal class IntegrationRunnerTest { val intConfig = IntegrationConfig.spec() val output = ConnectorSpecification().withDocumentationUrl(URI("https://docs.airbyte.io/")) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(destination!!.spec()).thenReturn(output) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(destination.spec()).thenReturn(output) IntegrationRunner(cliParser, stdoutConsumer, destination, null).run(ARGS) @@ -112,11 +112,11 @@ internal class IntegrationRunnerTest { .withStatus(AirbyteConnectionStatus.Status.FAILED) .withMessage("it failed") - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.check(CONFIG)).thenReturn(output) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.check(CONFIG)).thenReturn(output) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) IntegrationRunner(cliParser, stdoutConsumer, null, source, jsonSchemaValidator).run(ARGS) @@ -140,11 +140,11 @@ internal class IntegrationRunnerTest { .withStatus(AirbyteConnectionStatus.Status.FAILED) .withMessage("it failed") - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(destination!!.check(CONFIG)).thenReturn(output) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(destination.check(CONFIG)).thenReturn(output) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(destination!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(destination.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) @@ -169,11 +169,11 @@ internal class IntegrationRunnerTest { val output = AirbyteCatalog().withStreams(Lists.newArrayList(AirbyteStream().withName("oceans"))) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.discover(CONFIG)).thenReturn(output) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.discover(CONFIG)).thenReturn(output) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) @@ -204,12 +204,12 @@ internal class IntegrationRunnerTest { .withData(Jsons.jsonNode(ImmutableMap.of("names", "reginald"))) ) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.read(CONFIG, CONFIGURED_CATALOG, STATE)) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.read(CONFIG, CONFIGURED_CATALOG, STATE)) .thenReturn(AutoCloseableIterators.fromIterator(MoreIterators.of(message1, message2))) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) @@ -228,12 +228,12 @@ internal class IntegrationRunnerTest { val intConfig = IntegrationConfig.read(configPath, configuredCatalogPath, statePath) val configErrorException = ConfigErrorException("Invalid configuration") - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.read(CONFIG, CONFIGURED_CATALOG, STATE)) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.read(CONFIG, CONFIGURED_CATALOG, STATE)) .thenThrow(configErrorException) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) @@ -259,11 +259,11 @@ internal class IntegrationRunnerTest { val configErrorException = ConfigErrorException("Invalid configuration") val runtimeException = RuntimeException(RuntimeException(configErrorException)) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.check(CONFIG)).thenThrow(runtimeException) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.check(CONFIG)).thenThrow(runtimeException) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) IntegrationRunner(cliParser, stdoutConsumer, null, source, jsonSchemaValidator).run(ARGS) @@ -293,11 +293,11 @@ internal class IntegrationRunnerTest { ) val runtimeException = RuntimeException("Runtime Error") - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) - Mockito.`when`(source!!.check(CONFIG)).thenThrow(runtimeException) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(source.check(CONFIG)).thenThrow(runtimeException) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(source!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(source.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) IntegrationRunner(cliParser, stdoutConsumer, null, source, jsonSchemaValidator).run(ARGS) @@ -317,18 +317,14 @@ internal class IntegrationRunnerTest { fun testWrite() { val intConfig = IntegrationConfig.write(configPath, configuredCatalogPath) val consumerMock = Mockito.mock(SerializedAirbyteMessageConsumer::class.java) - Mockito.`when`(cliParser!!.parse(ARGS)).thenReturn(intConfig) + Mockito.`when`(cliParser.parse(ARGS)).thenReturn(intConfig) Mockito.`when`( - destination!!.getSerializedMessageConsumer( - CONFIG, - CONFIGURED_CATALOG, - stdoutConsumer - ) + destination.getSerializedMessageConsumer(CONFIG, CONFIGURED_CATALOG, stdoutConsumer) ) .thenReturn(consumerMock) val expectedConnSpec = Mockito.mock(ConnectorSpecification::class.java) - Mockito.`when`(destination!!.spec()).thenReturn(expectedConnSpec) + Mockito.`when`(destination.spec()).thenReturn(expectedConnSpec) Mockito.`when`(expectedConnSpec.connectionSpecification).thenReturn(CONFIG) val jsonSchemaValidator = Mockito.mock(JsonSchemaValidator::class.java) @@ -518,7 +514,7 @@ ${Jsons.serialize(message2)}""".toByteArray( ignoreInterrupt: Boolean ) { val executorService = - Executors.newFixedThreadPool(1) { r: Runnable? -> + Executors.newFixedThreadPool(1) { r: Runnable -> // Create a thread that should be identified as orphaned if still running during // shutdown val thread = Thread(r) diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnelTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnelTest.kt index 4def0951bbff..8da4d8c78f65 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnelTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnelTest.kt @@ -48,7 +48,7 @@ internal class SshTunnelTest { if (endPointURL == null) "fakeHost.com" else null, if (endPointURL == null) 5432 else 0 ) { - public override fun openTunnel(client: SshClient): ClientSession? { + override fun openTunnel(client: SshClient): ClientSession? { tunnelLocalPort = 8080 return null // Prevent tunnel from attempting to connect } @@ -56,13 +56,13 @@ internal class SshTunnelTest { val configInTunnel = sshTunnel.configInTunnel if (endPointURL == null) { - Assertions.assertTrue(configInTunnel!!.has("port")) + Assertions.assertTrue(configInTunnel.has("port")) Assertions.assertTrue(configInTunnel.has("host")) Assertions.assertFalse(configInTunnel.has("endpoint")) - Assertions.assertEquals(8080, configInTunnel!!["port"].asInt()) + Assertions.assertEquals(8080, configInTunnel["port"].asInt()) Assertions.assertEquals("127.0.0.1", configInTunnel["host"].asText()) } else { - Assertions.assertFalse(configInTunnel!!.has("port")) + Assertions.assertFalse(configInTunnel.has("port")) Assertions.assertFalse(configInTunnel.has("host")) Assertions.assertTrue(configInTunnel.has("endpoint")) Assertions.assertEquals( @@ -101,7 +101,7 @@ internal class SshTunnelTest { "fakeHost.com", 5432 ) { - public override fun openTunnel(client: SshClient): ClientSession? { + override fun openTunnel(client: SshClient): ClientSession? { return null // Prevent tunnel from attempting to connect } } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/AsyncStreamConsumerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/AsyncStreamConsumerTest.kt index a2128488bd89..3d93057fe5a3 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/AsyncStreamConsumerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/AsyncStreamConsumerTest.kt @@ -553,7 +553,7 @@ class AsyncStreamConsumerTest { argumentCaptor.allValues .stream() // flatten those results into a single list for the simplicity of // comparison - .flatMap { s: Stream<*>? -> s } + .flatMap { s: Stream<*> -> s } .toList() val expRecords = diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/state/GlobalAsyncStateManagerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/state/GlobalAsyncStateManagerTest.kt index a46535bf82ea..f790ab406022 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/state/GlobalAsyncStateManagerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/async/state/GlobalAsyncStateManagerTest.kt @@ -196,7 +196,7 @@ class GlobalAsyncStateManagerTest { @Test internal fun testBasic() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) @@ -205,7 +205,7 @@ class GlobalAsyncStateManagerTest { assertEquals(firstStateId, secondStateId) stateManager.decrement(firstStateId, 2) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -216,14 +216,14 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals(0, stateWithStats.size) stateManager.trackState(STREAM1_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -235,8 +235,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -266,13 +266,13 @@ class GlobalAsyncStateManagerTest { internal inner class GlobalState { @Test fun testEmptyQueuesGlobalState() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) // GLOBAL stateManager.trackState(GLOBAL_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -283,8 +283,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) // @@ -315,7 +315,7 @@ class GlobalAsyncStateManagerTest { @Test internal fun testConversion() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) @@ -328,21 +328,21 @@ class GlobalAsyncStateManagerTest { // Since this is actually a global state, we can only flush after all streams are done. stateManager.decrement(preConvertId0, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) } assertEquals(0, emittedStatesFromDestination.size) stateManager.decrement(preConvertId1, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) } assertEquals(0, emittedStatesFromDestination.size) stateManager.decrement(preConvertId2, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -353,8 +353,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -374,14 +374,14 @@ class GlobalAsyncStateManagerTest { @Test internal fun testCorrectFlushingOneStream() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) val preConvertId0: Long = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(GLOBAL_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(preConvertId0, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -392,8 +392,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -415,7 +415,7 @@ class GlobalAsyncStateManagerTest { val afterConvertId1: Long = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(GLOBAL_STATE_MESSAGE2, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(afterConvertId1, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -425,8 +425,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -446,14 +446,14 @@ class GlobalAsyncStateManagerTest { @Test internal fun testZeroRecordFlushing() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) val preConvertId0: Long = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(GLOBAL_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(preConvertId0, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -464,8 +464,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -484,7 +484,7 @@ class GlobalAsyncStateManagerTest { emittedStatesFromDestination.clear() stateManager.trackState(GLOBAL_STATE_MESSAGE2, STATE_MSG_SIZE, DEFAULT_NAMESPACE) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -495,8 +495,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -520,7 +520,7 @@ class GlobalAsyncStateManagerTest { val afterConvertId2: Long = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(GLOBAL_STATE_MESSAGE3, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(afterConvertId2, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -530,8 +530,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -551,7 +551,7 @@ class GlobalAsyncStateManagerTest { @Test internal fun testCorrectFlushingManyStreams() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) @@ -561,7 +561,7 @@ class GlobalAsyncStateManagerTest { stateManager.trackState(GLOBAL_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(preConvertId0, 10) stateManager.decrement(preConvertId1, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -572,8 +572,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -596,7 +596,7 @@ class GlobalAsyncStateManagerTest { assertEquals(afterConvertId0, afterConvertId1) stateManager.trackState(GLOBAL_STATE_MESSAGE2, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(afterConvertId0, 20) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -606,8 +606,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -630,13 +630,13 @@ class GlobalAsyncStateManagerTest { internal inner class PerStreamState { @Test internal fun testEmptyQueues() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) // GLOBAL stateManager.trackState(STREAM1_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -647,8 +647,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -678,14 +678,14 @@ class GlobalAsyncStateManagerTest { @Test internal fun testCorrectFlushingOneStream() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) var stateId: Long = simulateIncomingRecords(STREAM1_DESC, 3, stateManager) stateManager.trackState(STREAM1_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stateId, 3) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -696,8 +696,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -719,7 +719,7 @@ class GlobalAsyncStateManagerTest { stateId = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(STREAM1_STATE_MESSAGE2, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stateId, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -730,8 +730,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -754,14 +754,14 @@ class GlobalAsyncStateManagerTest { @Test internal fun testZeroRecordFlushing() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) var stateId: Long = simulateIncomingRecords(STREAM1_DESC, 3, stateManager) stateManager.trackState(STREAM1_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stateId, 3) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -772,8 +772,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -792,7 +792,7 @@ class GlobalAsyncStateManagerTest { emittedStatesFromDestination.clear() stateManager.trackState(STREAM1_STATE_MESSAGE2, STATE_MSG_SIZE, DEFAULT_NAMESPACE) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -802,8 +802,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) val expectedDestinationStats2 = AirbyteStateStats().withRecordCount(0.0) @@ -828,7 +828,7 @@ class GlobalAsyncStateManagerTest { stateId = simulateIncomingRecords(STREAM1_DESC, 10, stateManager) stateManager.trackState(STREAM1_STATE_MESSAGE3, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stateId, 10) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -838,8 +838,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) val expectedDestinationStats3 = AirbyteStateStats().withRecordCount(10.0) @@ -863,7 +863,7 @@ class GlobalAsyncStateManagerTest { @Test internal fun testCorrectFlushingManyStream() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) @@ -872,7 +872,7 @@ class GlobalAsyncStateManagerTest { stateManager.trackState(STREAM1_STATE_MESSAGE1, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stream1StateId, 3) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -883,8 +883,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -903,7 +903,7 @@ class GlobalAsyncStateManagerTest { emittedStatesFromDestination.clear() stateManager.decrement(stream2StateId, 4) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -912,7 +912,7 @@ class GlobalAsyncStateManagerTest { stateManager.trackState(STREAM2_STATE_MESSAGE, STATE_MSG_SIZE, DEFAULT_NAMESPACE) stateManager.decrement(stream2StateId, 3) // only flush state if counter is 0. - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -923,8 +923,8 @@ class GlobalAsyncStateManagerTest { .stream() .collect( Collectors.toMap( - { c: AirbyteMessage? -> c }, - { c: AirbyteMessage? -> c?.state?.destinationStats }, + { c: AirbyteMessage -> c }, + { c: AirbyteMessage -> c.state?.destinationStats }, ), ) assertEquals( @@ -960,20 +960,20 @@ class GlobalAsyncStateManagerTest { @Test internal fun flushingRecordsShouldNotReduceStatsCounterForGlobalState() { - val emittedStatesFromDestination: MutableList = mutableListOf() + val emittedStatesFromDestination: MutableList = mutableListOf() val stateManager = GlobalAsyncStateManager(GlobalMemoryManager(TOTAL_QUEUES_MAX_SIZE_LIMIT_BYTES)) val stateId = simulateIncomingRecords(STREAM1_DESC, 6, stateManager) stateManager.decrement(stateId, 4) stateManager.trackState(GLOBAL_STATE_MESSAGE1, 1, STREAM1_DESC.namespace) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) } assertEquals(0, emittedStatesFromDestination.size) stateManager.decrement(stateId, 2) - stateManager.flushStates { e: AirbyteMessage? -> + stateManager.flushStates { e: AirbyteMessage -> emittedStatesFromDestination.add( e, ) @@ -981,7 +981,7 @@ class GlobalAsyncStateManagerTest { assertEquals(1, emittedStatesFromDestination.size) assertEquals( 6.0, - emittedStatesFromDestination.first()?.state?.destinationStats?.recordCount, + emittedStatesFromDestination.first().state?.destinationStats?.recordCount, ) } } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/BufferedStreamConsumerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/BufferedStreamConsumerTest.kt index 87f86ce109b2..1202c94e1b9d 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/BufferedStreamConsumerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/buffered_stream_consumer/BufferedStreamConsumerTest.kt @@ -57,10 +57,10 @@ class BufferedStreamConsumerTest { fun test1StreamWith1State() { val expectedRecords = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecords) - consumer!!.accept(STATE_MESSAGE1) - consumer!!.close() + consumer.accept(STATE_MESSAGE1) + consumer.close() verifyStartAndClose() @@ -74,11 +74,11 @@ class BufferedStreamConsumerTest { fun test1StreamWith2State() { val expectedRecords = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecords) - consumer!!.accept(STATE_MESSAGE1) - consumer!!.accept(STATE_MESSAGE2) - consumer!!.close() + consumer.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE2) + consumer.close() verifyStartAndClose() @@ -92,9 +92,9 @@ class BufferedStreamConsumerTest { fun test1StreamWith0State() { val expectedRecords = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecords) - consumer!!.close() + consumer.close() verifyStartAndClose() @@ -107,11 +107,11 @@ class BufferedStreamConsumerTest { val expectedRecordsBatch1 = generateRecords(1000) val expectedRecordsBatch2 = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsBatch1) - consumer!!.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE1) consumeRecords(consumer, expectedRecordsBatch2) - consumer!!.close() + consumer.close() verifyStartAndClose() @@ -163,16 +163,16 @@ class BufferedStreamConsumerTest { val expectedRecordsBatch2 = generateRecords(1000) val expectedRecordsBatch3 = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsBatch1) - consumer!!.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE1) consumeRecords(consumer, expectedRecordsBatch2) - Mockito.`when`(isValidRecord!!.apply(ArgumentMatchers.any())) + Mockito.`when`(isValidRecord.apply(ArgumentMatchers.any())) .thenThrow(IllegalStateException("induced exception")) Assertions.assertThrows(IllegalStateException::class.java) { - consumer!!.accept(expectedRecordsBatch3[0]) + consumer.accept(expectedRecordsBatch3[0]) } - consumer!!.close() + consumer.close() verifyStartAndCloseFailure() @@ -188,15 +188,15 @@ class BufferedStreamConsumerTest { val expectedRecordsBatch2 = generateRecords(1000) val expectedRecordsBatch3 = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsBatch1) consumeRecords(consumer, expectedRecordsBatch2) - Mockito.`when`(isValidRecord!!.apply(ArgumentMatchers.any())) + Mockito.`when`(isValidRecord.apply(ArgumentMatchers.any())) .thenThrow(IllegalStateException("induced exception")) Assertions.assertThrows(IllegalStateException::class.java) { - consumer!!.accept(expectedRecordsBatch3[0]) + consumer.accept(expectedRecordsBatch3[0]) } - consumer!!.close() + consumer.close() verifyStartAndCloseFailure() @@ -215,13 +215,13 @@ class BufferedStreamConsumerTest { val expectedRecordsBatch1 = generateRecords(1000) val expectedRecordsBatch2 = generateRecords(1000) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsBatch1) - consumer!!.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE1) consumeRecords(consumer, expectedRecordsBatch2) Assertions.assertThrows( IllegalStateException::class.java, - { consumer!!.close() }, + { consumer.close() }, "Expected an error to be thrown on close" ) @@ -243,11 +243,11 @@ class BufferedStreamConsumerTest { .peek { m: AirbyteMessage -> m.record.withStream(STREAM_NAME2) } .collect(Collectors.toList()) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsStream1) - consumer!!.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE1) consumeRecords(consumer, expectedRecordsStream2) - consumer!!.close() + consumer.close() verifyStartAndClose() @@ -268,12 +268,12 @@ class BufferedStreamConsumerTest { .peek { m: AirbyteMessage -> m.record.withStream(STREAM_NAME2) } .collect(Collectors.toList()) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsStream1) - consumer!!.accept(STATE_MESSAGE1) + consumer.accept(STATE_MESSAGE1) consumeRecords(consumer, expectedRecordsStream2) - consumer!!.accept(STATE_MESSAGE2) - consumer!!.close() + consumer.accept(STATE_MESSAGE2) + consumer.close() verifyStartAndClose() @@ -439,19 +439,19 @@ class BufferedStreamConsumerTest { ) ) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsStream1) - consumer!!.accept(state1) + consumer.accept(state1) // At this point, we have not yet flushed anything consumeRecords(consumer, expectedRecordsStream2) - consumer!!.accept(state2) + consumer.accept(state2) consumeRecords(consumer, expectedRecordsStream2) // Now we have flushed stream 2, but not stream 1 // Verify that we have only acked stream 2's state. Mockito.verify(outputRecordCollector).accept(state2) Mockito.verify(outputRecordCollector, Mockito.never()).accept(state1) - consumer!!.close() + consumer.close() // Now we've closed the consumer, which flushes everything. // Verify that we ack stream 1's pending state. Mockito.verify(outputRecordCollector).accept(state1) @@ -531,18 +531,18 @@ class BufferedStreamConsumerTest { ) ) - consumer!!.start() + consumer.start() consumeRecords(consumer, expectedRecordsStream1) - consumer!!.accept(state1) + consumer.accept(state1) // At this point, we have not yet flushed anything consumeRecords(consumer, expectedRecordsStream2) - consumer!!.accept(state2) + consumer.accept(state2) consumeRecords(consumer, expectedRecordsStream2) // Now we have flushed stream 2, but not stream 1 // We should not have acked any state yet, because we haven't written stream1's records yet. Mockito.verify(outputRecordCollector, Mockito.never()).accept(ArgumentMatchers.any()) - consumer!!.close() + consumer.close() // Now we've closed the consumer, which flushes everything. // Verify that we ack the final state. // Note that we discard state1 entirely - this is OK. As long as we ack the last state diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DefaultDestStateLifecycleManagerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DefaultDestStateLifecycleManagerTest.kt index 38c17de0e07f..d19ec18ca6ee 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DefaultDestStateLifecycleManagerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DefaultDestStateLifecycleManagerTest.kt @@ -77,12 +77,12 @@ internal class DefaultDestStateLifecycleManagerTest { @Test fun testDelegatesLegacyMessages() { - mgr1!!.addState(UNSET_TYPE_MESSAGE) - mgr1!!.addState(LEGACY_MESSAGE) - mgr1!!.markPendingAsFlushed() - mgr1!!.markFlushedAsCommitted() - mgr1!!.listFlushed() - mgr1!!.listCommitted() + mgr1.addState(UNSET_TYPE_MESSAGE) + mgr1.addState(LEGACY_MESSAGE) + mgr1.markPendingAsFlushed() + mgr1.markFlushedAsCommitted() + mgr1.listFlushed() + mgr1.listCommitted() Mockito.verify(singleStateMgr).addState(UNSET_TYPE_MESSAGE) Mockito.verify(singleStateMgr).addState(LEGACY_MESSAGE) Mockito.verify(singleStateMgr).markPendingAsFlushed() @@ -93,11 +93,11 @@ internal class DefaultDestStateLifecycleManagerTest { @Test fun testDelegatesGlobalMessages() { - mgr1!!.addState(GLOBAL_MESSAGE) - mgr1!!.markPendingAsFlushed() - mgr1!!.markFlushedAsCommitted() - mgr1!!.listFlushed() - mgr1!!.listCommitted() + mgr1.addState(GLOBAL_MESSAGE) + mgr1.markPendingAsFlushed() + mgr1.markFlushedAsCommitted() + mgr1.listFlushed() + mgr1.listCommitted() Mockito.verify(singleStateMgr).addState(GLOBAL_MESSAGE) Mockito.verify(singleStateMgr).markPendingAsFlushed() Mockito.verify(singleStateMgr).markFlushedAsCommitted() @@ -107,11 +107,11 @@ internal class DefaultDestStateLifecycleManagerTest { @Test fun testDelegatesStreamMessages() { - mgr1!!.addState(STREAM_MESSAGE) - mgr1!!.markPendingAsFlushed() - mgr1!!.markFlushedAsCommitted() - mgr1!!.listFlushed() - mgr1!!.listCommitted() + mgr1.addState(STREAM_MESSAGE) + mgr1.markPendingAsFlushed() + mgr1.markFlushedAsCommitted() + mgr1.listFlushed() + mgr1.listCommitted() Mockito.verify(streamMgr).addState(STREAM_MESSAGE) Mockito.verify(streamMgr).markPendingAsFlushed() diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestSingleStateLifecycleManagerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestSingleStateLifecycleManagerTest.kt index b2a46fc5bc98..3bd486230bb0 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestSingleStateLifecycleManagerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestSingleStateLifecycleManagerTest.kt @@ -26,8 +26,8 @@ internal class DestSingleStateLifecycleManagerTest { fun testBasicLifeCycle() { // starts with no state. Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) mgr!!.addState(MESSAGE1) // new state supersedes previous ones. we should only see MESSAGE2 from here on out. @@ -35,22 +35,22 @@ internal class DestSingleStateLifecycleManagerTest { // after adding a state, it is in pending only. Assertions.assertEquals(MESSAGE2, mgr!!.listPending().poll()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) mgr!!.markPendingAsFlushed() // after flushing the state it is in flushed only. Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertEquals(MESSAGE2, mgr!!.listFlushed()!!.poll()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertEquals(MESSAGE2, mgr!!.listFlushed().poll()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) // after committing the state it is in committed only. mgr!!.markFlushedAsCommitted() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted()!!.poll()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted().poll()) } @Test @@ -60,8 +60,8 @@ internal class DestSingleStateLifecycleManagerTest { // verify the LAST message is returned. Assertions.assertEquals(MESSAGE2, mgr!!.listPending().poll()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) } @Test @@ -71,8 +71,8 @@ internal class DestSingleStateLifecycleManagerTest { mgr!!.markPendingAsFlushed() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertEquals(MESSAGE2, mgr!!.listFlushed()!!.poll()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertEquals(MESSAGE2, mgr!!.listFlushed().poll()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) // verify that multiple calls to markPendingAsFlushed overwrite old states mgr!!.addState(MESSAGE1) @@ -80,8 +80,8 @@ internal class DestSingleStateLifecycleManagerTest { mgr!!.markPendingAsFlushed() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertEquals(MESSAGE1, mgr!!.listFlushed()!!.poll()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertEquals(MESSAGE1, mgr!!.listFlushed().poll()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) } @Test @@ -92,8 +92,8 @@ internal class DestSingleStateLifecycleManagerTest { mgr!!.markFlushedAsCommitted() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted()!!.poll()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted().poll()) // verify that multiple calls to markFlushedAsCommitted overwrite old states mgr!!.addState(MESSAGE1) @@ -102,8 +102,8 @@ internal class DestSingleStateLifecycleManagerTest { mgr!!.markFlushedAsCommitted() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertEquals(MESSAGE1, mgr!!.listCommitted()!!.poll()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertEquals(MESSAGE1, mgr!!.listCommitted().poll()) } /* @@ -121,8 +121,8 @@ internal class DestSingleStateLifecycleManagerTest { mgr!!.markPendingAsCommitted() Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted()!!.poll()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertEquals(MESSAGE2, mgr!!.listCommitted().poll()) } companion object { diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestStreamStateLifecycleManagerTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestStreamStateLifecycleManagerTest.kt index 53e68cd61e6f..4c7c56820889 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestStreamStateLifecycleManagerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/dest_state_lifecycle_manager/DestStreamStateLifecycleManagerTest.kt @@ -30,8 +30,8 @@ internal class DestStreamStateLifecycleManagerTest { fun testBasicLifeCycle() { // starts with no state. Assertions.assertTrue(mgr!!.listPending().isEmpty()) - Assertions.assertTrue(mgr!!.listFlushed()!!.isEmpty()) - Assertions.assertTrue(mgr!!.listCommitted()!!.isEmpty()) + Assertions.assertTrue(mgr!!.listFlushed().isEmpty()) + Assertions.assertTrue(mgr!!.listCommitted().isEmpty()) mgr!!.addState(STREAM1_MESSAGE1) // new state supersedes previous ones. we should only see MESSAGE2 for STREAM1 from here on diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategyTest.kt b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategyTest.kt index d63dce584480..a17973cf043b 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategyTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/test/kotlin/io/airbyte/cdk/integrations/destination/record_buffer/SerializedBufferingStrategyTest.kt @@ -199,7 +199,7 @@ class SerializedBufferingStrategyTest { private fun onCreateBufferFunction(): BufferCreateFunction { return BufferCreateFunction { stream: AirbyteStreamNameNamespacePair, - catalog: ConfiguredAirbyteCatalog? -> + catalog: ConfiguredAirbyteCatalog -> when (stream.name) { STREAM_1 -> recordWriter1 STREAM_2 -> recordWriter2 diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/ContainerFactory.kt b/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/ContainerFactory.kt index 78a7e97a1c9f..2adceaa3b3f8 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/ContainerFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/ContainerFactory.kt @@ -120,7 +120,7 @@ abstract class ContainerFactory> { // Container creation can be exceedingly slow. // Furthermore, we need to handle exceptions raised during container creation. val containerOrError = - SHARED_CONTAINERS!!.computeIfAbsent(containerKey) { key: ContainerKey<*>? -> + SHARED_CONTAINERS!!.computeIfAbsent(containerKey) { key: ContainerKey<*> -> ContainerOrException { createAndStartContainer(key!!.imageName, namedContainerModifiers) } @@ -218,7 +218,7 @@ abstract class ContainerFactory> { } getTestContainerLogMdcBuilder(imageName, namedContainerModifiers)!!.produceMappings { key: String?, - value: String? -> + value: String -> logConsumer.withMdc(key, value) } container!!.withLogConsumer(logConsumer) @@ -238,7 +238,7 @@ abstract class ContainerFactory> { companion object { private val LOGGER: Logger? = LoggerFactory.getLogger(ContainerFactory::class.java) - private val SHARED_CONTAINERS: ConcurrentMap?, ContainerOrException?>? = + private val SHARED_CONTAINERS: ConcurrentMap, ContainerOrException> = ConcurrentHashMap() private val containerId: AtomicInteger? = AtomicInteger(0) } diff --git a/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/TestDatabase.kt b/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/TestDatabase.kt index bffd92f31cf9..58ecdbb48387 100644 --- a/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/TestDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/core/src/testFixtures/kotlin/io/airbyte/cdk/testutils/TestDatabase.kt @@ -55,7 +55,7 @@ protected constructor(val container: C) : AutoCloseable { @JvmField protected val databaseId: Int = nextDatabaseId.getAndIncrement() @JvmField protected val containerId: Int = - containerUidToId!!.computeIfAbsent(container.containerId) { _: String? -> + containerUidToId!!.computeIfAbsent(container.containerId) { _: String -> nextContainerId!!.getAndIncrement() }!! private val dateFormat: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS") @@ -170,8 +170,8 @@ protected constructor(val container: C) : AutoCloseable { protected fun execSQL(sql: Stream) { try { - database!!.query { ctx: DSLContext? -> - sql.forEach { statement: String? -> + database!!.query { ctx: DSLContext -> + sql.forEach { statement: String -> LOGGER!!.info("executing SQL statement {}", statement) ctx!!.execute(statement) } @@ -314,7 +314,7 @@ protected constructor(val container: C) : AutoCloseable { private val nextDatabaseId: AtomicInteger = AtomicInteger(0) - private val nextContainerId: AtomicInteger? = AtomicInteger(0) - private val containerUidToId: MutableMap? = ConcurrentHashMap() + private val nextContainerId: AtomicInteger = AtomicInteger(0) + private val containerUidToId: MutableMap? = ConcurrentHashMap() } } diff --git a/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/BigQueryDatabase.kt b/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/BigQueryDatabase.kt index fe74d776a066..160445420e39 100644 --- a/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/BigQueryDatabase.kt +++ b/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/BigQueryDatabase.kt @@ -97,10 +97,10 @@ constructor( } @Throws(Exception::class) - override fun unsafeQuery(sql: String?, vararg params: String?): Stream { + override fun unsafeQuery(sql: String?, vararg params: String): Stream { val parameterValueList = Arrays.stream(params) - .map { param: String? -> + .map { param: String -> QueryParameterValue.newBuilder() .setValue(param) .setType(StandardSQLTypeName.STRING) diff --git a/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/TempBigQueryJoolDatabaseImpl.kt b/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/TempBigQueryJoolDatabaseImpl.kt index 552275f11527..0c8b973aeb8a 100644 --- a/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/TempBigQueryJoolDatabaseImpl.kt +++ b/airbyte-cdk/java/airbyte-cdk/datastore-bigquery/src/main/kotlin/io/airbyte/cdk/db/bigquery/TempBigQueryJoolDatabaseImpl.kt @@ -14,21 +14,20 @@ import org.jooq.exception.DataAccessException import org.jooq.impl.DefaultDSLContext /** This class is a temporary and will be removed as part of the issue @TODO #4547 */ -class TempBigQueryJoolDatabaseImpl(projectId: String?, jsonCreds: String?) : Database(null) { - val realDatabase: BigQueryDatabase - - init { - realDatabase = createBigQueryDatabase(projectId, jsonCreds) - } +class TempBigQueryJoolDatabaseImpl( + projectId: String?, + jsonCreds: String?, + realDatabase: BigQueryDatabase = createBigQueryDatabase(projectId, jsonCreds) +) : Database(FakeDefaultDSLContext(realDatabase)) { @Throws(SQLException::class) override fun query(transform: ContextQueryFunction): T? { - return transform.query(FakeDefaultDSLContext(realDatabase)) + return transform.query(dslContext) } @Throws(SQLException::class) override fun transaction(transform: ContextQueryFunction): T? { - return transform.query(FakeDefaultDSLContext(realDatabase)) + return transform.query(dslContext) } private class FakeDefaultDSLContext(private val database: BigQueryDatabase) : diff --git a/airbyte-cdk/java/airbyte-cdk/datastore-postgres/src/main/kotlin/io/airbyte/cdk/db/PostgresUtils.kt b/airbyte-cdk/java/airbyte-cdk/datastore-postgres/src/main/kotlin/io/airbyte/cdk/db/PostgresUtils.kt index 71f373aa4c47..8efa3a28082c 100644 --- a/airbyte-cdk/java/airbyte-cdk/datastore-postgres/src/main/kotlin/io/airbyte/cdk/db/PostgresUtils.kt +++ b/airbyte-cdk/java/airbyte-cdk/datastore-postgres/src/main/kotlin/io/airbyte/cdk/db/PostgresUtils.kt @@ -20,9 +20,7 @@ object PostgresUtils { { conn: Connection -> conn.createStatement().executeQuery("select * from pg_current_wal_lsn()") }, - { resultSet: ResultSet? -> - JdbcUtils.defaultSourceOperations.rowToJson(resultSet!!) - } + { resultSet: ResultSet -> JdbcUtils.defaultSourceOperations.rowToJson(resultSet) } ) Preconditions.checkState(jsonNodes.size == 1) diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/AbstractJdbcDestination.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/AbstractJdbcDestination.kt index ca13097cee90..80f779ad5449 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/AbstractJdbcDestination.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/AbstractJdbcDestination.kt @@ -414,8 +414,8 @@ abstract class AbstractJdbcDestination conn.metaData.catalogs }, - { queryContext: ResultSet? -> - JdbcUtils.defaultSourceOperations.rowToJson(queryContext!!) + { queryContext: ResultSet -> + JdbcUtils.defaultSourceOperations.rowToJson(queryContext) }, ) diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/CopyConsumerFactory.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/CopyConsumerFactory.kt index c1a1a9d9a98e..be5a2ae78ca8 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/CopyConsumerFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/CopyConsumerFactory.kt @@ -77,8 +77,8 @@ object CopyConsumerFactory { defaultSchema: String, database: JdbcDatabase, sqlOperations: SqlOperations - ): Map { - val pairToCopier: MutableMap = HashMap() + ): Map { + val pairToCopier: MutableMap = HashMap() val stagingFolder = UUID.randomUUID().toString() for (configuredStream in catalog.streams) { val stream = configuredStream.stream @@ -107,7 +107,7 @@ object CopyConsumerFactory { } private fun recordWriterFunction( - pairToCopier: Map, + pairToCopier: Map, sqlOperations: SqlOperations, pairToIgnoredRecordCount: MutableMap ): RecordWriter { @@ -130,10 +130,10 @@ object CopyConsumerFactory { } private fun removeStagingFilePrinter( - pairToCopier: Map + pairToCopier: Map ): CheckAndRemoveRecordWriter { return CheckAndRemoveRecordWriter { - pair: AirbyteStreamNameNamespacePair?, + pair: AirbyteStreamNameNamespacePair, stagingFileName: String? -> val currentFileName = pairToCopier[pair]!!.currentFile if ( @@ -148,13 +148,13 @@ object CopyConsumerFactory { } private fun onCloseFunction( - pairToCopier: Map, + pairToCopier: Map, database: JdbcDatabase, sqlOperations: SqlOperations, pairToIgnoredRecordCount: Map, dataSource: DataSource ): OnCloseFunction { - return OnCloseFunction { hasFailed: Boolean, _: Map? -> + return OnCloseFunction { hasFailed: Boolean, _: Map -> pairToIgnoredRecordCount.forEach { (pair: AirbyteStreamNameNamespacePair?, count: Long?) -> LOGGER.warn( @@ -169,7 +169,7 @@ object CopyConsumerFactory { @Throws(Exception::class) private fun closeAsOneTransaction( - pairToCopier: Map, + pairToCopier: Map, hasFailed: Boolean, db: JdbcDatabase, sqlOperations: SqlOperations, diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcDestinationHandler.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcDestinationHandler.kt index 542b356f33cd..2142408c5917 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcDestinationHandler.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcDestinationHandler.kt @@ -72,7 +72,7 @@ abstract class JdbcDestinationHandler( @Throws(Exception::class) private fun getInitialRawTableState(id: StreamId): InitialRawTableStatus { val tableExists = - jdbcDatabase.executeMetadataQuery { dbmetadata: DatabaseMetaData? -> + jdbcDatabase.executeMetadataQuery { dbmetadata: DatabaseMetaData -> LOGGER.info( "Retrieving table from Db metadata: {} {} {}", databaseName, @@ -80,7 +80,7 @@ abstract class JdbcDestinationHandler( id.rawName ) try { - dbmetadata!!.getTables(databaseName, id.rawNamespace, id.rawName, null).use { + dbmetadata.getTables(databaseName, id.rawNamespace, id.rawName, null).use { table -> return@executeMetadataQuery table.next() } @@ -113,7 +113,7 @@ abstract class JdbcDestinationHandler( // records). val minUnloadedTimestamp: Optional = timestampStream - .filter(Predicate { obj: Timestamp? -> Objects.nonNull(obj) }) + .filter(Predicate { obj: Timestamp -> Objects.nonNull(obj) }) .findFirst() if (minUnloadedTimestamp.isPresent) { // Decrement by 1 second since timestamp precision varies between databases. @@ -141,7 +141,7 @@ abstract class JdbcDestinationHandler( // all). val minUnloadedTimestamp: Optional = timestampStream - .filter(Predicate { obj: Timestamp? -> Objects.nonNull(obj) }) + .filter(Predicate { obj: Timestamp -> Objects.nonNull(obj) }) .findFirst() return InitialRawTableStatus( true, @@ -394,8 +394,8 @@ abstract class JdbcDestinationHandler( column: Map.Entry -> map[column.key] = column.value.type }, - { obj: LinkedHashMap, m: LinkedHashMap? -> - obj.putAll(m!!) + { obj: LinkedHashMap, m: LinkedHashMap -> + obj.putAll(m) } ) @@ -424,7 +424,7 @@ abstract class JdbcDestinationHandler( .eq(streamId.originalNamespace) ) } - .reduce(DSL.falseCondition()) { obj: Condition, arg2: Condition? -> + .reduce(DSL.falseCondition()) { obj: Condition, arg2: Condition -> obj.or(arg2) } ) @@ -495,7 +495,7 @@ abstract class JdbcDestinationHandler( tableName: String? ): Optional { val retrievedColumnDefns = - jdbcDatabase.executeMetadataQuery { dbMetadata: DatabaseMetaData? -> + jdbcDatabase.executeMetadataQuery { dbMetadata: DatabaseMetaData -> // TODO: normalize namespace and finalName strings to quoted-lowercase (as // needed. Snowflake @@ -508,7 +508,7 @@ abstract class JdbcDestinationHandler( tableName ) try { - dbMetadata!!.getColumns(databaseName, schemaName, tableName, null).use { + dbMetadata.getColumns(databaseName, schemaName, tableName, null).use { columns -> while (columns.next()) { val columnName = columns.getString("COLUMN_NAME") diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcV1V2Migrator.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcV1V2Migrator.kt index d635050fe271..80c747fe32b6 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcV1V2Migrator.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/typing_deduping/JdbcV1V2Migrator.kt @@ -27,9 +27,9 @@ class JdbcV1V2Migrator( @SneakyThrows override fun doesAirbyteInternalNamespaceExist(streamConfig: StreamConfig?): Boolean { val retrievedSchema = - database.executeMetadataQuery { dbMetadata: DatabaseMetaData? -> + database.executeMetadataQuery { dbMetadata: DatabaseMetaData -> try { - dbMetadata!!.getSchemas(databaseName, streamConfig!!.id.rawNamespace).use { + dbMetadata.getSchemas(databaseName, streamConfig!!.id.rawNamespace).use { columns -> var schema = "" while (columns.next()) { diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/test/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/SwitchingDestinationTest.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/test/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/SwitchingDestinationTest.kt index 214d181fab2b..48dcc916175b 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/test/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/SwitchingDestinationTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/test/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/SwitchingDestinationTest.kt @@ -42,7 +42,7 @@ internal class SwitchingDestinationTest { val switchingDestination = SwitchingDestination( SwitchingEnum::class.java, - { c: JsonNode? -> SwitchingEnum.INSERT }, + { c: JsonNode -> SwitchingEnum.INSERT }, destinationMap ) @@ -67,7 +67,7 @@ internal class SwitchingDestinationTest { val switchingDestination = SwitchingDestination( SwitchingEnum::class.java, - { c: JsonNode? -> SwitchingEnum.COPY }, + { c: JsonNode -> SwitchingEnum.COPY }, destinationMap ) diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/DestinationAcceptanceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/DestinationAcceptanceTest.kt index f1f596e8643b..2a96e9a8257b 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/DestinationAcceptanceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/DestinationAcceptanceTest.kt @@ -1717,7 +1717,7 @@ abstract class DestinationAcceptanceTest { val msgList = retrieveRecords(testEnv, streamName, schema, stream.jsonSchema) .stream() - .map { data: JsonNode? -> + .map { data: JsonNode -> AirbyteRecordMessage() .withStream(streamName) .withNamespace(schema) @@ -1775,7 +1775,7 @@ abstract class DestinationAcceptanceTest { val msgList = retrieveNormalizedRecords(testEnv, streamName, defaultSchema) .stream() - .map { data: JsonNode? -> + .map { data: JsonNode -> AirbyteRecordMessage().withStream(streamName).withData(data) } .toList() diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/comparator/AdvancedTestDataComparator.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/comparator/AdvancedTestDataComparator.kt index 70ec462b42f7..7b6587b7394d 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/comparator/AdvancedTestDataComparator.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/comparator/AdvancedTestDataComparator.kt @@ -122,7 +122,7 @@ open class AdvancedTestDataComparator : TestDataComparator { val sameActualNode = actualList .stream() - .filter { actualNode: JsonNode? -> + .filter { actualNode: JsonNode -> compareJsonNodes(expectedNode, actualNode) } .findFirst() diff --git a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/typing_deduping/JdbcSqlGeneratorIntegrationTest.kt b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/typing_deduping/JdbcSqlGeneratorIntegrationTest.kt index 30a0270345c6..c9edfa5b3762 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/typing_deduping/JdbcSqlGeneratorIntegrationTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-destinations/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/destination/typing_deduping/JdbcSqlGeneratorIntegrationTest.kt @@ -66,7 +66,7 @@ abstract class JdbcSqlGeneratorIntegrationTest DSL.field(DSL.quotedName(columnName)) } + .map { columnName: String -> DSL.field(DSL.quotedName(columnName)) } .toList() ) for (record in records) { diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/DebeziumShutdownProcedure.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/DebeziumShutdownProcedure.kt index b6b963c21af8..d6bbe6652fe1 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/DebeziumShutdownProcedure.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/DebeziumShutdownProcedure.kt @@ -27,7 +27,7 @@ class DebeziumShutdownProcedure( init { this.hasTransferThreadShutdown = false this.executorService = - Executors.newSingleThreadExecutor { r: Runnable? -> + Executors.newSingleThreadExecutor { r: Runnable -> val thread = Thread(r, "queue-data-transfer-thread") thread.uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _: Thread, e: Throwable -> exception = e } diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/RelationalDbDebeziumPropertiesManager.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/RelationalDbDebeziumPropertiesManager.kt index c78ead79f77d..b130d4a5fd3c 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/RelationalDbDebeziumPropertiesManager.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/debezium/internals/RelationalDbDebeziumPropertiesManager.kt @@ -99,7 +99,7 @@ class RelationalDbDebeziumPropertiesManager( Pattern.quote(s.namespace + "." + s.name) + (if (StringUtils.isNotBlank(fields)) "\\.$fields" else "") } - .map { x: String? -> StringUtils.escape(x, ",".toCharArray(), "\\,") } + .map { x: String -> StringUtils.escape(x, ",".toCharArray(), "\\,") } .collect(Collectors.joining(",")) } diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/jdbc/AbstractJdbcSource.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/jdbc/AbstractJdbcSource.kt index 3250ae3846f5..9b33fd456293 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/jdbc/AbstractJdbcSource.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/jdbc/AbstractJdbcSource.kt @@ -188,8 +188,8 @@ abstract class AbstractJdbcSource( ) database.bufferedResultSetQuery( CheckedFunction { connection: Connection -> connection.metaData.catalogs }, - CheckedFunction { queryResult: ResultSet? -> - sourceOperations.rowToJson(queryResult!!) + CheckedFunction { queryResult: ResultSet -> + sourceOperations.rowToJson(queryResult) } ) } @@ -676,7 +676,7 @@ abstract class AbstractJdbcSource( override fun close() { dataSources.forEach( - Consumer { d: DataSource? -> + Consumer { d: DataSource -> try { close(d) } catch (e: Exception) { diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/DbSourceDiscoverUtil.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/DbSourceDiscoverUtil.kt index 2c0fb8c3b1b1..c8426abad4f3 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/DbSourceDiscoverUtil.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/DbSourceDiscoverUtil.kt @@ -129,7 +129,7 @@ object DbSourceDiscoverUtil { val primaryKeys = tableInfo.primaryKeys .stream() - .filter { obj: String? -> Objects.nonNull(obj) } + .filter { obj: String -> Objects.nonNull(obj) } .map { listOf(it) } .toList() CatalogHelpers.createAirbyteStream( diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManager.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManager.kt index 657e9437c603..90a086a68a14 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManager.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManager.kt @@ -100,7 +100,7 @@ class CursorManager( true } .map { obj: ConfiguredAirbyteStream -> obj.stream } - .map { stream: AirbyteStream? -> + .map { stream: AirbyteStream -> AirbyteStreamNameNamespacePair.fromAirbyteStream(stream) } .collect(Collectors.toSet()) @@ -124,7 +124,7 @@ class CursorManager( .stream() .collect( Collectors.toMap( - Function { stream: ConfiguredAirbyteStream? -> + Function { stream: ConfiguredAirbyteStream -> AirbyteStreamNameNamespacePair.fromConfiguredAirbyteSteam(stream) }, Function.identity() diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/jdbc/DefaultJdbcSourceAcceptanceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/jdbc/DefaultJdbcSourceAcceptanceTest.kt index aaa6acfef186..86c638e09b09 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/jdbc/DefaultJdbcSourceAcceptanceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/jdbc/DefaultJdbcSourceAcceptanceTest.kt @@ -154,7 +154,7 @@ internal class DefaultJdbcSourceAcceptanceTest : "ON_ERROR_STOP=1", "-a" ), - sql.flatMap { stmt: String? -> Stream.of("-c", stmt) } + sql.flatMap { stmt: String -> Stream.of("-c", stmt) } ) ) } diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManagerTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManagerTest.kt index db80a65f95ad..7cb33f2d49c0 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManagerTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/test/kotlin/io/airbyte/cdk/integrations/source/relationaldb/state/CursorManagerTest.kt @@ -30,8 +30,8 @@ class CursorManagerTest { StateTestConstants.CURSOR_RECORD_COUNT ), StateTestConstants.getStream(StateTestConstants.CURSOR_FIELD1), - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -60,8 +60,8 @@ class CursorManagerTest { StateTestConstants.NAME_NAMESPACE_PAIR1, StateTestConstants.getState(StateTestConstants.CURSOR_FIELD1, null), StateTestConstants.getStream(StateTestConstants.CURSOR_FIELD1), - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -91,8 +91,8 @@ class CursorManagerTest { StateTestConstants.CURSOR ), StateTestConstants.getStream(StateTestConstants.CURSOR_FIELD2), - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -119,8 +119,8 @@ class CursorManagerTest { StateTestConstants.NAME_NAMESPACE_PAIR1, Optional.empty(), StateTestConstants.getStream(StateTestConstants.CURSOR_FIELD1), - Function { obj: DbStreamState? -> obj!!.cursor }, - Function { obj: DbStreamState? -> obj!!.cursorField }, + Function { obj: DbStreamState -> obj!!.cursor }, + Function { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -145,8 +145,8 @@ class CursorManagerTest { StateTestConstants.CURSOR ), Optional.empty(), - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -169,8 +169,8 @@ class CursorManagerTest { StateTestConstants.NAME_NAMESPACE_PAIR1, Optional.empty(), Optional.empty(), - Function { obj: DbStreamState? -> obj!!.cursor }, - Function { obj: DbStreamState? -> obj!!.cursorField }, + Function { obj: DbStreamState -> obj!!.cursor }, + Function { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals(CursorInfo(null, null, null, null), actual) @@ -192,8 +192,8 @@ class CursorManagerTest { StateTestConstants.CURSOR ), StateTestConstants.getStream(null), - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION ) Assertions.assertEquals( @@ -249,8 +249,8 @@ class CursorManagerTest { return CursorManager( StateTestConstants.getCatalog(cursorField).orElse(null), { setOf(dbStreamState) }, - { obj: DbStreamState? -> obj!!.cursor }, - { obj: DbStreamState? -> obj!!.cursorField }, + { obj: DbStreamState -> obj!!.cursor }, + { obj: DbStreamState -> obj!!.cursorField }, CURSOR_RECORD_COUNT_FUNCTION, { nameNamespacePair }, false diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debezium/CdcSourceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debezium/CdcSourceTest.kt index 383cc6fcb15b..7fac870614e6 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debezium/CdcSourceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debezium/CdcSourceTest.kt @@ -140,9 +140,9 @@ abstract class CdcSourceTest> { "VARCHAR(200)" ) if (randomSchema() != modelsSchema()) { - testdb!!.with(createSchemaSqlFmt(), randomSchema()) + testdb.with(createSchemaSqlFmt(), randomSchema()) } - testdb!!.with( + testdb.with( createTableSqlFmt(), randomSchema(), RANDOM_TABLE_NAME, @@ -170,7 +170,7 @@ abstract class CdcSourceTest> { @AfterEach protected open fun tearDown() { try { - testdb!!.close() + testdb.close() } catch (e: Throwable) { LOGGER.error("exception during teardown", e) } @@ -192,7 +192,7 @@ abstract class CdcSourceTest> { } i++ } - primaryKey.ifPresent { s: String? -> + primaryKey.ifPresent { s: String -> columnClause.append(", PRIMARY KEY (").append(s).append(")") } @@ -211,7 +211,7 @@ abstract class CdcSourceTest> { makeIdCol: String?, modelCol: String? ) { - testdb!!.with( + testdb.with( "INSERT INTO %s.%s (%s, %s, %s) VALUES (%s, %s, '%s');", dbName, streamName, @@ -225,11 +225,11 @@ abstract class CdcSourceTest> { } protected open fun deleteMessageOnIdCol(streamName: String?, idCol: String?, idValue: Int) { - testdb!!.with("DELETE FROM %s.%s WHERE %s = %s", modelsSchema(), streamName, idCol, idValue) + testdb.with("DELETE FROM %s.%s WHERE %s = %s", modelsSchema(), streamName, idCol, idValue) } protected open fun deleteCommand(streamName: String?) { - testdb!!.with("DELETE FROM %s.%s", modelsSchema(), streamName) + testdb.with("DELETE FROM %s.%s", modelsSchema(), streamName) } protected open fun updateCommand( @@ -239,7 +239,7 @@ abstract class CdcSourceTest> { idCol: String?, idValue: Int ) { - testdb!!.with( + testdb.with( "UPDATE %s.%s SET %s = '%s' WHERE %s = %s", modelsSchema(), streamName, @@ -254,7 +254,7 @@ abstract class CdcSourceTest> { val recordsPerStream = extractRecordMessagesStreamWise(messages) val consolidatedRecords: MutableSet = HashSet() recordsPerStream.values.forEach( - Consumer { c: Set? -> consolidatedRecords.addAll(c!!) } + Consumer { c: Set -> consolidatedRecords.addAll(c) } ) return consolidatedRecords } @@ -267,7 +267,7 @@ abstract class CdcSourceTest> { if (message.type == AirbyteMessage.Type.RECORD) { val recordMessage = message.record recordsPerStream - .computeIfAbsent(recordMessage.stream) { c: String? -> ArrayList() } + .computeIfAbsent(recordMessage.stream) { c: String -> ArrayList() } .add(recordMessage) } } @@ -360,7 +360,7 @@ abstract class CdcSourceTest> { @Throws(Exception::class) fun testExistingData() { val targetPosition = cdcLatestTargetPosition() - val read = source()!!.read(config()!!, configuredCatalog, null) + val read = source().read(config()!!, configuredCatalog, null) val actualRecords = AutoCloseableIterators.toListAndClose(read) val recordMessages = extractRecordMessages(actualRecords) @@ -554,7 +554,7 @@ abstract class CdcSourceTest> { val columns = ImmutableMap.of(COL_ID, "INTEGER", COL_MAKE_ID, "INTEGER", COL_MODEL, "VARCHAR(200)") - testdb!!.with( + testdb.with( createTableSqlFmt(), modelsSchema(), MODELS_STREAM_NAME + "_2", @@ -640,7 +640,7 @@ abstract class CdcSourceTest> { fun testNoData() { deleteCommand(MODELS_STREAM_NAME) waitForCdcRecords(modelsSchema(), MODELS_STREAM_NAME, MODEL_RECORDS.size) - val read = source()!!.read(config()!!, configuredCatalog, null) + val read = source().read(config()!!, configuredCatalog, null) val actualRecords = AutoCloseableIterators.toListAndClose(read) val recordMessages = extractRecordMessages(actualRecords) @@ -680,7 +680,7 @@ abstract class CdcSourceTest> { @Test @Throws(Exception::class) fun testCheck() { - val status = source()!!.check(config()!!) + val status = source().check(config()!!) Assertions.assertEquals(status!!.status, AirbyteConnectionStatus.Status.SUCCEEDED) } @@ -688,15 +688,14 @@ abstract class CdcSourceTest> { @Throws(Exception::class) fun testDiscover() { val expectedCatalog = expectedCatalogForDiscover() - val actualCatalog = source()!!.discover(config()!!) + val actualCatalog = source().discover(config()!!) Assertions.assertEquals( expectedCatalog.streams .stream() .sorted(Comparator.comparing { obj: AirbyteStream -> obj.name }) .collect(Collectors.toList()), - actualCatalog!! - .streams + actualCatalog.streams .stream() .sorted(Comparator.comparing { obj: AirbyteStream -> obj.name }) .collect(Collectors.toList()) @@ -987,7 +986,7 @@ abstract class CdcSourceTest> { val columns = ImmutableMap.of(COL_ID, "INTEGER", COL_MAKE_ID, "INTEGER", COL_MODEL, "VARCHAR(200)") - testdb!!.with( + testdb.with( createTableSqlFmt(), modelsSchema(), MODELS_STREAM_NAME + "_2", diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debug/DebugUtil.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debug/DebugUtil.kt index e0d59e0a2fe4..429cb8539835 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debug/DebugUtil.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/debug/DebugUtil.kt @@ -35,7 +35,7 @@ object DebugUtil { debugSource.discover(debugConfig) val messageIterator = debugSource.read(debugConfig, configuredAirbyteCatalog, state) - messageIterator.forEachRemaining { message: AirbyteMessage? -> } + messageIterator.forEachRemaining { message: AirbyteMessage -> } } @get:Throws(Exception::class) diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcSourceAcceptanceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcSourceAcceptanceTest.kt index 74cb0cdc1f15..a84f17d7987a 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcSourceAcceptanceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcSourceAcceptanceTest.kt @@ -115,8 +115,8 @@ abstract class JdbcSourceAcceptanceTest> { if (supportsSchemas()) { createSchemas() } - if (testdb!!.databaseDriver == DatabaseDriver.ORACLE) { - testdb!!.with("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'") + if (testdb.databaseDriver == DatabaseDriver.ORACLE) { + testdb.with("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD'") } testdb .with( @@ -185,13 +185,13 @@ abstract class JdbcSourceAcceptanceTest> { @AfterEach fun tearDown() { - testdb!!.close() + testdb.close() } @Test @Throws(Exception::class) open fun testSpec() { - val actual = source()!!.spec() + val actual = source().spec() val resourceString = MoreResources.readResource("spec.json") val expected = Jsons.deserialize(resourceString, ConnectorSpecification::class.java) @@ -201,7 +201,7 @@ abstract class JdbcSourceAcceptanceTest> { @Test @Throws(Exception::class) fun testCheckSuccess() { - val actual = source()!!.check(config()) + val actual = source().check(config()) val expected = AirbyteConnectionStatus().withStatus(AirbyteConnectionStatus.Status.SUCCEEDED) Assertions.assertEquals(expected, actual) @@ -213,16 +213,16 @@ abstract class JdbcSourceAcceptanceTest> { val config = config() maybeSetShorterConnectionTimeout(config) (config as ObjectNode).put(JdbcUtils.PASSWORD_KEY, "fake") - val actual = source()!!.check(config) + val actual = source().check(config) Assertions.assertEquals(AirbyteConnectionStatus.Status.FAILED, actual!!.status) } @Test @Throws(Exception::class) fun testDiscover() { - val actual = filterOutOtherSchemas(source()!!.discover(config())) + val actual = filterOutOtherSchemas(source().discover(config())) val expected = getCatalog(defaultNamespace) - Assertions.assertEquals(expected.streams.size, actual!!.streams.size) + Assertions.assertEquals(expected.streams.size, actual.streams.size) actual.streams.forEach( Consumer { actualStream: AirbyteStream -> val expectedStream = @@ -245,7 +245,7 @@ abstract class JdbcSourceAcceptanceTest> { @Test @Throws(Exception::class) protected fun testDiscoverWithNonCursorFields() { - testdb!! + testdb .with( CREATE_TABLE_WITHOUT_CURSOR_TYPE_QUERY, getFullyQualifiedTableName(TABLE_NAME_WITHOUT_CURSOR_TYPE), @@ -255,10 +255,9 @@ abstract class JdbcSourceAcceptanceTest> { INSERT_TABLE_WITHOUT_CURSOR_TYPE_QUERY, getFullyQualifiedTableName(TABLE_NAME_WITHOUT_CURSOR_TYPE) ) - val actual = filterOutOtherSchemas(source()!!.discover(config())) + val actual = filterOutOtherSchemas(source().discover(config())) val stream = - actual!! - .streams + actual.streams .stream() .filter { s: AirbyteStream -> s.name.equals(TABLE_NAME_WITHOUT_CURSOR_TYPE, ignoreCase = true) @@ -277,7 +276,7 @@ abstract class JdbcSourceAcceptanceTest> { @Test @Throws(Exception::class) protected fun testDiscoverWithNullableCursorFields() { - testdb!! + testdb .with( CREATE_TABLE_WITH_NULLABLE_CURSOR_TYPE_QUERY, getFullyQualifiedTableName(TABLE_NAME_WITH_NULLABLE_CURSOR_TYPE), @@ -287,10 +286,9 @@ abstract class JdbcSourceAcceptanceTest> { INSERT_TABLE_WITH_NULLABLE_CURSOR_TYPE_QUERY, getFullyQualifiedTableName(TABLE_NAME_WITH_NULLABLE_CURSOR_TYPE) ) - val actual = filterOutOtherSchemas(source()!!.discover(config())) + val actual = filterOutOtherSchemas(source().discover(config())) val stream = - actual!! - .streams + actual.streams .stream() .filter { s: AirbyteStream -> s.name.equals(TABLE_NAME_WITH_NULLABLE_CURSOR_TYPE, ignoreCase = true) @@ -310,7 +308,7 @@ abstract class JdbcSourceAcceptanceTest> { protected fun filterOutOtherSchemas(catalog: AirbyteCatalog): AirbyteCatalog { if (supportsSchemas()) { val filteredCatalog = Jsons.clone(catalog) - filteredCatalog!!.streams = + filteredCatalog.streams = filteredCatalog.streams .stream() .filter { stream: AirbyteStream -> @@ -330,14 +328,14 @@ abstract class JdbcSourceAcceptanceTest> { protected fun testDiscoverWithMultipleSchemas() { // clickhouse and mysql do not have a concept of schemas, so this test does not make sense // for them. - when (testdb!!.databaseDriver) { + when (testdb.databaseDriver) { DatabaseDriver.MYSQL, DatabaseDriver.CLICKHOUSE, DatabaseDriver.TERADATA -> return else -> {} } // add table and data to a separate schema. - testdb!! + testdb .with( "CREATE TABLE %s(id VARCHAR(200) NOT NULL, name VARCHAR(200) NOT NULL)", RelationalDbQueryUtils.getFullyQualifiedTableName(SCHEMA_NAME2, TABLE_NAME) @@ -355,7 +353,7 @@ abstract class JdbcSourceAcceptanceTest> { RelationalDbQueryUtils.getFullyQualifiedTableName(SCHEMA_NAME2, TABLE_NAME) ) - val actual = source()!!.discover(config()) + val actual = source().discover(config()) val expected = getCatalog(defaultNamespace) val catalogStreams: MutableList = ArrayList() @@ -376,7 +374,7 @@ abstract class JdbcSourceAcceptanceTest> { val schemaTableCompare = Comparator.comparing { stream: AirbyteStream -> stream.namespace + "." + stream.name } expected.streams.sortWith(schemaTableCompare) - actual!!.streams.sortWith(schemaTableCompare) + actual.streams.sortWith(schemaTableCompare) Assertions.assertEquals(expected, filterOutOtherSchemas(actual)) } @@ -385,7 +383,7 @@ abstract class JdbcSourceAcceptanceTest> { fun testReadSuccess() { val actualMessages = MoreIterators.toList( - source()!!.read(config(), getConfiguredCatalogWithOneStream(defaultNamespace), null) + source().read(config(), getConfiguredCatalogWithOneStream(defaultNamespace), null) ) setEmittedAtToNull(actualMessages) @@ -409,7 +407,7 @@ abstract class JdbcSourceAcceptanceTest> { defaultNamespace, Field.of(COL_ID, JsonSchemaType.NUMBER) ) - val actualMessages = MoreIterators.toList(source()!!.read(config(), catalog, null)) + val actualMessages = MoreIterators.toList(source().read(config(), catalog, null)) setEmittedAtToNull(actualMessages) @@ -446,7 +444,7 @@ abstract class JdbcSourceAcceptanceTest> { for (i in 2..9) { val streamName2 = streamName() + i val tableName = getFullyQualifiedTableName(TABLE_NAME + i) - testdb!! + testdb .with(createTableQuery(tableName, "id INTEGER, name VARCHAR(200)", "")) .with("INSERT INTO %s(id, name) VALUES (1,'picard')", tableName) .with("INSERT INTO %s(id, name) VALUES (2, 'crusher')", tableName) @@ -463,7 +461,7 @@ abstract class JdbcSourceAcceptanceTest> { expectedMessages.addAll(getAirbyteMessagesSecondSync(streamName2)) } - val actualMessages = MoreIterators.toList(source()!!.read(config(), catalog, null)) + val actualMessages = MoreIterators.toList(source().read(config(), catalog, null)) setEmittedAtToNull(actualMessages) @@ -501,7 +499,7 @@ abstract class JdbcSourceAcceptanceTest> { streamForTableWithSpaces ) ) - val actualMessages = MoreIterators.toList(source()!!.read(config(), catalog, null)) + val actualMessages = MoreIterators.toList(source().read(config(), catalog, null)) setEmittedAtToNull(actualMessages) @@ -542,7 +540,7 @@ abstract class JdbcSourceAcceptanceTest> { Mockito.doCallRealMethod().doThrow(RuntimeException()).`when`(spiedAbStream).stream Assertions.assertThrows(RuntimeException::class.java) { - source()!!.read(config(), catalog, null) + source().read(config(), catalog, null) } } @@ -656,11 +654,7 @@ abstract class JdbcSourceAcceptanceTest> { val actualMessagesFirstSync = MoreIterators.toList( - source()!!.read( - config, - configuredCatalog, - createEmptyState(streamName(), namespace) - ) + source().read(config, configuredCatalog, createEmptyState(streamName(), namespace)) ) val stateAfterFirstSyncOptional = @@ -674,11 +668,12 @@ abstract class JdbcSourceAcceptanceTest> { val actualMessagesSecondSync = MoreIterators.toList( - source()!!.read( - config, - configuredCatalog, - extractState(stateAfterFirstSyncOptional.get()) - ) + source() + .read( + config, + configuredCatalog, + extractState(stateAfterFirstSyncOptional.get()) + ) ) Assertions.assertEquals( @@ -773,7 +768,7 @@ abstract class JdbcSourceAcceptanceTest> { val tableName2 = TABLE_NAME + 2 val streamName2 = streamName() + 2 val fqTableName2 = getFullyQualifiedTableName(tableName2) - testdb!! + testdb .with(createTableQuery(fqTableName2, "id INTEGER, name VARCHAR(200)", "")) .with("INSERT INTO %s(id, name) VALUES (1,'picard')", fqTableName2) .with("INSERT INTO %s(id, name) VALUES (2, 'crusher')", fqTableName2) @@ -799,11 +794,8 @@ abstract class JdbcSourceAcceptanceTest> { val actualMessagesFirstSync = MoreIterators.toList( - source()!!.read( - config(), - configuredCatalog, - createEmptyState(streamName(), namespace) - ) + source() + .read(config(), configuredCatalog, createEmptyState(streamName(), namespace)) ) // get last state message. @@ -915,7 +907,7 @@ abstract class JdbcSourceAcceptanceTest> { ) // 1st sync - testdb!! + testdb .with(createTableQuery(fullyQualifiedTableName, columnDefinition, "")) .with( INSERT_TABLE_NAME_AND_TIMESTAMP_QUERY, @@ -958,11 +950,12 @@ abstract class JdbcSourceAcceptanceTest> { val firstSyncActualMessages = MoreIterators.toList( - source()!!.read( - config(), - configuredCatalog, - createEmptyState(TABLE_NAME_AND_TIMESTAMP, namespace) - ) + source() + .read( + config(), + configuredCatalog, + createEmptyState(TABLE_NAME_AND_TIMESTAMP, namespace) + ) ) // cursor after 1st sync: 2021-01-01 00:00:00, count 2 @@ -989,8 +982,8 @@ abstract class JdbcSourceAcceptanceTest> { .toList() // some databases don't make insertion order guarantee when equal ordering value if ( - testdb!!.databaseDriver == DatabaseDriver.TERADATA || - testdb!!.databaseDriver == DatabaseDriver.ORACLE + testdb.databaseDriver == DatabaseDriver.TERADATA || + testdb.databaseDriver == DatabaseDriver.ORACLE ) { MatcherAssert.assertThat( listOf("a", "b"), @@ -1001,7 +994,7 @@ abstract class JdbcSourceAcceptanceTest> { } // 2nd sync - testdb!!.with( + testdb.with( INSERT_TABLE_NAME_AND_TIMESTAMP_QUERY, fullyQualifiedTableName, "c", @@ -1010,11 +1003,12 @@ abstract class JdbcSourceAcceptanceTest> { val secondSyncActualMessages = MoreIterators.toList( - source()!!.read( - config(), - configuredCatalog, - createState(TABLE_NAME_AND_TIMESTAMP, namespace, firstSyncState) - ) + source() + .read( + config(), + configuredCatalog, + createState(TABLE_NAME_AND_TIMESTAMP, namespace, firstSyncState) + ) ) // cursor after 2nd sync: 2021-01-02 00:00:00, count 1 @@ -1042,7 +1036,7 @@ abstract class JdbcSourceAcceptanceTest> { Assertions.assertEquals(listOf("c"), secondSyncNames) // 3rd sync has records with duplicated cursors - testdb!! + testdb .with( INSERT_TABLE_NAME_AND_TIMESTAMP_QUERY, fullyQualifiedTableName, @@ -1064,11 +1058,12 @@ abstract class JdbcSourceAcceptanceTest> { val thirdSyncActualMessages = MoreIterators.toList( - source()!!.read( - config(), - configuredCatalog, - createState(TABLE_NAME_AND_TIMESTAMP, namespace, secondSyncState) - ) + source() + .read( + config(), + configuredCatalog, + createState(TABLE_NAME_AND_TIMESTAMP, namespace, secondSyncState) + ) ) // Cursor after 3rd sync is: 2021-01-03 00:00:00, count 1. @@ -1097,7 +1092,7 @@ abstract class JdbcSourceAcceptanceTest> { .toList() // teradata doesn't make insertion order guarantee when equal ordering value - if (testdb!!.databaseDriver == DatabaseDriver.TERADATA) { + if (testdb.databaseDriver == DatabaseDriver.TERADATA) { MatcherAssert.assertThat( listOf("c", "d", "e", "f"), Matchers.containsInAnyOrder(*thirdSyncExpectedNames.toTypedArray()) @@ -1154,11 +1149,12 @@ abstract class JdbcSourceAcceptanceTest> { val actualMessages = MoreIterators.toList( - source()!!.read( - config(), - configuredCatalog, - Jsons.jsonNode(createState(java.util.List.of(dbStreamState))) - ) + source() + .read( + config(), + configuredCatalog, + Jsons.jsonNode(createState(java.util.List.of(dbStreamState))) + ) ) setEmittedAtToNull(actualMessages) @@ -1366,7 +1362,7 @@ abstract class JdbcSourceAcceptanceTest> { val tableNameWithSpaces = TABLE_NAME_WITH_SPACES + "2" val streamName2 = tableNameWithSpaces - testdb!!.getDataSource()!!.connection.use { connection -> + testdb.getDataSource()!!.connection.use { connection -> val identifierQuoteString = connection.metaData.identifierQuoteString connection .createStatement() @@ -1454,13 +1450,13 @@ abstract class JdbcSourceAcceptanceTest> { protected fun createSchemas() { if (supportsSchemas()) { for (schemaName in TEST_SCHEMAS) { - testdb!!.with("CREATE SCHEMA %s;", schemaName) + testdb.with("CREATE SCHEMA %s;", schemaName) } } } private fun convertIdBasedOnDatabase(idValue: Int): JsonNode { - return when (testdb!!.databaseDriver) { + return when (testdb.databaseDriver) { DatabaseDriver.ORACLE, DatabaseDriver.SNOWFLAKE -> Jsons.jsonNode(BigDecimal.valueOf(idValue.toLong())) else -> Jsons.jsonNode(idValue) @@ -1472,10 +1468,10 @@ abstract class JdbcSourceAcceptanceTest> { protected val defaultNamespace: String get() = - when (testdb!!.databaseDriver) { + when (testdb.databaseDriver) { DatabaseDriver.MYSQL, DatabaseDriver.CLICKHOUSE, - DatabaseDriver.TERADATA -> testdb!!.databaseName!! + DatabaseDriver.TERADATA -> testdb.databaseName else -> SCHEMA_NAME } diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcStressTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcStressTest.kt index e6d10c704129..f231d01ab0c2 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcStressTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/source/jdbc/test/JdbcStressTest.kt @@ -161,7 +161,7 @@ abstract class JdbcStressTest { private fun runTest(configuredCatalog: ConfiguredAirbyteCatalog, testName: String) { LOGGER.info("running stress test for: $testName") val read: Iterator = - source!!.read(config!!, configuredCatalog, Jsons.jsonNode(emptyMap())) + source!!.read(config, configuredCatalog, Jsons.jsonNode(emptyMap())) val actualCount = MoreStreams.toStream(read) .filter { m: AirbyteMessage -> m.type == AirbyteMessage.Type.RECORD } diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceConnectorTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceConnectorTest.kt index 80849c283d75..9b42e6852800 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceConnectorTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceConnectorTest.kt @@ -54,15 +54,7 @@ abstract class AbstractSourceConnectorTest { /** Name of the docker image that the tests will run against. */ protected abstract val imageName: String - @get:Throws(Exception::class) - protected abstract val config: JsonNode? - /** - * Configuration specific to the integration. Will be passed to integration where - * appropriate in each test. Should be valid. - * - * @return integration-specific configuration - */ - get + @get:Throws(Exception::class) protected abstract val config: JsonNode? /** * Function that performs any setup of external resources required for the test. e.g. diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceDatabaseTypeTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceDatabaseTypeTest.kt index d5dc3959aed6..4d721ea307f2 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceDatabaseTypeTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/AbstractSourceDatabaseTypeTest.kt @@ -71,13 +71,6 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { } protected abstract val nameSpace: String - /** - * Provide a source namespace. It's allocated place for table creation. It also known ask - * "Database Schema" or "Dataset" - * - * @return source name space - */ - get /** * Test the 'discover' command. TODO (liren): Some existing databases may fail testDataTypes(), @@ -102,7 +95,7 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { .collect( Collectors.toMap( Function { obj: AirbyteStream -> obj.name }, - Function { s: AirbyteStream? -> s } + Function { s: AirbyteStream -> s } ) ) @@ -146,7 +139,7 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { val allMessages = runRead(catalog) val recordMessages = - allMessages!! + allMessages .stream() .filter { m: AirbyteMessage -> m.type == AirbyteMessage.Type.RECORD } .toList() @@ -202,7 +195,7 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { "The stream '%s' checking type '%s' initialized at %s got unexpected values: %s".formatted( streamName, test.sourceType, - test!!.declarationLocation, + test.declarationLocation, unexpectedValue ) ) @@ -218,7 +211,7 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { "The stream '%s' checking type '%s' initialized at %s is missing values: %s".formatted( streamName, test.sourceType, - test!!.declarationLocation, + test.declarationLocation, missedValue ) ) @@ -258,8 +251,8 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { @Throws(Exception::class) protected open fun createTables() { for (test in testDataHolders) { - database!!.query { ctx: DSLContext? -> - ctx!!.fetch(test.createSqlQuery) + database!!.query { ctx: DSLContext -> + ctx.fetch(test.createSqlQuery) LOGGER.info("Table {} is created.", test.nameWithTestPrefix) null } @@ -269,8 +262,8 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { @Throws(Exception::class) protected open fun populateTables() { for (test in testDataHolders) { - database!!.query { ctx: DSLContext? -> - test.insertSqlQueries.forEach(Consumer { sql: String? -> ctx!!.fetch(sql) }) + database!!.query { ctx: DSLContext -> + test.insertSqlQueries.forEach(Consumer { sql: String -> ctx.fetch(sql) }) LOGGER.info( "Inserted {} rows in Ttable {}", test.insertSqlQueries.size, @@ -340,8 +333,8 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { test.setDeclarationLocation(Thread.currentThread().stackTrace) } - private fun formatCollection(collection: Collection?): String { - return collection!!.stream().map { s: String? -> "`$s`" }.collect(Collectors.joining(", ")) + private fun formatCollection(collection: Collection): String { + return collection.stream().map { s: String? -> "`$s`" }.collect(Collectors.joining(", ")) } val markdownTestTable: String @@ -382,8 +375,8 @@ abstract class AbstractSourceDatabaseTypeTest : AbstractSourceConnectorTest() { @Throws(SQLException::class) protected fun createDummyTableWithData(database: Database): ConfiguredAirbyteStream { - database.query { ctx: DSLContext? -> - ctx!!.fetch( + database.query { ctx: DSLContext -> + ctx.fetch( "CREATE TABLE " + nameSpace + ".random_dummy_table(id INTEGER PRIMARY KEY, test_column VARCHAR(63));" diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/PythonSourceAcceptanceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/PythonSourceAcceptanceTest.kt index 4199cc394c5b..1f586965807f 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/PythonSourceAcceptanceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/PythonSourceAcceptanceTest.kt @@ -35,7 +35,7 @@ class PythonSourceAcceptanceTest : SourceAcceptanceTest() { get() = runExecutable(Command.GET_SPEC, ConnectorSpecification::class.java) @get:Throws(IOException::class) - override val config: JsonNode? + override val config: JsonNode get() = runExecutable(Command.GET_CONFIG) @get:Throws(IOException::class) @@ -43,7 +43,7 @@ class PythonSourceAcceptanceTest : SourceAcceptanceTest() { get() = runExecutable(Command.GET_CONFIGURED_CATALOG, ConfiguredAirbyteCatalog::class.java) @get:Throws(IOException::class) - override val state: JsonNode? + override val state: JsonNode get() = runExecutable(Command.GET_STATE) @Throws(IOException::class) @@ -55,7 +55,7 @@ class PythonSourceAcceptanceTest : SourceAcceptanceTest() { .map { obj: JsonNode -> obj.textValue() } .toList() val stringMessages = - allMessages!! + allMessages .stream() .map { `object`: AirbyteMessage -> Jsons.serialize(`object`) } .toList() @@ -138,8 +138,8 @@ class PythonSourceAcceptanceTest : SourceAcceptanceTest() { ) val process = ProcessBuilder(dockerCmd).start() - LineGobbler.gobble(process.errorStream, { msg: String? -> LOGGER.error(msg) }) - LineGobbler.gobble(process.inputStream, { msg: String? -> LOGGER.info(msg) }) + LineGobbler.gobble(process.errorStream, { msg: String -> LOGGER.error(msg) }) + LineGobbler.gobble(process.inputStream, { msg: String -> LOGGER.info(msg) }) TestHarnessUtils.gentleClose(process, 1, TimeUnit.MINUTES) diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/SourceAcceptanceTest.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/SourceAcceptanceTest.kt index 66b1dc8a1fa7..a0fdb9ad721a 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/SourceAcceptanceTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/SourceAcceptanceTest.kt @@ -56,37 +56,11 @@ abstract class SourceAcceptanceTest : AbstractSourceConnectorTest() { private val IMAGES_TO_SKIP_IDENTICAL_FULL_REFRESHES: Set = Sets.newHashSet("airbyte/source-google-workspace-admin-reports", "airbyte/source-kafka") - @get:Throws(Exception::class) - protected abstract val spec: ConnectorSpecification - /** - * Specification for integration. Will be passed to integration where appropriate in each - * test. Should be valid. - * - * @return integration-specific configuration - */ - get - - @get:Throws(Exception::class) - protected abstract val configuredCatalog: ConfiguredAirbyteCatalog - /** - * The catalog to use to validate the output of read operations. This will be used as - * follows: - * - * Full Refresh syncs will be tested on all the input streams which support it Incremental - * syncs: - if the stream declares a source-defined cursor, it will be tested with an - * incremental sync using the default cursor. - if the stream requires a user-defined - * cursor, it will be tested with the input cursor in both cases, the input [.getState] will - * be used as the input state. - * - * @return - * @throws Exception - */ - get - - @get:Throws(Exception::class) - protected abstract val state: JsonNode? - /** @return a JSON file representing the state file to use when testing incremental syncs */ - get + @get:Throws(Exception::class) protected abstract val spec: ConnectorSpecification + + @get:Throws(Exception::class) protected abstract val configuredCatalog: ConfiguredAirbyteCatalog + + @get:Throws(Exception::class) protected abstract val state: JsonNode? /** Verify that a spec operation issued to the connector returns a valid spec. */ @Test @@ -456,7 +430,7 @@ abstract class SourceAcceptanceTest : AbstractSourceConnectorTest() { } @JvmStatic - public fun extractLatestState(stateMessages: List): JsonNode? { + fun extractLatestState(stateMessages: List): JsonNode? { var latestState: JsonNode? = null for (stateMessage in stateMessages) { if (stateMessage.type == AirbyteStateMessage.AirbyteStateType.STREAM) { diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestDataHolder.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestDataHolder.kt index e0f137b2547f..4df587de1382 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestDataHolder.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestDataHolder.kt @@ -184,9 +184,9 @@ internal constructor( this.declarationLocation = Arrays.asList(*declarationLocation).subList(2, 3).toString() } - val insertSqlQueries: List + val insertSqlQueries: List get() { - val insertSqls: MutableList = ArrayList() + val insertSqls: MutableList = ArrayList() var rowId = 1 for (value in values) { insertSqls.add( diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestEnvConfigs.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestEnvConfigs.kt index d8fb72eace19..d4139d9fc7f1 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestEnvConfigs.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/TestEnvConfigs.kt @@ -130,7 +130,7 @@ class TestEnvConfigs private constructor(envMap: Map) { val value = getEnv(name) checkNotNull(value != null) { "$name environment variable cannot be null" } - return value!! + return value } companion object { diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/fs/ExecutableTestSource.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/fs/ExecutableTestSource.kt index 6b79f0863bc5..819993486729 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/fs/ExecutableTestSource.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/fs/ExecutableTestSource.kt @@ -35,7 +35,7 @@ class ExecutableTestSource : SourceAcceptanceTest() { override val imageName: String get() = TEST_CONFIG!!.imageName - override val config: JsonNode? + override val config: JsonNode get() = Jsons.deserialize(IOs.readFile(TEST_CONFIG!!.configPath)) override val configuredCatalog: ConfiguredAirbyteCatalog @@ -45,7 +45,7 @@ class ExecutableTestSource : SourceAcceptanceTest() { ConfiguredAirbyteCatalog::class.java ) - override val state: JsonNode? + override val state: JsonNode get() = if (TEST_CONFIG!!.statePath != null) { Jsons.deserialize(IOs.readFile(TEST_CONFIG!!.statePath)) diff --git a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/performancetest/AbstractSourceFillDbWithTestData.kt b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/performancetest/AbstractSourceFillDbWithTestData.kt index 37e88b9e0269..253fe840ef02 100644 --- a/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/performancetest/AbstractSourceFillDbWithTestData.kt +++ b/airbyte-cdk/java/airbyte-cdk/db-sources/src/testFixtures/kotlin/io/airbyte/cdk/integrations/standardtest/source/performancetest/AbstractSourceFillDbWithTestData.kt @@ -46,11 +46,11 @@ abstract class AbstractSourceFillDbWithTestData : AbstractSourceBasePerformanceT ) { val database = setupDatabase(dbName) - database.query { ctx: DSLContext? -> + database.query { ctx: DSLContext -> for (currentSteamNumber in 0 until numberOfStreams) { val currentTableName = String.format(testStreamNameTemplate, currentSteamNumber) - ctx!!.fetch(prepareCreateTableQuery(schemaName, numberOfColumns, currentTableName)) + ctx.fetch(prepareCreateTableQuery(schemaName, numberOfColumns, currentTableName)) for (i in 0 until numberOfBatches) { val insertQueryTemplate = prepareInsertQueryTemplate( diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/features/EnvVariableFeatureFlags.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/features/EnvVariableFeatureFlags.kt index 9dc84fbc51a4..46a7ebe87592 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/features/EnvVariableFeatureFlags.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/features/EnvVariableFeatureFlags.kt @@ -25,24 +25,24 @@ class EnvVariableFeatureFlags : FeatureFlags { } override fun fieldSelectionWorkspaces(): String? { - return getEnvOrDefault(FIELD_SELECTION_WORKSPACES, "") { arg: String? -> arg } + return getEnvOrDefault(FIELD_SELECTION_WORKSPACES, "") { arg: String -> arg } } override fun strictComparisonNormalizationWorkspaces(): String? { - return getEnvOrDefault(STRICT_COMPARISON_NORMALIZATION_WORKSPACES, "") { arg: String? -> + return getEnvOrDefault(STRICT_COMPARISON_NORMALIZATION_WORKSPACES, "") { arg: String -> arg } } override fun strictComparisonNormalizationTag(): String? { return getEnvOrDefault(STRICT_COMPARISON_NORMALIZATION_TAG, "strict_comparison2") { - arg: String? -> + arg: String -> arg } } override fun deploymentMode(): String? { - return getEnvOrDefault(DEPLOYMENT_MODE, "") { arg: String? -> arg } + return getEnvOrDefault(DEPLOYMENT_MODE, "") { arg: String -> arg } } // TODO: refactor in order to use the same method than the ones in EnvConfigs.java diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/JsonSchemas.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/JsonSchemas.kt index de236ec827c0..e97475ec0f46 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/JsonSchemas.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/JsonSchemas.kt @@ -124,7 +124,7 @@ object JsonSchemas { // returns true. return traverseJsonSchemaWithFilteredCollector(jsonSchema) { node: JsonNode?, - path: List? -> + path: List -> Optional.ofNullable(mapper.apply(node, path)) } } @@ -145,10 +145,10 @@ object JsonSchemas { */ fun traverseJsonSchemaWithFilteredCollector( jsonSchema: JsonNode, - mapper: BiFunction?, Optional> + mapper: BiFunction, Optional> ): List { val collector: MutableList = ArrayList() - traverseJsonSchema(jsonSchema) { node: JsonNode?, path: List? -> + traverseJsonSchema(jsonSchema) { node: JsonNode?, path: List -> mapper.apply(node, path).ifPresent { e: T -> collector.add(e) } } return collector.stream().toList() // make list unmodifiable @@ -172,10 +172,10 @@ object JsonSchemas { ): List> { return traverseJsonSchemaWithFilteredCollector(obj) { node: JsonNode?, - path: List? -> + path: List -> if (predicate.test(node)) { return@traverseJsonSchemaWithFilteredCollector Optional.of?>( - path!! + path ) } else { return@traverseJsonSchemaWithFilteredCollector Optional.empty< diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/Jsons.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/Jsons.kt index 8b9a91d9ebca..7c09bf9e2e69 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/Jsons.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/json/Jsons.kt @@ -269,28 +269,28 @@ object Jsons { return targetNode } - fun replaceNestedValue(json: JsonNode, keys: List, replacement: JsonNode?) { - replaceNested(json, keys) { node: ObjectNode, finalKey: String? -> + fun replaceNestedValue(json: JsonNode, keys: List, replacement: JsonNode?) { + replaceNested(json, keys) { node: ObjectNode, finalKey: String -> node.replace(finalKey, replacement) } } - fun replaceNestedString(json: JsonNode, keys: List, replacement: String?) { - replaceNested(json, keys) { node: ObjectNode, finalKey: String? -> + fun replaceNestedString(json: JsonNode, keys: List, replacement: String?) { + replaceNested(json, keys) { node: ObjectNode, finalKey: String -> node.put(finalKey, replacement) } } - fun replaceNestedInt(json: JsonNode, keys: List, replacement: Int) { - replaceNested(json, keys) { node: ObjectNode, finalKey: String? -> + fun replaceNestedInt(json: JsonNode, keys: List, replacement: Int) { + replaceNested(json, keys) { node: ObjectNode, finalKey: String -> node.put(finalKey, replacement) } } private fun replaceNested( json: JsonNode, - keys: List, - typedReplacement: BiConsumer + keys: List, + typedReplacement: BiConsumer ) { Preconditions.checkArgument(!keys.isEmpty(), "Must pass at least one key") val nodeContainingFinalKey = navigateTo(json, keys.subList(0, keys.size - 1)) diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/CloseableShutdownHook.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/CloseableShutdownHook.kt index 280f41bc96fd..c08cf4deffe4 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/CloseableShutdownHook.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/CloseableShutdownHook.kt @@ -24,7 +24,7 @@ object CloseableShutdownHook { * * @param objects An array of objects to be closed on application shutdown. */ - fun registerRuntimeShutdownHook(vararg objects: Any?) { + fun registerRuntimeShutdownHook(vararg objects: Any) { Runtime.getRuntime().addShutdownHook(buildShutdownHookThread(*objects)) } @@ -35,11 +35,11 @@ object CloseableShutdownHook { * @return The application shutdown hook [Thread]. */ @VisibleForTesting - fun buildShutdownHookThread(vararg objects: Any?): Thread { + fun buildShutdownHookThread(vararg objects: Any): Thread { val autoCloseables: Collection = Stream.of(*objects) - .filter { o: Any? -> o is AutoCloseable } - .map { obj: Any? -> AutoCloseable::class.java.cast(obj) } + .filter { o: Any -> o is AutoCloseable } + .map { obj: Any -> AutoCloseable::class.java.cast(obj) } .toList() return Thread { autoCloseables.forEach { it.close() } } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/Exceptions.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/Exceptions.kt index f0a1a73ddbe3..41d21d2ae270 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/Exceptions.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/lang/Exceptions.kt @@ -39,7 +39,7 @@ object Exceptions { */ @JvmStatic fun toRuntime(voidCallable: Procedure) { - castCheckedToRuntime(voidCallable) { cause: Exception? -> RuntimeException(cause) } + castCheckedToRuntime(voidCallable) { cause: Exception -> RuntimeException(cause) } } private fun castCheckedToRuntime( diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/stream/StreamStatusUtils.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/stream/StreamStatusUtils.kt index b058f7e66af1..aa7513a54b69 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/stream/StreamStatusUtils.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/commons/stream/StreamStatusUtils.kt @@ -88,7 +88,7 @@ object StreamStatusUtils { airbyteStream: Optional, statusEmitter: Optional> ) { - airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("RUNNING -> {}", s) emitStreamStatus( s, @@ -134,7 +134,7 @@ object StreamStatusUtils { airbyteStream: Optional, statusEmitter: Optional> ) { - airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("STARTING -> {}", s) emitStreamStatus( s, @@ -180,7 +180,7 @@ object StreamStatusUtils { airbyteStream: Optional, statusEmitter: Optional> ) { - airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("COMPLETE -> {}", s) emitStreamStatus( s, @@ -226,7 +226,7 @@ object StreamStatusUtils { airbyteStream: Optional, statusEmitter: Optional> ) { - airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair? -> + airbyteStream.ifPresent { s: AirbyteStreamNameNamespacePair -> LOGGER.debug("INCOMPLETE -> {}", s) emitStreamStatus( s, diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/ConfigSchema.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/ConfigSchema.kt index 336b0fb56ec4..52cfb0e7720f 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/ConfigSchema.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/ConfigSchema.kt @@ -102,7 +102,7 @@ enum class ConfigSchema : AirbyteConfig { constructor(schemaFilename: String, className: Class<*>) { this.schemaFilename = schemaFilename this.className = className - extractId = Function { _: Any? -> + extractId = Function { _: Any -> throw RuntimeException(className.getSimpleName() + " doesn't have an id") } idFieldName = null diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/EnvConfigs.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/EnvConfigs.kt index c1928e9fea24..6bdad3700067 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/EnvConfigs.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/configoss/EnvConfigs.kt @@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory class EnvConfigs @JvmOverloads constructor(envMap: Map = System.getenv()) : Configs { - private val getEnv = Function { key: String? -> envMap[key] } + private val getEnv = Function { key: String -> envMap[key] } /** * Constructs [EnvConfigs] from a provided map. This can be used for testing or getting diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/lang/CloseableShutdownHookTest.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/lang/CloseableShutdownHookTest.kt index 65b3597389fd..b4b96d316cf6 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/lang/CloseableShutdownHookTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/lang/CloseableShutdownHookTest.kt @@ -20,7 +20,6 @@ internal class CloseableShutdownHookTest { closeable, autoCloseable, notCloseable, - null ) thread.run() diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/util/LazyAutoCloseableIteratorTest.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/util/LazyAutoCloseableIteratorTest.kt index 6b3f85caf017..f38f359608c5 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/util/LazyAutoCloseableIteratorTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/util/LazyAutoCloseableIteratorTest.kt @@ -63,10 +63,10 @@ internal class LazyAutoCloseableIteratorTest { } private fun mockInternalIteratorWith(iterator: Iterator) { - Mockito.`when`(internalIterator!!.hasNext()).then { a: InvocationOnMock? -> + Mockito.`when`(internalIterator!!.hasNext()).then { a: InvocationOnMock -> iterator.hasNext() } - Mockito.`when`(internalIterator!!.next()).then { a: InvocationOnMock? -> iterator.next() } + Mockito.`when`(internalIterator!!.next()).then { a: InvocationOnMock -> iterator.next() } } private fun assertNext(iterator: Iterator, value: String) { diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/yaml/YamlsTest.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/yaml/YamlsTest.kt index bc6c67d11b08..0e5fe8be3fed 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/yaml/YamlsTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/commons/yaml/YamlsTest.kt @@ -111,7 +111,7 @@ internal class YamlsTest { Assertions.assertEquals( classes, MoreStreams.toStream(iterator) - .map { e: JsonNode? -> Jsons.`object`(e, ToClass::class.java) } + .map { e: JsonNode -> Jsons.`object`(e, ToClass::class.java) } .collect(Collectors.toList()) ) } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/workers/TestHarnessUtilsTest.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/workers/TestHarnessUtilsTest.kt index 56bc423d5f53..12d727bfe884 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/workers/TestHarnessUtilsTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/test/kotlin/io/airbyte/workers/TestHarnessUtilsTest.kt @@ -56,7 +56,7 @@ internal class TestHarnessUtilsTest { fun testStartsWait() { Mockito.`when`(process.isAlive).thenReturn(true) val recordedBeats = AtomicInteger(0) - Mockito.doAnswer { ignored: InvocationOnMock? -> + Mockito.doAnswer { ignored: InvocationOnMock -> recordedBeats.incrementAndGet() true } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/TestHarnessUtils.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/TestHarnessUtils.kt index f8672a0efbb6..8a43668f6711 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/TestHarnessUtils.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/TestHarnessUtils.kt @@ -31,7 +31,7 @@ object TestHarnessUtils { } if (process.info() != null) { - process.info().commandLine().ifPresent { commandLine: String? -> + process.info().commandLine().ifPresent { commandLine: String -> LOGGER.debug("Gently closing process {}", commandLine) } } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DbtTransformationRunner.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DbtTransformationRunner.kt index 3f78b196fc2e..8de44daf0e48 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DbtTransformationRunner.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DbtTransformationRunner.kt @@ -122,12 +122,12 @@ class DbtTransformationRunner( this.process = process LineGobbler.gobble( process.inputStream, - { msg: String? -> LOGGER.info(msg) }, + { msg: String -> LOGGER.info(msg) }, CONTAINER_LOG_MDC_BUILDER ) LineGobbler.gobble( process.errorStream, - { msg: String? -> LOGGER.error(msg) }, + { msg: String -> LOGGER.error(msg) }, CONTAINER_LOG_MDC_BUILDER ) diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultCheckConnectionTestHarness.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultCheckConnectionTestHarness.kt index 603c267b168c..c95da65ed1d1 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultCheckConnectionTestHarness.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultCheckConnectionTestHarness.kt @@ -45,7 +45,7 @@ constructor( val jobOutput = ConnectorJobOutput().withOutputType(ConnectorJobOutput.OutputType.CHECK_CONNECTION) - LineGobbler.gobble(process.errorStream, { msg: String? -> LOGGER.error(msg) }) + LineGobbler.gobble(process.errorStream, { msg: String -> LOGGER.error(msg) }) val messagesByType = TestHarnessUtils.getMessagesByType(process, streamFactory, 30) val connectionStatus = @@ -86,7 +86,7 @@ constructor( ConnectorJobOutput.OutputType.CHECK_CONNECTION, messagesByType ) - failureReason.ifPresent { failureReason: FailureReason? -> + failureReason.ifPresent { failureReason: FailureReason -> jobOutput.failureReason = failureReason } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultDiscoverCatalogTestHarness.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultDiscoverCatalogTestHarness.kt index e3075c6cebde..61e9884a39c9 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultDiscoverCatalogTestHarness.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultDiscoverCatalogTestHarness.kt @@ -53,7 +53,7 @@ constructor( ConnectorJobOutput() .withOutputType(ConnectorJobOutput.OutputType.DISCOVER_CATALOG_ID) - LineGobbler.gobble(process.errorStream, { msg: String? -> LOGGER.error(msg) }) + LineGobbler.gobble(process.errorStream, { msg: String -> LOGGER.error(msg) }) val messagesByType = TestHarnessUtils.getMessagesByType(process, streamFactory, 30) diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultGetSpecTestHarness.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultGetSpecTestHarness.kt index 61f554a6f117..387c54d3726c 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultGetSpecTestHarness.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/general/DefaultGetSpecTestHarness.kt @@ -32,7 +32,7 @@ constructor( this.process = process val jobOutput = ConnectorJobOutput().withOutputType(ConnectorJobOutput.OutputType.SPEC) - LineGobbler.gobble(process!!.errorStream, { msg: String? -> LOGGER.error(msg) }) + LineGobbler.gobble(process!!.errorStream, { msg: String -> LOGGER.error(msg) }) val messagesByType = TestHarnessUtils.getMessagesByType(process, streamFactory, 30) @@ -48,7 +48,7 @@ constructor( ConnectorJobOutput.OutputType.SPEC, messagesByType ) - failureReason!!.ifPresent { failureReason: FailureReason? -> + failureReason!!.ifPresent { failureReason: FailureReason -> jobOutput.failureReason = failureReason } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteDestination.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteDestination.kt index cb1e62e3d15b..dd5dd26d496c 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteDestination.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteDestination.kt @@ -91,7 +91,7 @@ constructor( // stdout logs are logged elsewhere since stdout also contains data LineGobbler.gobble( destinationProcess!!.errorStream, - { msg: String? -> LOGGER.error(msg) }, + { msg: String -> LOGGER.error(msg) }, "airbyte-destination", CONTAINER_LOG_MDC_BUILDER ) diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteSource.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteSource.kt index 8018576ba8c7..e53c2b7c966f 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteSource.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteSource.kt @@ -110,7 +110,7 @@ internal constructor( // stdout logs are logged elsewhere since stdout also contains data LineGobbler.gobble( sourceProcess!!.errorStream, - { msg: String? -> LOGGER.error(msg) }, + { msg: String -> LOGGER.error(msg) }, "airbyte-source", CONTAINER_LOG_MDC_BUILDER ) @@ -127,7 +127,7 @@ internal constructor( messageIterator = streamFactory .create(IOs.newBufferedReader(sourceProcess!!.inputStream)) - .peek { message: AirbyteMessage? -> heartbeatMonitor.beat() } + .peek { message: AirbyteMessage -> heartbeatMonitor.beat() } .filter { message: AirbyteMessage -> acceptedMessageTypes.contains(message.type) } .iterator() } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteStreamFactory.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteStreamFactory.kt index 6f13fc7c1cba..4ff012f8578d 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteStreamFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/internal/DefaultAirbyteStreamFactory.kt @@ -113,7 +113,7 @@ class DefaultAirbyteStreamFactory : AirbyteStreamFactory { } } } - .flatMap { line: String? -> this.parseJson(line) } + .flatMap { line: String -> this.parseJson(line) } .filter { json: JsonNode? -> this.validate(json) } .flatMap { json: JsonNode? -> this.toAirbyteMessage(json) } .filter { message: AirbyteMessage -> this.filterLog(message) } diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/normalization/DefaultNormalizationRunner.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/normalization/DefaultNormalizationRunner.kt index 87ec510ea110..715d6c934274 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/normalization/DefaultNormalizationRunner.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/normalization/DefaultNormalizationRunner.kt @@ -212,7 +212,7 @@ class DefaultNormalizationRunner( } LineGobbler.gobble( process.errorStream, - { msg: String? -> LOGGER.error(msg) }, + { msg: String -> LOGGER.error(msg) }, CONTAINER_LOG_MDC_BUILDER ) diff --git a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/process/DockerProcessFactory.kt b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/process/DockerProcessFactory.kt index 10edca57ab7d..af29299515e0 100644 --- a/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/process/DockerProcessFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/dependencies/src/testFixtures/kotlin/io/airbyte/workers/process/DockerProcessFactory.kt @@ -169,8 +169,8 @@ class DockerProcessFactory( fun checkImageExists(imageName: String?): Boolean { try { val process = ProcessBuilder(imageExistsScriptPath.toString(), imageName).start() - LineGobbler.gobble(process.errorStream, { msg: String? -> LOGGER.error(msg) }) - LineGobbler.gobble(process.inputStream, { msg: String? -> LOGGER.info(msg) }) + LineGobbler.gobble(process.errorStream, { msg: String -> LOGGER.error(msg) }) + LineGobbler.gobble(process.inputStream, { msg: String -> LOGGER.info(msg) }) TestHarnessUtils.gentleClose(process, 10, TimeUnit.MINUTES) @@ -229,9 +229,9 @@ class DockerProcessFactory( fun localDebuggingOptions(containerName: String): List { val shouldAddDebuggerOptions = (Optional.ofNullable(System.getenv("DEBUG_CONTAINER_IMAGE")) - .filter { cs: String? -> StringUtils.isNotEmpty(cs) } + .filter { cs: String -> StringUtils.isNotEmpty(cs) } .map( - Function { imageName: String? -> + Function { imageName: String -> ProcessFactory.Companion.extractShortImageName(containerName) .startsWith(imageName!!) } diff --git a/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopier.kt b/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopier.kt index 43df57b1583e..6b2ec6d0d1cc 100644 --- a/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopier.kt +++ b/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopier.kt @@ -65,7 +65,7 @@ abstract class GcsStreamCopier( ) } - override fun prepareStagingFile(): String? { + override fun prepareStagingFile(): String { val name = prepareGcsStagingFile() if (!gcsStagingFiles.contains(name)) { gcsStagingFiles.add(name) diff --git a/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopierFactory.kt b/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopierFactory.kt index e397e7022749..99f76247775f 100644 --- a/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopierFactory.kt +++ b/airbyte-cdk/java/airbyte-cdk/gcs-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/jdbc/copy/gcs/GcsStreamCopierFactory.kt @@ -28,7 +28,7 @@ abstract class GcsStreamCopierFactory : StreamCopierFactory { nameTransformer: StandardNameTransformer?, db: JdbcDatabase?, sqlOperations: SqlOperations? - ): StreamCopier? { + ): StreamCopier { try { val stream = configuredStream!!.stream val syncMode = configuredStream.destinationSyncMode @@ -72,5 +72,5 @@ abstract class GcsStreamCopierFactory : StreamCopierFactory { gcsConfig: GcsConfig?, nameTransformer: StandardNameTransformer?, sqlOperations: SqlOperations? - ): StreamCopier? + ): StreamCopier } diff --git a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/S3StorageOperations.kt b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/S3StorageOperations.kt index c327ecb552cf..781830c8bc8e 100644 --- a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/S3StorageOperations.kt +++ b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/S3StorageOperations.kt @@ -144,7 +144,7 @@ open class S3StorageOperations( .stream() .filter { e: Exception -> e is AmazonS3Exception } .map { s3e: Exception -> (s3e as AmazonS3Exception).statusCode } - .filter { o: Int? -> + .filter { o: Int -> ConnectorExceptionUtil.HTTP_AUTHENTICATION_ERROR_CODES.contains( o, ) diff --git a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/jsonl/JsonLSerializedBuffer.kt b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/jsonl/JsonLSerializedBuffer.kt index 08fd34b90912..6091c6e5490b 100644 --- a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/jsonl/JsonLSerializedBuffer.kt +++ b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/s3/jsonl/JsonLSerializedBuffer.kt @@ -89,7 +89,7 @@ class JsonLSerializedBuffer( ): BufferCreateFunction { return BufferCreateFunction { _: AirbyteStreamNameNamespacePair?, - _: ConfiguredAirbyteCatalog? -> + _: ConfiguredAirbyteCatalog -> val compressionType = if (config == null) S3DestinationConstants.DEFAULT_COMPRESSION_TYPE else config.compressionType diff --git a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/staging/AsyncFlush.kt b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/staging/AsyncFlush.kt index 67db948614b7..cf1fc4264851 100644 --- a/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/staging/AsyncFlush.kt +++ b/airbyte-cdk/java/airbyte-cdk/s3-destinations/src/main/kotlin/io/airbyte/cdk/integrations/destination/staging/AsyncFlush.kt @@ -54,7 +54,7 @@ internal class AsyncFlush( ) // reassign as lambdas require references to be final. - stream.forEach { record: PartialAirbyteMessage? -> + stream.forEach { record: PartialAirbyteMessage -> try { // todo (cgardens) - most writers just go ahead and re-serialize the contents of // the record message. @@ -62,7 +62,7 @@ internal class AsyncFlush( // and create a default // impl that maintains backwards compatible behavior. writer.accept( - record!!.serialized!!, + record.serialized!!, Jsons.serialize(record.record!!.meta), record.record!!.emittedAt ) diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/CatalogParser.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/CatalogParser.kt index a515b912c945..b18d76f21857 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/CatalogParser.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/CatalogParser.kt @@ -78,8 +78,8 @@ constructor( actualStreamConfig.columns!! .keys .forEach( - Consumer { columnId: ColumnId? -> - addStringForDeinterpolation(columnId!!.name) + Consumer { columnId: ColumnId -> + addStringForDeinterpolation(columnId.name) addStringForDeinterpolation(columnId.originalName) } ) diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduper.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduper.kt index 9be5f95b12aa..387c88d54706 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduper.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduper.kt @@ -416,7 +416,7 @@ class DefaultTyperDeduper( } shouldRunTypingDeduping } - .forEach { streamConfig: StreamConfig? -> + .forEach { streamConfig: StreamConfig -> typeAndDedupeTasks.add(typeAndDedupeTask(streamConfig, true)) } CompletableFuture.allOf(*typeAndDedupeTasks.toTypedArray()).join() diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/Sql.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/Sql.kt index 7070dbc6adb6..4cf947a10071 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/Sql.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/main/kotlin/io/airbyte/integrations/base/destination/typing_deduping/Sql.kt @@ -37,7 +37,7 @@ data class Sql(val transactions: List>) { builder.append(begin) builder.append(";\n") transaction.forEach( - Consumer { statement: String? -> + Consumer { statement: String -> builder.append(statement) // No semicolon - statements already end with a semicolon builder.append("\n") @@ -54,7 +54,7 @@ data class Sql(val transactions: List>) { transactions.forEach( Consumer { transaction: List -> require(!transaction.isEmpty()) { "Transaction must not be empty" } - require(!transaction.stream().anyMatch { s: String? -> s == null || s.isEmpty() }) { + require(!transaction.stream().anyMatch { s: String -> s.isNullOrEmpty() }) { "Transaction must not contain empty statements" } } @@ -122,7 +122,7 @@ data class Sql(val transactions: List>) { .map { transaction: List -> transaction .stream() - .filter { statement: String? -> !statement.isNullOrEmpty() } + .filter { statement: String -> !statement.isNullOrEmpty() } .map internalMap@{ statement: String -> if (!statement.trim { it <= ' ' }.endsWith(";")) { return@internalMap "$statement;" diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduperTest.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduperTest.kt index cb458b65bcc9..1abed1099024 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduperTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/DefaultTyperDeduperTest.kt @@ -131,7 +131,7 @@ class DefaultTyperDeduperTest { Mockito.`when`(destinationHandler.gatherInitialState(ArgumentMatchers.anyList())) .thenReturn(initialStates) initialStates.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.initialRawTableStatus) .thenReturn(InitialRawTableStatus(true, true, Optional.empty())) } @@ -169,7 +169,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun emptyDestination() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.isFinalTablePresent).thenReturn(false) } ) @@ -219,7 +219,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun existingEmptyTable() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.isFinalTablePresent).thenReturn(true) Mockito.`when`(initialState.isFinalTableEmpty).thenReturn(true) Mockito.`when`(initialState.isSchemaMismatch).thenReturn(true) @@ -296,7 +296,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun existingEmptyTableMatchingSchema() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.isFinalTablePresent).thenReturn(true) Mockito.`when`(initialState.isFinalTableEmpty).thenReturn(true) Mockito.`when`(initialState.isSchemaMismatch).thenReturn(false) @@ -327,7 +327,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun existingNonemptyTable() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.isFinalTablePresent).thenReturn(true) Mockito.`when`(initialState.isFinalTableEmpty).thenReturn(false) Mockito.`when`(initialState.isSchemaMismatch).thenReturn(true) @@ -426,7 +426,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun existingNonemptyTableMatchingSchema() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.isFinalTablePresent).thenReturn(true) Mockito.`when`(initialState.isFinalTableEmpty).thenReturn(false) Mockito.`when`(initialState.isSchemaMismatch).thenReturn(false) @@ -487,7 +487,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun noUnprocessedRecords() { initialStates.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.initialRawTableStatus) .thenReturn(InitialRawTableStatus(true, false, Optional.empty())) } @@ -526,7 +526,7 @@ class DefaultTyperDeduperTest { @Throws(Exception::class) fun unprocessedRecords() { initialStates!!.forEach( - Consumer { initialState: DestinationInitialStatus? -> + Consumer { initialState: DestinationInitialStatus -> Mockito.`when`(initialState!!.initialRawTableStatus) .thenReturn( InitialRawTableStatus( diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/MockSqlGenerator.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/MockSqlGenerator.kt index ac25371b61a8..3f5a95b7536c 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/MockSqlGenerator.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/test/kotlin/io/airbyte/integrations/base/destination/typing_deduping/MockSqlGenerator.kt @@ -38,7 +38,7 @@ internal class MockSqlGenerator : SqlGenerator { ): Sql { val timestampFilter = minRawTimestamp - .map(Function { timestamp: Instant? -> " WHERE extracted_at > $timestamp" }) + .map(Function { timestamp: Instant -> " WHERE extracted_at > $timestamp" }) .orElse("") val casting = if (useExpensiveSaferCasting) " WITH" else " WITHOUT" + " SAFER CASTING" return of( diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/BaseTypingDedupingTest.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/BaseTypingDedupingTest.kt index 531c4c7335f6..34e1ae88695d 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/BaseTypingDedupingTest.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/BaseTypingDedupingTest.kt @@ -1092,7 +1092,7 @@ abstract class BaseTypingDedupingTest { .map { obj: String -> obj.trim { it <= ' ' } } .filter { line: String -> !line.isEmpty() } .filter { line: String -> !line.startsWith("//") } - .map { jsonString: String? -> Jsons.deserializeExact(jsonString) } + .map { jsonString: String -> Jsons.deserializeExact(jsonString) } .toList() } @@ -1104,7 +1104,7 @@ abstract class BaseTypingDedupingTest { ): List { return readRecords(filename) .stream() - .map { record: JsonNode? -> Jsons.convertValue(record, AirbyteMessage::class.java) } + .map { record: JsonNode -> Jsons.convertValue(record, AirbyteMessage::class.java) } .peek { message: AirbyteMessage -> message.record.namespace = streamNamespace message.record.stream = streamName diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt index 9094e5ccc884..b0e71ee78be9 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt @@ -366,7 +366,7 @@ constructor( expectedValue.size() == actualValue.size() && Stream.generate { expectedValue.fieldNames().next() } .limit(expectedValue.size().toLong()) - .allMatch { field: String? -> + .allMatch { field: String -> areJsonNodesEquivalent(expectedValue[field], actualValue[field]) } } else {