diff --git a/app/src/main/kotlin/org/eclipse/kuksa/testapp/extension/UriExtension.kt b/app/src/main/kotlin/org/eclipse/kuksa/testapp/extension/UriExtension.kt index bf70afd2..f38b0ef4 100644 --- a/app/src/main/kotlin/org/eclipse/kuksa/testapp/extension/UriExtension.kt +++ b/app/src/main/kotlin/org/eclipse/kuksa/testapp/extension/UriExtension.kt @@ -22,10 +22,6 @@ package org.eclipse.kuksa.testapp.extension import android.content.Context import android.net.Uri import android.provider.OpenableColumns -import android.content.res.AssetManager -import org.eclipse.kuksa.testapp.databroker.model.Certificate -import java.io.IOException -import java.io.InputStream fun Uri.fetchFileName(context: Context): String? { var fileName: String? = null diff --git a/app/src/test/kotlin/org/eclipse/kuksa/testapp/model/ConnectionInfoTest.kt b/app/src/test/kotlin/org/eclipse/kuksa/testapp/model/ConnectionInfoTest.kt index c1487746..494b037f 100644 --- a/app/src/test/kotlin/org/eclipse/kuksa/testapp/model/ConnectionInfoTest.kt +++ b/app/src/test/kotlin/org/eclipse/kuksa/testapp/model/ConnectionInfoTest.kt @@ -24,6 +24,9 @@ import io.kotest.matchers.shouldBe import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.eclipse.kuksa.test.kotest.Unit +import org.eclipse.kuksa.testapp.databroker.model.Certificate +import org.eclipse.kuksa.testapp.databroker.model.ConnectionInfo +import org.eclipse.kuksa.testapp.databroker.model.ConnectionInfoSerializer import java.io.File import java.io.FileWriter diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectionTest.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectionTest.kt index 098cb380..248e401a 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectionTest.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectionTest.kt @@ -28,13 +28,11 @@ import io.mockk.slot import io.mockk.verify import kotlinx.coroutines.runBlocking import org.eclipse.kuksa.databroker.DataBrokerConnectorProvider -import org.eclipse.kuksa.kotest.Integration import org.eclipse.kuksa.model.Property import org.eclipse.kuksa.proto.v1.Types import org.eclipse.kuksa.proto.v1.Types.Datapoint -import org.eclipse.kuksa.vssSpecification.VssDriver -import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider import org.eclipse.kuksa.test.kotest.Integration +import org.eclipse.kuksa.vssSpecification.VssDriver import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorSecureTest.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorSecureTest.kt index 3ca0e14e..7fdb566b 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorSecureTest.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorSecureTest.kt @@ -20,7 +20,7 @@ package org.eclipse.kuksa import io.kotest.core.spec.style.BehaviorSpec -import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider +import org.eclipse.kuksa.databroker.DataBrokerConnectorProvider import org.eclipse.kuksa.test.kotest.Integration import org.eclipse.kuksa.test.kotest.Secure import org.junit.jupiter.api.Assertions diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorTest.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorTest.kt index e1d9b10f..c09edafe 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorTest.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/DataBrokerConnectorTest.kt @@ -21,10 +21,10 @@ package org.eclipse.kuksa import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.BehaviorSpec -import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider +import io.kotest.matchers.shouldNotBe +import org.eclipse.kuksa.databroker.DataBrokerConnectorProvider import org.eclipse.kuksa.test.kotest.Insecure import org.eclipse.kuksa.test.kotest.Integration -import org.junit.jupiter.api.Assertions class DataBrokerConnectorTest : BehaviorSpec({ tags(Integration, Insecure) diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt index 66f9c21f..255e3d81 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt @@ -17,11 +17,7 @@ * */ -<<<<<<<< HEAD:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt package org.eclipse.kuksa.databroker -======== -package org.eclipse.kuksa.test.databroker ->>>>>>>> Eclipse/main:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConfig.kt import java.util.concurrent.TimeUnit diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt index 72e45c89..182c0e6a 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt @@ -19,11 +19,7 @@ * */ -<<<<<<<< HEAD:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt package org.eclipse.kuksa.databroker -======== -package org.eclipse.kuksa.test.databroker ->>>>>>>> Eclipse/main:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConnectorProvider.kt import io.grpc.ChannelCredentials import io.grpc.Grpc diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConfig.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConfig.kt deleted file mode 100644 index 66f9c21f..00000000 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConfig.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * - */ - -<<<<<<<< HEAD:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConfig.kt -package org.eclipse.kuksa.databroker -======== -package org.eclipse.kuksa.test.databroker ->>>>>>>> Eclipse/main:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConfig.kt - -import java.util.concurrent.TimeUnit - -object DataBrokerConfig { - const val HOST = "127.0.0.1" - const val PORT = 55556 - - // low timeout should be okay, since we are testing against a local service - const val TIMEOUT_SECONDS = 3L - val TIMEOUT_UNIT = TimeUnit.SECONDS -} diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConnectorProvider.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConnectorProvider.kt deleted file mode 100644 index 72e45c89..00000000 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConnectorProvider.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * * Copyright (c) 2023 Contributors to the Eclipse Foundation - * * - * * 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. - * * - * * SPDX-License-Identifier: Apache-2.0 - * * - * - */ - -<<<<<<<< HEAD:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/databroker/DataBrokerConnectorProvider.kt -package org.eclipse.kuksa.databroker -======== -package org.eclipse.kuksa.test.databroker ->>>>>>>> Eclipse/main:kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/test/databroker/DataBrokerConnectorProvider.kt - -import io.grpc.ChannelCredentials -import io.grpc.Grpc -import io.grpc.ManagedChannelBuilder -import io.grpc.TlsChannelCredentials -import org.eclipse.kuksa.DataBrokerConnector -import org.eclipse.kuksa.TimeoutConfig -import java.io.IOException -import java.io.InputStream - -class DataBrokerConnectorProvider { - fun createInsecure( - host: String = DataBrokerConfig.HOST, - port: Int = DataBrokerConfig.PORT, - ): DataBrokerConnector { - val managedChannel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build() - - return DataBrokerConnector(managedChannel).apply { - timeoutConfig = TimeoutConfig(DataBrokerConfig.TIMEOUT_SECONDS, DataBrokerConfig.TIMEOUT_UNIT) - } - } - - fun createSecure( - host: String = DataBrokerConfig.HOST, - port: Int = DataBrokerConfig.PORT, - rootCertFileStream: InputStream, - overrideAuthority: String = "", - ): DataBrokerConnector { - val tlsCredentials: ChannelCredentials - try { - tlsCredentials = TlsChannelCredentials.newBuilder() - .trustManager(rootCertFileStream) - .build() - } catch (_: IOException) { - // Handle error - throw IOException("Could not create TLS credentials") - } - - val channelBuilder = Grpc - .newChannelBuilderForAddress(host, port, tlsCredentials) - - val hasOverrideAuthority = overrideAuthority.isNotEmpty() - if (hasOverrideAuthority) { - channelBuilder.overrideAuthority(overrideAuthority) - } - - val managedChannel = channelBuilder.build() - return DataBrokerConnector(managedChannel).apply { - timeoutConfig = TimeoutConfig(DataBrokerConfig.TIMEOUT_SECONDS, DataBrokerConfig.TIMEOUT_UNIT) - } - } -} diff --git a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/vssSpecification/VssSpecificationCopyTest.kt b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/vssSpecification/VssSpecificationCopyTest.kt index be2a4d80..91ed1bc6 100644 --- a/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/vssSpecification/VssSpecificationCopyTest.kt +++ b/kuksa-sdk/src/test/kotlin/org/eclipse/kuksa/vssSpecification/VssSpecificationCopyTest.kt @@ -25,9 +25,9 @@ import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldStartWith import org.eclipse.kuksa.extension.copy import org.eclipse.kuksa.extension.deepCopy -import org.eclipse.kuksa.kotest.Unit import org.eclipse.kuksa.proto.v1.Types import org.eclipse.kuksa.proto.v1.Types.BoolArray +import org.eclipse.kuksa.test.kotest.Unit class VssSpecificationCopyTest : BehaviorSpec({ tags(Unit)