aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt116
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt124
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt89
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt62
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt132
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt44
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml35
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zipbin9302 -> 0 bytes
11 files changed, 0 insertions, 667 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
deleted file mode 100644
index 264e2aea..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import com.google.protobuf.ByteString
-import io.grpc.testing.GrpcServerRule
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementInput
-import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.management.api.FileChunk
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
-import kotlin.test.assertEquals
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@DirtiesContext
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class BluePrintManagementGRPCHandlerTest {
-
- @get:Rule
- val grpcServerRule = GrpcServerRule().directExecutor()
-
- @Autowired
- lateinit var bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler
-
- @BeforeTest
- fun init() {
- // Create a server, add service, start, and register for automatic graceful shutdown.
- grpcServerRule.serviceRegistry.addService(bluePrintManagementGRPCHandler)
- }
-
- @AfterTest
- fun cleanDir() {
- //TODO It's giving fluctuating results, need to look for another way to cleanup
- // works sometimes otherwise results IO Exception
- // Most probably bufferReader stream is not getting closed when cleanDir is getting invoked
- File("./target/blueprints").deleteRecursively()
- }
-
- @Test
- fun `test upload blueprint`() {
- val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123_upload"
- val req = createInputRequest(id)
- val output = blockingStub.uploadBlueprint(req)
-
- assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
- assertEquals(id, output.commonHeader.requestId)
- }
-
- @Test
- fun `test delete blueprint`() {
- val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123_delete"
- val req = createInputRequest(id)
-
- var output = blockingStub.uploadBlueprint(req)
- assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
- assertEquals(id, output.commonHeader.requestId)
-
- output = blockingStub.removeBlueprint(req)
- assertEquals(200, output.status.code)
- }
-
- private fun createInputRequest(id: String): BluePrintManagementInput {
- val file = File("./src/test/resources/test-cba.zip")
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
-
- val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
-
- val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes()))
- .build()
-
- return BluePrintManagementInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setBlueprintName("sample")
- .setBlueprintVersion("1.0.0")
- .setFileChunk(fileChunk)
- .build()
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
deleted file mode 100644
index 01984b21..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-
-import com.google.protobuf.util.JsonFormat
-import io.grpc.stub.StreamObserver
-import io.grpc.testing.GrpcServerRule
-import org.junit.Assert
-import org.junit.Ignore
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.BeforeTest
-
-@Ignore
-@RunWith(SpringRunner::class)
-@DirtiesContext
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class BluePrintProcessingGRPCHandlerTest {
- private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
-
- @get:Rule
- val grpcServerRule = GrpcServerRule().directExecutor()
-
- @Autowired
- lateinit var bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler
-
- lateinit var requestObs: StreamObserver<ExecutionServiceInput>
-
- @BeforeTest
- fun init() {
- grpcServerRule.serviceRegistry.addService(bluePrintProcessingGRPCHandler)
-
- val blockingStub = BluePrintProcessingServiceGrpc.newStub(grpcServerRule.channel)
-
- requestObs = blockingStub.process(object : StreamObserver<ExecutionServiceOutput> {
- override fun onNext(executionServiceOuput: ExecutionServiceOutput) {
- log.debug("onNext {}", executionServiceOuput)
- if ("1234".equals(executionServiceOuput.commonHeader.requestId)) {
- Assert.assertEquals("Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.", executionServiceOuput.status.errorMessage)
- }
- }
-
- override fun onError(error: Throwable) {
- log.debug("Fail to process message", error)
- Assert.assertEquals("INTERNAL: Could not find blueprint : from database", error.message)
- }
-
- override fun onCompleted() {
- log.info("Done")
- }
- })
- }
-
- @Test
- fun testSelfServiceGRPCHandler() {
- val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234")
- .setSubRequestId("1234-56").build()
-
- val jsonContent = JacksonUtils.getClassPathFileContent("execution-input/sample-payload.json")
- val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
- JsonFormat.parser().merge(jsonContent, payloadBuilder)
-
- val input = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setPayload(payloadBuilder.build())
- .build()
-
- requestObs.onNext(input)
-
- val commonHeader2 = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("2345")
- .setSubRequestId("1234-56").build()
-
- val actionIdentifier = ActionIdentifiers.newBuilder().setMode("sync").build()
-
- val input2 = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader2)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
-
- requestObs.onNext(input2)
-
- requestObs.onCompleted()
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
deleted file mode 100644
index b730472e..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
-import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.core.io.ByteArrayResource
-import org.springframework.http.client.MultipartBodyBuilder
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.test.web.reactive.server.WebTestClient
-import org.springframework.web.reactive.function.BodyInserters
-import java.nio.file.Files
-import java.nio.file.Paths
-import kotlin.test.assertTrue
-
-@RunWith(SpringRunner::class)
-@WebFluxTest
-@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class, BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
-@TestPropertySource(locations = ["classpath:application-test.properties"])
-class ExecutionServiceHandlerTest {
-
- @Autowired
- lateinit var blueprintCatalog: BluePrintCatalogService
- @Autowired
- lateinit var webTestClient: WebTestClient
-
-
- @Test
- fun `test rest upload blueprint`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
-
- val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(Files.readAllBytes(Paths.get("./src/test/resources/test-cba.zip"))) {
- override fun getFilename(): String {
- return "test-cba.zip"
- }
- })
- }.build()
-
- webTestClient
- .post()
- .uri("/api/v1/execution-service/upload")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
- }
-
- @Test
- fun `test rest process`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase(file)
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
- webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().isOk
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt
deleted file mode 100644
index 19c624bc..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
- * 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.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock
-
-import io.mockk.mockk
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
-import org.slf4j.LoggerFactory
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-
-@Configuration
-open class MockComponentConfiguration {
-
- @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"])
- open fun createComponentFunction(): AbstractComponentFunction {
- return MockComponentFunction()
- }
-}
-
-class MockComponentFunction : AbstractComponentFunction() {
-
- private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
-
- override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : $operationInputs")
-
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- log.info("Recovering component..")
- }
-}
-
-open class MockResourceSource {
- @Bean(name = [
- "rr-processor-source-input",
- "rr-processor-source-default",
- "rr-processor-source-primary-db",
- "rr-processor-source-rest"])
- open fun sourceInstance(): ResourceAssignmentProcessor {
- return mockk<ResourceAssignmentProcessor>()
- }
-
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
deleted file mode 100644
index 770e4a9b..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
-
-import org.junit.Assert
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
-import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag
-import org.springframework.test.context.junit4.SpringRunner
-import java.text.SimpleDateFormat
-
-@RunWith(SpringRunner::class)
-class BluePrintMappingsTest {
-
- val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- val dateString = "2019-01-16T18:25:43.511Z"
- val dateForTest = formatter.parse(dateString)
-
- val flag = Flag.newBuilder().setIsForce(false).setTtl(1).build()
-
- fun createFlag(): Flags {
- val flag = Flags()
- flag.isForce = false
- flag.ttl = 1
- return flag
- }
-
- @Test
- fun flagToJavaTest() {
- val flag2 = flag.toJava()
-
- Assert.assertEquals(flag.isForce, flag2.isForce)
- Assert.assertEquals(flag.ttl, flag2.ttl)
- }
-
- @Test
- fun flagToProtoTest() {
- val flag = createFlag()
- val flag2 = flag.toProto()
-
- Assert.assertEquals(flag.isForce, flag2.isForce)
- Assert.assertEquals(flag.ttl, flag2.ttl)
- }
-
- fun createStatus(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status {
- val status = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status()
- status.code = 400
- status.errorMessage = "Concurrent modification exception"
- status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name
- status.message = "Error uploading data"
- status.timestamp = dateForTest
- return status
- }
-
- @Test
- fun statusToProtoTest() {
- val status = createStatus()
- val status2 = status.toProto()
-
- Assert.assertEquals(status.code, status2.code)
- Assert.assertEquals(status.errorMessage, status2.errorMessage)
- Assert.assertEquals(status.eventType, status2.eventType.name)
- Assert.assertEquals(status.message, status2.message)
- Assert.assertEquals(status.timestamp.toString(), status2.timestamp)
- }
-
- @Test
- fun commonHeaderToJavaTest() {
- val flag = Flag.newBuilder().setIsForce(true).setTtl(2).build()
-
- val commonHeader = CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString).setFlag(flag).build()
- val commonHeader2 = commonHeader.toJava()
-
- Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
- Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
- Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
- Assert.assertEquals(commonHeader.timestamp, formatter.format(commonHeader2.timestamp))
- }
-
- fun createCommonHeader(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader {
- val commonHeader = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader()
- commonHeader.flags = createFlag()
- commonHeader.originatorId = "1234"
- commonHeader.requestId = "2345"
- commonHeader.subRequestId = "0123"
- commonHeader.timestamp = dateForTest
- return commonHeader
- }
-
- @Test
- fun commonHeaderToProtoTest() {
- val commonHeader = createCommonHeader()
- val commonHeader2 = commonHeader.toProto()
- Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
- Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
- Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
- Assert.assertEquals(commonHeader.timestamp.toString(), commonHeader2.timestamp)
- }
-
- @Test
- fun actionIdentifierToJavaTest() {
- val actionIdentifiers = ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0").setMode("Execution").build()
- val actionIdentifiers2 = actionIdentifiers.toJava()
-
- Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
- Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
- Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
- Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
- }
-
- fun createActionIdentifier(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers {
- val ac = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers()
- ac.mode = "mode"
- ac.blueprintVersion = "version"
- ac.blueprintName = "name"
- ac.actionName = "action"
- return ac
- }
-
- @Test
- fun actionIdentifierToProtoTest() {
- val actionIdentifiers = createActionIdentifier()
- val actionIdentifiers2 = actionIdentifiers.toProto()
-
- Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
- Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
- Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
- Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
deleted file mode 100644
index 1cafead7..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * 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.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.validation
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockResourceSource
-import org.onap.ccsdk.apps.controllerblueprints.validation.BluePrintValidationConfiguration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRuntimeValidatorService::class,
- BluePrintValidationConfiguration::class, MockResourceSource::class])
-class BluePrintRuntimeValidatorServiceTest {
-
- @Autowired
- lateinit var bluePrintRuntimeValidatorService: BluePrintRuntimeValidatorService
-
- @Test
- fun testBlueprintRuntimeValidation() {
- val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
- assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService")
-
- bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath)
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
deleted file mode 100644
index 6d8b62ff..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright © 2017-2018 AT&T Intellectual Property.
-#
-# Modifications Copyright © 2019 IBM, Bell Canada.
-#
-# 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.
-#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-# Controller Blueprints Core Configuration
-blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
-
-# Python executor
-blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
-blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
deleted file mode 100644
index 47ace853..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "commonHeader": {
- "originatorId": "System",
- "requestId": "1234",
- "subRequestId": "1234-12234"
- },
- "actionIdentifiers": {
- "blueprintName": "baseconfiguration",
- "blueprintVersion": "1.0.0",
- "actionName": "activate",
- "mode": "sync"
- },
- "payload": {
- "activate-request": {
- "activate-properties": {
- "request-id": "1234",
- "action-name": "activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json
deleted file mode 100644
index 07046aa3..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/sample-payload.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "activate-request": {
- "activate-properties": {
- "request-id": "1234",
- "action-name": "activate",
- "scope-type": "vnf-type",
- "hostname": "localhost"
- }
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
deleted file mode 100644
index a816a06c..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ 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.
- -->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="org.springframework" level="warn"/>
- <logger name="org.hibernate" level="info"/>
- <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
-
-</configuration>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip
deleted file mode 100644
index 90748240..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip
+++ /dev/null
Binary files differ