aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-core/src/test
diff options
context:
space:
mode:
authorkjaniak <kornel.janiak@nokia.com>2019-04-03 15:48:28 +0200
committerFilip Krzywka <filip.krzywka@nokia.com>2019-04-12 09:56:50 +0200
commit49f43c856c8ca793bc6972d9d4b47c2d0d4c0816 (patch)
tree1e2c7d124898e053d5a3d42f9dcb329d24050d0e /sources/hv-collector-core/src/test
parent8b8385d323754903ade492a659548d54b56bd7ad (diff)
Creation of server module
Issue-ID: DCAEGEN2-1390 Change-Id: I07410b16ed6566b933d5f1efa35bddb965225794 Signed-off-by: kjaniak <kornel.janiak@nokia.com> Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'sources/hv-collector-core/src/test')
-rw-r--r--sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt2
-rw-r--r--sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireChunkDecoderTest.kt2
-rw-r--r--sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ClientContextTest.kt98
-rw-r--r--sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ServiceContextTest.kt67
4 files changed, 2 insertions, 167 deletions
diff --git a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt
index 6b9c6803..533581d5 100644
--- a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt
+++ b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt
@@ -36,7 +36,7 @@ import org.onap.dcae.collectors.veshv.domain.RoutedMessage
import org.onap.dcae.collectors.veshv.domain.VesEventDomain.PERF3GPP
import org.onap.dcae.collectors.veshv.domain.VesEventDomain.HEARTBEAT
import org.onap.dcae.collectors.veshv.domain.VesEventDomain.SYSLOG
-import org.onap.dcae.collectors.veshv.model.ClientContext
+import org.onap.dcae.collectors.veshv.domain.logging.ClientContext
import org.onap.dcae.collectors.veshv.domain.VesMessage
import org.onap.dcae.collectors.veshv.model.SuccessfullyConsumedMessage
import org.onap.dcae.collectors.veshv.tests.utils.commonHeader
diff --git a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireChunkDecoderTest.kt b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireChunkDecoderTest.kt
index e0092cf9..10dea82d 100644
--- a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireChunkDecoderTest.kt
+++ b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireChunkDecoderTest.kt
@@ -30,7 +30,7 @@ import org.jetbrains.spek.api.dsl.it
import org.onap.dcae.collectors.veshv.domain.WireFrameEncoder
import org.onap.dcae.collectors.veshv.domain.WireFrameDecoder
import org.onap.dcae.collectors.veshv.domain.WireFrameMessage
-import org.onap.dcae.collectors.veshv.model.ClientContext
+import org.onap.dcae.collectors.veshv.domain.logging.ClientContext
import reactor.test.test
/**
diff --git a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ClientContextTest.kt b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ClientContextTest.kt
deleted file mode 100644
index a49428a7..00000000
--- a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ClientContextTest.kt
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018 NOKIA
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-package org.onap.dcae.collectors.veshv.model
-
-import arrow.core.Some
-import com.nhaarman.mockitokotlin2.mock
-import com.nhaarman.mockitokotlin2.whenever
-import org.assertj.core.api.Assertions.assertThat
-import org.jetbrains.spek.api.Spek
-import org.jetbrains.spek.api.dsl.describe
-import org.jetbrains.spek.api.dsl.given
-import org.jetbrains.spek.api.dsl.it
-import org.jetbrains.spek.api.dsl.on
-import org.onap.dcae.collectors.veshv.utils.logging.OnapMdc
-import java.net.Inet4Address
-import java.net.InetAddress
-import java.net.InetSocketAddress
-import java.security.cert.X509Certificate
-import java.util.*
-import javax.security.auth.x500.X500Principal
-
-/**
- * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
- * @since December 2018
- */
-internal object ClientContextTest : Spek({
- describe("ClientContext") {
- given("default instance") {
- val cut = ClientContext()
-
- on("mapped diagnostic context") {
- val mdc = cut.mdc
-
- it("should contain ${OnapMdc.REQUEST_ID}") {
- assertThat(mdc[OnapMdc.REQUEST_ID]).isEqualTo(cut.requestId)
- }
-
- it("should contain ${OnapMdc.INVOCATION_ID}") {
- assertThat(mdc[OnapMdc.INVOCATION_ID]).isEqualTo(cut.invocationId)
- }
-
- it("should contain ${OnapMdc.STATUS_CODE}") {
- assertThat(mdc[OnapMdc.STATUS_CODE]).isEqualTo("INPROGRESS")
- }
-
- it("should contain ${OnapMdc.CLIENT_NAME}") {
- assertThat(mdc[OnapMdc.CLIENT_NAME]).isBlank()
- }
-
- it("should contain ${OnapMdc.CLIENT_IP}") {
- assertThat(mdc[OnapMdc.CLIENT_IP]).isBlank()
- }
- }
- }
-
- given("instance with client data") {
- val clientDn = "C=PL, O=Nokia, CN=NokiaBTS"
- val clientIp = "192.168.52.34"
- val cert: X509Certificate = mock()
- val principal: X500Principal = mock()
- val cut = ClientContext(
- clientAddress = Some(InetAddress.getByName(clientIp)),
- clientCert = Some(cert))
-
- whenever(cert.subjectX500Principal).thenReturn(principal)
- whenever(principal.toString()).thenReturn(clientDn)
-
- on("mapped diagnostic context") {
- val mdc = cut.mdc
-
- it("should contain ${OnapMdc.CLIENT_NAME}") {
- assertThat(mdc[OnapMdc.CLIENT_NAME]).isEqualTo(clientDn)
- }
-
- it("should contain ${OnapMdc.CLIENT_IP}") {
- assertThat(mdc[OnapMdc.CLIENT_IP]).isEqualTo(clientIp)
- }
- }
- }
- }
-})
diff --git a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ServiceContextTest.kt b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ServiceContextTest.kt
deleted file mode 100644
index 5b6e4526..00000000
--- a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/model/ServiceContextTest.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018 NOKIA
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-package org.onap.dcae.collectors.veshv.model
-
-import org.assertj.core.api.Assertions.assertThat
-import org.jetbrains.spek.api.Spek
-import org.jetbrains.spek.api.dsl.describe
-import org.jetbrains.spek.api.dsl.given
-import org.jetbrains.spek.api.dsl.it
-import org.jetbrains.spek.api.dsl.on
-import org.onap.dcae.collectors.veshv.utils.logging.OnapMdc
-import java.util.*
-
-/**
- * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
- * @since December 2018
- */
-internal object ServiceContextTest : Spek({
- describe("ServiceContext") {
- given("singleton instance") {
- val cut = ServiceContext
-
- on("instanceId") {
- val instanceId = cut.instanceId
- it("should be valid UUID") {
- UUID.fromString(instanceId) // should not throw
- }
- }
-
- on("serverFqdn") {
- val serverFqdn = cut.serverFqdn
- it("should be non empty") {
- assertThat(serverFqdn).isNotBlank()
- }
- }
-
- on("mapped diagnostic context") {
- val mdc = cut.mdc
-
- it("should contain ${OnapMdc.INSTANCE_ID}") {
- assertThat(mdc[OnapMdc.INSTANCE_ID]).isEqualTo(cut.instanceId)
- }
-
- it("should contain ${OnapMdc.SERVER_FQDN}") {
- assertThat(mdc[OnapMdc.SERVER_FQDN]).isEqualTo(cut.serverFqdn)
- }
- }
- }
- }
-})