Provide ongoing occurrence value for scripting 15/95415/4
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Tue, 10 Sep 2019 19:41:13 +0000 (15:41 -0400)
committerShaaban Ebrahim <shaaban.eltanany.ext@orange.com>
Tue, 29 Oct 2019 12:30:09 +0000 (14:30 +0200)
This patch fixes this for template https://gerrit.onap.org/r/#/c/ccsdk/cds/+/95081/
but not for script, where the occurrence value might be needed.

In reality, this overall occurrence thing is a mistacke, but
it's solving an issue that I yet don't know how to properly
solve.

Change-Id: I7f8579ad2bde3f96b06aaf09c8b8c67d4b97e7b0
Issue-ID: CCSDK-1693
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Signed-off-by: Shaaban Ebrahim <shaaban.eltanany.ext@orange.com>
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt

index ca623aa..28e7d39 100644 (file)
@@ -198,6 +198,7 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
             blueprintRuntimeService
         }
 
+        exposeOccurrencePropertyInResourceAssignments(resourceAssignmentRuntimeService, properties)
 
         coroutineScope {
             bulkSequenced.forEach { batchResourceAssignments ->
@@ -352,4 +353,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
                 && resourceResolution.dictionaryVersion == resourceAssignment.version)
     }
 
+    private fun exposeOccurrencePropertyInResourceAssignments(raRuntimeService: ResourceAssignmentRuntimeService,
+                                                              properties: Map<String, Any>) {
+        raRuntimeService.putResolutionStore(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE,
+            properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive())
+    }
 }
index 775c501..5a5336a 100644 (file)
@@ -261,6 +261,7 @@ class ResourceResolutionServiceTest {
             every { raRuntimeService.getBluePrintError() } returns BluePrintError()
             every { raRuntimeService.setBluePrintError(any())} returns Unit
             every { raRuntimeService.getInputValue("device-id") } returns "123456".asJsonPrimitive()
+            every { raRuntimeService.putResolutionStore(any(), any()) } returns Unit
 
             val applicationContext = mockk<ApplicationContext>()
             every { applicationContext.getBean("rr-processor-source-capability") } returns MockCapabilityScriptRA()