summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2019-11-22 18:06:08 -0500
committerKAPIL SINGAL <ks220y@att.com>2019-11-26 21:32:38 +0000
commit341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch)
tree113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test
parentd274e5fc552cf9ae25500f504f0434981cf3accf (diff)
Formatting Code base with ktlint
No Business logic change, just the code format. Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3 To format run: mvn process-sources -P format Issue-ID: CCSDK-1947 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
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/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt46
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt28
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt21
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt (renamed from ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt9
8 files changed, 99 insertions, 79 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index 8bedc9628..e990c90d8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -18,7 +18,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
-
import com.google.protobuf.util.JsonFormat
import io.grpc.stub.StreamObserver
import io.grpc.testing.GrpcServerRule
@@ -44,10 +43,13 @@ import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
@DirtiesContext
@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.controllerblueprints"]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
+
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
@get:Rule
@@ -68,7 +70,10 @@ class BluePrintProcessingGRPCHandlerTest {
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)
+ Assert.assertEquals(
+ "Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.",
+ executionServiceOuput.status.errorMessage
+ )
}
}
@@ -86,39 +91,38 @@ class BluePrintProcessingGRPCHandlerTest {
@Test
fun testSelfServiceGRPCHandler() {
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234")
- .setSubRequestId("1234-56").build()
+ .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()
+ .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()
+ .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()
+ .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/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
index 8971ebde2..b26781ad2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
@@ -36,7 +36,7 @@ class BluePrintProcessingIntegrationTest {
private val log = logger(BluePrintProcessingIntegrationTest::class)
/** This is Integration test sample, Do not enable this test case in server build, this is for local desktop testing*/
- //@Test
+ // @Test
fun integrationTestGrpcManagement() {
runBlocking {
val tokenAuthGrpcClientProperties = TokenAuthGrpcClientProperties().apply {
@@ -65,26 +65,26 @@ class BluePrintProcessingIntegrationTest {
})
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234-$it")
- .setSubRequestId("1234-56").build()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId("1234-$it")
+ .setSubRequestId("1234-56").build()
val jsonContent = JacksonUtils.getClassPathFileContent("execution-input/sample-payload.json")
val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
JsonFormat.parser().merge(jsonContent, payloadBuilder)
val actionIdentifier = ActionIdentifiers.newBuilder()
- .setActionName("SampleScript")
- .setBlueprintName("sample-cba")
- .setBlueprintVersion("1.0.0")
- .build()
+ .setActionName("SampleScript")
+ .setBlueprintName("sample-cba")
+ .setBlueprintVersion("1.0.0")
+ .build()
val input = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
requestObs.onNext(input)
requestObs.onCompleted()
@@ -93,4 +93,4 @@ class BluePrintProcessingIntegrationTest {
channel.shutdownNow()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
index 01199c131..f71d1b444 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
@@ -34,8 +34,10 @@ import kotlin.test.Test
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingKafkaConsumerTest {
@@ -45,15 +47,19 @@ class BluePrintProcessingKafkaConsumerTest {
@Test
fun testExecutionInputMessageConsumer() {
runBlocking {
- assertNotNull(bluePrintMessageLibPropertyService,
- "failed to initialise bluePrintMessageLibPropertyService")
+ assertNotNull(
+ bluePrintMessageLibPropertyService,
+ "failed to initialise bluePrintMessageLibPropertyService"
+ )
val executionServiceHandle = mockk<ExecutionServiceHandler>()
coEvery { executionServiceHandle.doProcess(any()) } returns mockk()
- val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(bluePrintMessageLibPropertyService,
- executionServiceHandle)
+ val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(
+ bluePrintMessageLibPropertyService,
+ executionServiceHandle
+ )
launch {
bluePrintProcessingKafkaConsumer.setupMessageListener()
@@ -62,5 +68,4 @@ class BluePrintProcessingKafkaConsumerTest {
bluePrintProcessingKafkaConsumer.shutdownMessageListener()
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
index e1a498a6f..a6ebe9c3e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
@@ -36,17 +36,21 @@ import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
import org.springframework.web.reactive.function.BodyInserters
import java.io.File
-import java.util.*
+import java.util.UUID
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+ classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class]
+)
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.controllerblueprints"]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceControllerTest {
@@ -71,15 +75,17 @@ class ExecutionServiceControllerTest {
blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/default-input.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "execution-input/default-input.json",
+ ExecutionServiceInput::class.java
+ )!!
webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().isOk
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().isOk
}
}
@@ -89,15 +95,17 @@ class ExecutionServiceControllerTest {
blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/faulty-input.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "execution-input/faulty-input.json",
+ ExecutionServiceInput::class.java
+ )!!
webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().is5xxServerError
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().is5xxServerError
}
}
@@ -106,4 +114,4 @@ class ExecutionServiceControllerTest {
assertTrue(testCbaFile.exists(), "couldn't get file ${testCbaFile.absolutePath}")
return testCbaFile
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
index 293da0da6..5a44403e1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -73,12 +73,12 @@ class ExecutionServiceHandlerTest {
@Service("mock-service-action")
class MockServiceAction : AbstractServiceFunction() {
+
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val responsePayload = """{"answer" : "correct"}""".jsonAsJsonType()
setResponsePayloadForAction(responsePayload)
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
index 27130a7bc..9f5cc6097 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
@@ -41,8 +41,10 @@ class MockComponentFunction : AbstractComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
log.info("Processing component : $operationInputs")
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ "assignment-params", "params".asJsonPrimitive()
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
@@ -51,13 +53,14 @@ class MockComponentFunction : AbstractComponentFunction() {
}
open class MockResourceSource {
- @Bean(name = [
- "rr-processor-source-input",
- "rr-processor-source-default",
- "rr-processor-source-db",
- "rr-processor-source-rest"])
+ @Bean(
+ name = [
+ "rr-processor-source-input",
+ "rr-processor-source-default",
+ "rr-processor-source-db",
+ "rr-processor-source-rest"]
+ )
open fun sourceInstance(): ResourceAssignmentProcessor {
return mockk<ResourceAssignmentProcessor>()
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt
index 07d8ca4e1..db2791101 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt
@@ -23,5 +23,4 @@ class UtilsTest {
val nonExistentHttpStatusCode = determineHttpStatusCode(999999)
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, nonExistentHttpStatusCode)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
index 08da9dc28..820c4be42 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
@@ -26,8 +26,10 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRuntimeValidatorService::class,
- BluePrintValidationConfiguration::class, MockResourceSource::class])
+@ContextConfiguration(
+ classes = [BluePrintRuntimeValidatorService::class,
+ BluePrintValidationConfiguration::class, MockResourceSource::class]
+)
class BluePrintRuntimeValidatorServiceTest {
@Autowired
@@ -39,6 +41,5 @@ class BluePrintRuntimeValidatorServiceTest {
assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService")
bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath)
-
}
-} \ No newline at end of file
+}