diff --git a/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRestClientIntegrationTest.kt b/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRestClientIntegrationTest.kt index 7555544..74ec79c 100644 --- a/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRestClientIntegrationTest.kt +++ b/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRestClientIntegrationTest.kt @@ -1,83 +1,85 @@ -// /* -// * 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) -// } -// } +/* +* 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.jupiter.api.AfterEach +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Disabled +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() { + } + + @Disabled + @Test + fun testSchemaGet() = runBlocking { + val actualSchemaMetadata = retriever.schemaGet("/schemas/ids/100042") + println(actualSchemaMetadata) + } + + @Disabled + @Test + fun testSchemaPost() = runBlocking { + val postResult = retriever.schemaPost("subjects/d90c8b88-5793-438a-b27d-6c87580cc3d9", Schema.create(Schema.Type.STRING)) + println(postResult) + } + + @Disabled + @Test + fun testRetrieveSchemaById() = runBlocking { + val res = retriever.retrieveSchemaById(100086) + println(res) + } +} diff --git a/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRetrieverIntegrationTest.kt b/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRetrieverIntegrationTest.kt index 91ff643..a0c5381 100644 --- a/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRetrieverIntegrationTest.kt +++ b/radar-commons/src/test/java/org/radarbase/producer/schema/SchemaRetrieverIntegrationTest.kt @@ -1,86 +1,88 @@ -// /* -// * 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) -// } -// } +/* +* 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.Disabled +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() { + } + + @Disabled + @Test + fun testGetById() = runBlocking { + val topic = "android_phone_acceleration" + val id = 100042 + val ofValue = true + val res = retriever.getById(topic, ofValue, id) + println(res) + } +}