-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
destination-dev-null: convert production code to kotlin (#45648)
## What <!-- * Describe what the change is solving. Link all GitHub issues related to this change. --> ## How <!-- * Describe how code changes achieve the solution. --> ## Review guide <!-- 1. `x.py` 2. `y.py` --> ## User Impact <!-- * What is the end result perceived by the user? * If there are negative side effects, please list them. --> ## Can this PR be safely reverted and rolled back? <!-- * If unsure, leave it blank. --> - [ ] YES 💚 - [ ] NO ❌
- Loading branch information
1 parent
e8f2f5a
commit 2e61b5a
Showing
29 changed files
with
590 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
...v-null/src/main/java/io/airbyte/integrations/destination/dev_null/DevNullDestination.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
...v-null/src/main/kotlin/io/airbyte/integrations/destination/dev_null/DevNullDestination.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 0 additions & 71 deletions
71
...est/src/main/java/io/airbyte/integrations/destination/e2e_test/FailAfterNDestination.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
...e-test/src/main/java/io/airbyte/integrations/destination/e2e_test/LoggingDestination.java
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
...2e-test/src/main/java/io/airbyte/integrations/destination/e2e_test/SilentDestination.java
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
...-test/src/main/java/io/airbyte/integrations/destination/e2e_test/TestingDestinations.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.