diff options
author | Sebastien Premont-Tendland <sebastien.premont@bell.ca> | 2020-03-02 14:33:33 -0500 |
---|---|---|
committer | Sebastien Premont-Tendland <sebastien.premont@bell.ca> | 2020-03-19 13:28:18 +0000 |
commit | 0562fc1c7378be67b571bb142489272a6b1b3814 (patch) | |
tree | bcf38c342cb21710725eb89c8b7cc25c91f13e66 /ms/blueprintsprocessor/functions/resource-resolution | |
parent | fa12b4f311e77612e4e856b209a8c81c71f0b29d (diff) |
Fix kotlin cache lazy loading
When USE_SCRIPT_COMPILATION_CACHE is set to false the classLoader
is closed after the class is instantiated. This is causing an issue
when lazy loading is happening during the script execution.
Lazy loading occurs when a suspendible function returning something
is called from "processNB", kotlin will create a second class that
will be loaded during execution (needs to be in the classpath during execution).
Issue-ID: CCSDK-2150
Signed-off-by: Sebastien Premont-Tendland <sebastien.premont@bell.ca>
Change-Id: I64780287352d762325662e0e5d5b94038dedee7f
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution')
2 files changed, 10 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt index feef4c2fe..868f919c1 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt @@ -81,6 +81,8 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc // Invoke componentResourceAssignmentProcessor componentResourceAssignmentProcessor!!.executeScript(resourceAssignment) + + componentFunctionScriptingService.cleanupInstance(raRuntimeService.bluePrintContext(), scriptType) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt index d84488d76..5fbe32e07 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt @@ -52,6 +52,10 @@ class CapabilityResourceResolutionProcessorTest { .scriptInstance<ResourceAssignmentProcessor>(any(), any(), any()) } returns MockCapabilityScriptRA() + coEvery { + componentFunctionScriptingService.cleanupInstance(any(), any()) + } returns mockk() + val raRuntimeService = mockk<ResourceAssignmentRuntimeService>() every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>() every { raRuntimeService.getInputValue("test-property") } returns NullNode.getInstance() @@ -96,6 +100,10 @@ class CapabilityResourceResolutionProcessorTest { .scriptInstance<ResourceAssignmentProcessor>(any(), BluePrintConstants.SCRIPT_JYTHON, any()) } returns MockCapabilityScriptRA() + coEvery { + componentFunctionScriptingService.cleanupInstance(any(), any()) + } returns mockk() + val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) val capabilityResourceResolutionProcessor = |