Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import io.airbyte.cdk.load.message.ProtocolMessageDeserializer
import io.micronaut.context.annotation.Factory
import io.micronaut.context.annotation.Requires
import io.micronaut.context.annotation.Value
import io.micronaut.context.env.Environment
import jakarta.inject.Named
import jakarta.inject.Singleton
import java.io.InputStream
import kotlinx.coroutines.flow.Flow

/**
Expand All @@ -56,21 +58,23 @@ class InputBeanFactory {
}

@Requires(property = "airbyte.destination.core.data-channel.medium", value = "SOCKET")
@Requires(notEnv = [Environment.TEST])
@Named("inputStreams")
@Singleton
fun socketStreams(
sockets: List<ClientSocket>,
) = ConnectorInputStreams(sockets.map(ClientSocket::openInputStream))
): List<InputStream> = sockets.map(ClientSocket::openInputStream)

@Requires(property = "airbyte.destination.core.data-channel.medium", value = "STDIO")
@Requires(notEnv = [Environment.TEST])
@Named("inputStreams")
@Singleton
fun stdInStreams() = ConnectorInputStreams(listOf(System.`in`))
fun stdInStreams(): List<InputStream> = listOf(System.`in`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need ConnectorInputStreams to avoid issues with micronaut injection


@Named("messageFlows")
@Singleton
fun messageFlows(
@Named("inputStreams") inputStreams: ConnectorInputStreams,
@Named("inputStreams") inputStreams: List<InputStream>,
@Value("\${airbyte.destination.core.data-channel.format}")
dataChannelFormat: DataChannelFormat,
deserializer: ProtocolMessageDeserializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

package io.airbyte.cdk.load.test.config

import io.airbyte.cdk.load.dataflow.config.ConnectorInputStreams
import io.airbyte.cdk.load.dataflow.config.MemoryAndParallelismConfig
import io.micronaut.context.annotation.Factory
import io.micronaut.context.annotation.Primary
import io.micronaut.context.annotation.Requires
import io.micronaut.context.env.Environment
import jakarta.inject.Named
import jakarta.inject.Singleton
import java.io.InputStream
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.toJavaDuration

Expand All @@ -24,16 +22,6 @@ import kotlin.time.toJavaDuration
@Factory
@Requires(env = [Environment.TEST])
class TestBeanOverrideFactory {
// non-dockerized std-in acceptance tests create an input stream bean at runtime it uses
// to send messages to the destination, so we must wire that up here
@Requires(notEnv = ["docker"])
@Requires(property = "airbyte.destination.core.data-channel.medium", value = "STDIO")
@Singleton
@Primary
@Named("inputStreams")
fun testStdInStreams(
@Named("inputStream") testInputStream: InputStream,
) = ConnectorInputStreams(listOf(testInputStream))

@Singleton
@Primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class InputBeanFactoryTest {
// Given
val inputStream1 = ByteArrayInputStream("stream1".toByteArray())
val inputStream2 = ByteArrayInputStream("stream2".toByteArray())
val inputStreams = ConnectorInputStreams(listOf(inputStream1, inputStream2))
val inputStreams = listOf(inputStream1, inputStream2)

// When
val result =
Expand Down Expand Up @@ -295,7 +295,7 @@ class InputBeanFactoryTest {

every { aggregateStoreFactory.make() } returns mockk()

val inputStreams = ConnectorInputStreams(listOf(mockInputStream1, mockInputStream2))
val inputStreams = listOf(mockInputStream1, mockInputStream2)

val messageFlows =
factory.messageFlows(
Expand Down
Loading