aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2019-04-10 15:02:01 +0200
committerJakub Dudycz <jakub.dudycz@nokia.com>2019-04-12 11:18:52 +0200
commitbe68ea73313277ae749cdc47f15e9993d1c5a6ce (patch)
tree14925ead80cc8cbc2481f0af8646f6b8cfac9305
parent49f43c856c8ca793bc6972d9d4b47c2d0d4c0816 (diff)
Move cmd ssl logic to xnf-simulator
Change-Id: I562acbb0b7522e6cefea2a2dc1a9e292c1227b41 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-565
-rw-r--r--sources/hv-collector-ssl/pom.xml12
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt1
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt (renamed from sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt)7
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt1
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/OngoingSimulationsTest.kt (renamed from sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt)7
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulatorTest.kt (renamed from sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/XnfSimulatorTest.kt)3
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClientTest.kt (renamed from sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/HvVesClientTest.kt)2
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtilsTest.kt (renamed from sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt)16
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/ca.crt (renamed from sources/hv-collector-ssl/src/test/resources/ssl/ca.crt)0
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/password (renamed from sources/hv-collector-ssl/src/test/resources/ssl/password)0
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.crt (renamed from sources/hv-collector-ssl/src/test/resources/ssl/server.crt)0
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.key (renamed from sources/hv-collector-ssl/src/test/resources/ssl/server.key)0
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.ks.pkcs12 (renamed from sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12)bin2389 -> 2389 bytes
-rw-r--r--sources/hv-collector-xnf-simulator/src/test/resources/ssl/trust.pkcs12 (renamed from sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12)bin1096 -> 1096 bytes
14 files changed, 14 insertions, 35 deletions
diff --git a/sources/hv-collector-ssl/pom.xml b/sources/hv-collector-ssl/pom.xml
index 0ba609e5..2aaf2295 100644
--- a/sources/hv-collector-ssl/pom.xml
+++ b/sources/hv-collector-ssl/pom.xml
@@ -56,16 +56,6 @@
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
- <artifactId>hv-collector-commandline</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>hv-collector-domain</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
<artifactId>hv-collector-test-utils</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
@@ -94,6 +84,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
-
</project>
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
index 7fa23f7f..d9cbbaa8 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
@@ -36,7 +36,6 @@ import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.VES_HV_PORT
import org.onap.dcae.collectors.veshv.commandline.intValue
import org.onap.dcae.collectors.veshv.commandline.stringValue
import org.onap.dcae.collectors.veshv.domain.WireFrameMessage
-import org.onap.dcae.collectors.veshv.ssl.boundary.createSecurityConfigurationProvider
import org.onap.dcae.collectors.veshv.utils.arrow.OptionUtils.binding
import org.onap.dcae.collectors.veshv.utils.arrow.doOnFailure
import org.onap.dcae.collectors.veshv.utils.logging.Logger
diff --git a/sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt
index 5981d9d4..7678fdbb 100644
--- a/sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.collectors.veshv.ssl.boundary
+package org.onap.dcae.collectors.veshv.simulators.xnf.impl.config
+
import arrow.core.None
import arrow.core.Some
@@ -26,6 +27,7 @@ import org.apache.commons.cli.CommandLine
import org.onap.dcae.collectors.veshv.commandline.CommandLineOption
import org.onap.dcae.collectors.veshv.commandline.hasOption
import org.onap.dcae.collectors.veshv.commandline.stringValue
+import org.onap.dcae.collectors.veshv.ssl.boundary.SecurityConfiguration
import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeys
import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeysStore
import org.onap.dcaegen2.services.sdk.security.ssl.Passwords
@@ -41,9 +43,6 @@ const val KEY_STORE_PASSWORD_FILE = "/etc/ves-hv/server.pass"
const val TRUST_STORE_FILE = "/etc/ves-hv/trust.p12"
const val TRUST_STORE_PASSWORD_FILE = "/etc/ves-hv/trust.pass"
-fun createSecurityConfiguration(cmdLine: CommandLine): Try<SecurityConfiguration> =
- createSecurityConfigurationProvider(cmdLine).map { it() }
-
fun createSecurityConfigurationProvider(cmdLine: CommandLine): Try<() -> SecurityConfiguration> =
if (shouldDisableSsl(cmdLine))
Try { { disabledSecurityConfiguration() } }
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
index 4fcb1809..04a0c14a 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
@@ -20,7 +20,6 @@
package org.onap.dcae.collectors.veshv.simulators.xnf
import io.vavr.collection.HashSet
-import org.onap.dcae.collectors.veshv.commandline.handleWrongArgumentError
import org.onap.dcae.collectors.veshv.commandline.handleWrongArgumentErrorCurried
import org.onap.dcae.collectors.veshv.healthcheck.api.HealthDescription
import org.onap.dcae.collectors.veshv.healthcheck.api.HealthState
diff --git a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/OngoingSimulationsTest.kt
index 325d3bb5..cb604626 100644
--- a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt
+++ b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/OngoingSimulationsTest.kt
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.collectors.veshv.main
+package org.onap.dcae.collectors.veshv.simulators.xnf.impl
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.Spek
@@ -25,11 +25,6 @@ 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.simulators.xnf.impl.OngoingSimulations
-import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusFailure
-import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusNotFound
-import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusOngoing
-import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusSuccess
import org.onap.dcae.collectors.veshv.tests.utils.waitUntilSucceeds
import reactor.core.publisher.Mono
import reactor.core.scheduler.Schedulers
diff --git a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/XnfSimulatorTest.kt b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulatorTest.kt
index ea0628c1..11ce0b3f 100644
--- a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/XnfSimulatorTest.kt
+++ b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulatorTest.kt
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.collectors.veshv.main
+package org.onap.dcae.collectors.veshv.simulators.xnf.impl
import arrow.core.Left
import arrow.core.None
@@ -30,7 +30,6 @@ import com.nhaarman.mockitokotlin2.whenever
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
-import org.onap.dcae.collectors.veshv.simulators.xnf.impl.XnfSimulator
import org.onap.dcae.collectors.veshv.simulators.xnf.impl.adapters.HvVesClient
import org.onap.dcae.collectors.veshv.simulators.xnf.impl.factory.ClientFactory
import org.onap.dcae.collectors.veshv.tests.utils.Assertions.assertThat
diff --git a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/HvVesClientTest.kt b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClientTest.kt
index 14061532..5e6cb981 100644
--- a/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/HvVesClientTest.kt
+++ b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClientTest.kt
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.collectors.veshv.main
+package org.onap.dcae.collectors.veshv.simulators.xnf.impl.adapters
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq
diff --git a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtilsTest.kt
index c7c414f8..631ec7bf 100644
--- a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt
+++ b/sources/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtilsTest.kt
@@ -17,10 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.collectors.veshv.ssl.boundary
+package org.onap.dcae.collectors.veshv.simulators.xnf.impl.config
import com.nhaarman.mockitokotlin2.doReturn
-import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.whenever
@@ -36,7 +35,7 @@ import org.onap.dcae.collectors.veshv.commandline.stringValue
import java.nio.file.Paths
-internal object UtilsKtTest : Spek({
+internal object SslUtilsTest : Spek({
describe("creating securty configuration provider") {
@@ -50,27 +49,28 @@ internal object UtilsKtTest : Spek({
.doReturn(passwordFile)
it("should create configuration with some keys") {
- val configuration = createSecurityConfiguration(commandLine)
+ val configuration = createSecurityConfigurationProvider(commandLine)
verify(commandLine).hasOption(CommandLineOption.SSL_DISABLE)
assertThat(configuration.isSuccess()).isTrue()
- configuration.map { assertThat(it.keys.isDefined()).isTrue() }
+ configuration.map { assertThat(it().keys.isDefined()).isTrue() }
}
}
+
on("command line with ssl disabled") {
val commandLine: CommandLine = mock()
whenever(commandLine.hasOption(CommandLineOption.SSL_DISABLE)).doReturn(true)
it("should create configuration without keys") {
- val configuration = createSecurityConfiguration(commandLine)
+ val configuration = createSecurityConfigurationProvider(commandLine)
verify(commandLine).hasOption(CommandLineOption.SSL_DISABLE)
assertThat(configuration.isSuccess()).isTrue()
- configuration.map { assertThat(it.keys.isEmpty()).isTrue() }
+ configuration.map { assertThat(it().keys.isEmpty()).isTrue() }
}
}
}
})
private fun resourcePathAsString(resource: String) =
- Paths.get(UtilsKtTest::class.java.getResource(resource).toURI()).toString()
+ Paths.get(SslUtilsTest::class.java.getResource(resource).toURI()).toString()
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/ca.crt b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/ca.crt
index f9a05b90..f9a05b90 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/ca.crt
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/ca.crt
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/password b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/password
index e69c2de9..e69c2de9 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/password
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/password
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.crt b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.crt
index 2b06108b..2b06108b 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.crt
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.crt
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.key b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.key
index 40e25932..40e25932 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.key
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.key
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12 b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.ks.pkcs12
index a97eb65a..a97eb65a 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/server.ks.pkcs12
Binary files differ
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12 b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/trust.pkcs12
index 01b61373..01b61373 100644
--- a/sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12
+++ b/sources/hv-collector-xnf-simulator/src/test/resources/ssl/trust.pkcs12
Binary files differ