aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-06-29 00:28:40 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-07-04 15:53:42 -0400
commit5f0a5dde67bc0e7c99bd8f9e9b7c447e69ce62fa (patch)
tree0eb10b1fc86efa62c70114495b599d3701107bb1 /ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin
parentc48ca03872b11a54cf898c93d4a62ef220f3c55f (diff)
Enforce resolutionKey or resourceId/resourceType
There are three existing ways to perform the resolution: either we don't store the results at all, whether for resource or template either we store using the resolution key. The combination of blueprintName, blueprintVersion, artifactName and resolutionKey has to be unique. If it is re-used, it is considered as a new attempt for that specific resolution request, and process will only try to resolve resources not marked at SUCCESS in the database. either we store using the resourceId and resourceType. As previous point, the combination of blueprintName, blueprintVersion, artifactName and resolutionKey has to be unique. If it is re-used, it is considered as a new attempt for that specific resolution request, and process will only try to resolve resources not marked at SUCCESS in the database. TBD: add uni tests Issue-ID: CCSDK-1423 Change-Id: I6b7198453cf0002edfa7a0c9ea3179555211b5dc Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
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/resolutionresults/api/ResourceControllerTest.kt20
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt9
2 files changed, 3 insertions, 26 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resolutionresults/api/ResourceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resolutionresults/api/ResourceControllerTest.kt
index daab7b3bb..9ed97df1a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resolutionresults/api/ResourceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resolutionresults/api/ResourceControllerTest.kt
@@ -16,44 +16,28 @@
package org.onap.ccsdk.cds.blueprintsprocessor.resolutionresults.api
-import com.fasterxml.jackson.core.type.TypeReference
-import com.fasterxml.jackson.module.kotlin.readValue
import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
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.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.python.jline.console.internal.ConsoleRunner.property
import org.slf4j.LoggerFactory
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.http.HttpHeaders
-import org.springframework.http.HttpStatus
-import org.springframework.http.MediaType
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.util.function.Consumer
-import kotlin.test.BeforeTest
-import org.h2.value.DataType.readValue
-import java.util.*
-import org.h2.value.DataType.readValue
-import org.python.bouncycastle.asn1.x500.style.RFC4519Style.l
-import org.h2.value.DataType.readValue
import org.onap.ccsdk.cds.blueprintsprocessor.resource.api.ErrorMessage
import org.onap.ccsdk.cds.blueprintsprocessor.resource.api.ResourceController
-import java.lang.reflect.Array
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
@RunWith(SpringRunner::class)
@@ -233,7 +217,7 @@ class ResourceControllerTest {
resourceAssignment.dictionaryName = "dd$prefix"
resourceAssignment.dictionarySource = "source$prefix"
resourceAssignment.version = 2
- resourceAssignment.status = "SUCCESS"
+ resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS
resourceAssignment.property = property
return resourceAssignment
}
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 649f6b5fe..c3a718e11 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
@@ -17,11 +17,9 @@
package org.onap.ccsdk.cds.blueprintsprocessor.resource.api
import kotlinx.coroutines.runBlocking
-import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.TemplateResolutionService
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.slf4j.LoggerFactory
@@ -29,18 +27,13 @@ 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.http.HttpStatus
import org.springframework.http.MediaType
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.io.File
-import java.nio.file.Paths
import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
-import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@WebFluxTest
@@ -137,7 +130,7 @@ class TemplateControllerTest {
webTestClient
.get()
.uri("/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix&resolutionKey=bob")
+ "&artifactName=$templatePrefix&resolutionKey=notFound")
.exchange()
.expectStatus().isNotFound
}