-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move httpclient configuration into the config class and add (ignored)…
… tests
- Loading branch information
1 parent
7e31758
commit bef688c
Showing
6 changed files
with
195 additions
and
28 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
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
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
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
83 changes: 83 additions & 0 deletions
83
radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRestClientIntegrationTest.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,83 @@ | ||
// /* | ||
// * Copyright 2017 The Hyve and King's College London | ||
// * | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// */ | ||
// package org.radarbase.producer.schema | ||
// | ||
// import io.ktor.client.* | ||
// import io.ktor.client.engine.cio.* | ||
// import io.ktor.client.plugins.auth.* | ||
// import io.ktor.client.plugins.auth.providers.* | ||
// import io.ktor.client.request.* | ||
// import io.ktor.client.statement.* | ||
// import io.ktor.http.* | ||
// import kotlinx.coroutines.runBlocking | ||
// import org.apache.avro.Schema | ||
// import org.junit.Ignore | ||
// import org.junit.jupiter.api.AfterEach | ||
// import org.junit.jupiter.api.BeforeEach | ||
// import org.junit.jupiter.api.Test | ||
// import org.radarbase.producer.io.timeout | ||
// import java.io.IOException | ||
// import kotlin.time.Duration.Companion.seconds | ||
// | ||
// class SchemaRestClientIntegrationTest { | ||
// private lateinit var retriever: SchemaRestClient | ||
// | ||
// // This testclass requires a functioning confluent cloud provider, therefore all tests here are ignored | ||
// | ||
// @BeforeEach | ||
// fun setUp() { | ||
// val apiSecret = "exampleSecret" | ||
// val apiKey = "exampleKey" | ||
// retriever = SchemaRestClient( | ||
// httpClient = HttpClient { | ||
// timeout(30.seconds) | ||
// install(Auth) { | ||
// basic { | ||
// sendWithoutRequest { true } | ||
// credentials { | ||
// BasicAuthCredentials(username = apiKey, password = apiSecret) | ||
// } | ||
// } | ||
// } | ||
// }, | ||
// baseUrl = "https://SOME_EXAMPLE.westeurope.azure.confluent.cloud", | ||
// ) | ||
// } | ||
// | ||
// @AfterEach | ||
// @Throws(IOException::class) | ||
// fun tearDown() { | ||
// } | ||
// | ||
// @Test | ||
// fun testSchemaGet() = runBlocking { | ||
// val actualSchemaMetadata = retriever.schemaGet("/schemas/ids/100042") | ||
// println(actualSchemaMetadata) | ||
// } | ||
// | ||
// @Test | ||
// fun testSchemaPost() = runBlocking { | ||
// val postResult = retriever.schemaPost("subjects/d90c8b88-5793-438a-b27d-6c87580cc3d9", Schema.create(Schema.Type.STRING)) | ||
// | ||
// println(postResult) | ||
// } | ||
// | ||
// @Test | ||
// fun testRetrieveSchemaById() = runBlocking { | ||
// val res = retriever.retrieveSchemaById(100086) | ||
// println(res) | ||
// } | ||
// } |
86 changes: 86 additions & 0 deletions
86
radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRetrieverIntegrationTest.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,86 @@ | ||
// /* | ||
// * Copyright 2017 The Hyve and King's College London | ||
// * | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// */ | ||
// package org.radarbase.producer.schema | ||
// | ||
// import io.ktor.client.* | ||
// import io.ktor.client.engine.cio.* | ||
// import io.ktor.client.plugins.auth.* | ||
// import io.ktor.client.plugins.auth.providers.* | ||
// import io.ktor.client.request.* | ||
// import io.ktor.client.statement.* | ||
// import io.ktor.http.* | ||
// import kotlinx.coroutines.runBlocking | ||
// import org.junit.Ignore | ||
// import org.junit.jupiter.api.AfterEach | ||
// import org.junit.jupiter.api.BeforeEach | ||
// import org.junit.jupiter.api.Test | ||
// import org.radarbase.producer.io.timeout | ||
// import java.io.IOException | ||
// import kotlin.time.Duration.Companion.seconds | ||
// | ||
// class SchemaRetrieverIntegrationTest { | ||
// private lateinit var retriever: SchemaRetriever | ||
// | ||
// // This testclass requires a functioning confluent cloud provider, therefore all tests here are ignored | ||
// | ||
// @BeforeEach | ||
// fun setUp() { | ||
// val apiSecret = "exampleSecret" | ||
// val apiKey = "exampleKey" | ||
// retriever = SchemaRetriever.schemaRetriever(baseUrl = "https://SOME_EXAMPLE.westeurope.azure.confluent.cloud") { | ||
// httpClient = HttpClient(CIO) { | ||
// timeout(30.seconds) | ||
// install(Auth) { | ||
// basic { | ||
// sendWithoutRequest { true } | ||
// credentials { | ||
// BasicAuthCredentials(username = apiKey, password = apiSecret) | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
// | ||
// val restClient = SchemaRestClient( | ||
// httpClient = HttpClient { | ||
// timeout(30.seconds) | ||
// install(Auth) { | ||
// basic { | ||
// sendWithoutRequest { true } | ||
// credentials { | ||
// BasicAuthCredentials(username = apiKey, password = apiSecret) | ||
// } | ||
// } | ||
// } | ||
// }, | ||
// baseUrl = "https://SOME_EXAMPLE.westeurope.azure.confluent.cloud", | ||
// ) | ||
// } | ||
// | ||
// @AfterEach | ||
// @Throws(IOException::class) | ||
// fun tearDown() { | ||
// } | ||
// | ||
// @Test | ||
// fun testGetById() = runBlocking { | ||
// val topic = "android_phone_acceleration" | ||
// val id = 100042 | ||
// val ofValue = true | ||
// val res = retriever.getById(topic, ofValue, id) | ||
// println(res) | ||
// } | ||
// } |