Skip to content

Commit

Permalink
destination-e2e: convert production code to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-airbyte committed Sep 18, 2024
1 parent 8f95359 commit 283ec05
Show file tree
Hide file tree
Showing 29 changed files with 590 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: file
connectorType: destination
definitionId: a7bcc9d8-13b3-4e49-b80d-d020b90045e3
dockerImageTag: 0.3.3
dockerImageTag: 0.4.0
dockerRepository: airbyte/destination-dev-null
githubIssueLabel: destination-dev-null
icon: airbyte.svg
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination.dev_null

import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
import io.airbyte.cdk.integrations.base.Destination
import io.airbyte.cdk.integrations.base.IntegrationRunner
import io.airbyte.cdk.integrations.base.spec_modification.SpecModifyingDestination
import io.airbyte.commons.json.Jsons
import io.airbyte.integrations.destination.e2e_test.TestingDestinations
import io.airbyte.protocol.models.v0.ConnectorSpecification
import org.slf4j.Logger
import org.slf4j.LoggerFactory

class DevNullDestination : SpecModifyingDestination(TestingDestinations()), Destination {
/** 1. Update the title. 2. Only keep the "silent" mode. */
override fun modifySpec(originalSpec: ConnectorSpecification): ConnectorSpecification {
val spec = Jsons.clone(originalSpec)

(spec.connectionSpecification as ObjectNode).put("title", DEV_NULL_DESTINATION_TITLE)

val properties =
spec.connectionSpecification["properties"]["test_destination"] as ObjectNode
val types = properties["oneOf"] as ArrayNode
val typesIterator = types.elements()
while (typesIterator.hasNext()) {
val typeNode = typesIterator.next()
if (
!typeNode["properties"]["test_destination_type"]["const"]
.asText()
.equals("silent", ignoreCase = true)
) {
typesIterator.remove()
}
}
return spec
}

companion object {
private val LOGGER: Logger = LoggerFactory.getLogger(DevNullDestination::class.java)
private const val DEV_NULL_DESTINATION_TITLE = "E2E Test (/dev/null) Destination Spec"

@Throws(Exception::class)
@JvmStatic
fun main(args: Array<String>) {
LOGGER.info("Starting destination: {}", DevNullDestination::class.java)
IntegrationRunner(DevNullDestination()).run(args)
LOGGER.info("Completed destination: {}", DevNullDestination::class.java)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: unknown
connectorType: destination
definitionId: 2eb65e87-983a-4fd7-b3e3-9d9dc6eb8537
dockerImageTag: 0.3.6
dockerImageTag: 0.4.0
dockerRepository: airbyte/destination-e2e-test
githubIssueLabel: destination-e2e-test
icon: airbyte.svg
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 283ec05

Please sign in to comment.