Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destination-dev-null: convert production code to kotlin #45648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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
Loading