aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin
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/resource-api/src/test/kotlin
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/resource-api/src/test/kotlin')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt51
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt14
2 files changed, 41 insertions, 24 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
index 85ac7bddd..60b24131f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
@@ -22,6 +22,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionDBService
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -35,8 +36,6 @@ 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.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-
@RunWith(SpringRunner::class)
@WebFluxTest
@@ -88,8 +87,10 @@ class ResourceControllerTest {
.consumeWith {
val json = String(it.responseBody!!)
val typeFactory = JacksonUtils.objectMapper.typeFactory
- val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(json,
- typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java))
+ val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(
+ json,
+ typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java)
+ )
Assert.assertEquals(2, list.size)
assertEqual(ra1, list[0])
assertEqual(ra1, list[0])
@@ -119,8 +120,10 @@ class ResourceControllerTest {
.consumeWith {
val json = String(it.responseBody!!)
val typeFactory = JacksonUtils.objectMapper.typeFactory
- val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(json,
- typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java))
+ val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(
+ json,
+ typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java)
+ )
Assert.assertEquals(2, list.size)
assertEqual(ra1, list[0])
assertEqual(ra1, list[0])
@@ -128,7 +131,6 @@ class ResourceControllerTest {
}
}
-
@Test
fun getAllFromMissingParamTest() {
runBlocking {
@@ -140,8 +142,10 @@ class ResourceControllerTest {
.expectBody()
.consumeWith {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorMessage::class.java)
- Assert.assertEquals("Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
- r.message)
+ Assert.assertEquals(
+ "Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
+ r.message
+ )
}
}
}
@@ -157,8 +161,10 @@ class ResourceControllerTest {
.expectBody()
.consumeWith {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorMessage::class.java)
- Assert.assertEquals("Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
- r.message)
+ Assert.assertEquals(
+ "Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
+ r.message
+ )
}
}
}
@@ -195,15 +201,21 @@ class ResourceControllerTest {
}
}
- private suspend fun store(resourceAssignment: ResourceAssignment, resKey: String = "", resId: String = "",
- resType: String = "") {
- resourceResolutionDBService.write(blueprintName,
+ private suspend fun store(
+ resourceAssignment: ResourceAssignment,
+ resKey: String = "",
+ resId: String = "",
+ resType: String = ""
+ ) {
+ resourceResolutionDBService.write(
+ blueprintName,
blueprintVersion,
resKey,
resId,
resType,
templatePrefix,
- resourceAssignment)
+ resourceAssignment
+ )
}
private fun createRA(prefix: String): ResourceAssignment {
@@ -221,8 +233,10 @@ class ResourceControllerTest {
}
private fun assertEqual(resourceAssignment: ResourceAssignment, resourceResolution: ResourceResolution) {
- Assert.assertEquals(JacksonUtils.getValue(resourceAssignment.property?.value!!).toString(),
- resourceResolution.value)
+ Assert.assertEquals(
+ JacksonUtils.getValue(resourceAssignment.property?.value!!).toString(),
+ resourceResolution.value
+ )
Assert.assertEquals(resourceAssignment.status, resourceResolution.status)
Assert.assertEquals(resourceAssignment.dictionarySource, resourceResolution.dictionarySource)
Assert.assertEquals(resourceAssignment.dictionaryName, resourceResolution.dictionaryName)
@@ -230,6 +244,5 @@ class ResourceControllerTest {
Assert.assertEquals(resourceAssignment.name, resourceResolution.name)
Assert.assertEquals(blueprintVersion, resourceResolution.blueprintVersion)
Assert.assertEquals(blueprintName, resourceResolution.blueprintName)
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
index c3a718e11..baf0aa7c1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
@@ -37,8 +37,10 @@ import kotlin.test.AfterTest
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
+@ContextConfiguration(
+ classes = [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 TemplateControllerTest {
@@ -129,8 +131,10 @@ class TemplateControllerTest {
webTestClient
.get()
- .uri("/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix&resolutionKey=notFound")
+ .uri(
+ "/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
+ "&artifactName=$templatePrefix&resolutionKey=notFound"
+ )
.exchange()
.expectStatus().isNotFound
}
@@ -172,4 +176,4 @@ class TemplateControllerTest {
.expectBody().equals(payloadDummyTemplateData)
}
}
-} \ No newline at end of file
+}