X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Ffunctions%2Fresource-resolution%2Fsrc%2Ftest%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Ffunctions%2Fresource%2Fresolution%2Futils%2FResourceAssignmentUtilsTest.kt;fp=ms%2Fblueprintsprocessor%2Ffunctions%2Fresource-resolution%2Fsrc%2Ftest%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Ffunctions%2Fresource%2Fresolution%2Futils%2FResourceAssignmentUtilsTest.kt;h=88405f00790d9955be4bcee834390818df83b408;hb=5b924a33f2b7cd936aab934d706c8f735f7570d6;hp=36229b77ebac5a913bf0b603ad69ff680b765b2f;hpb=72ae79d15d6ebc9a06202733b2fd999fb30ea048;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt index 36229b77e..88405f007 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt @@ -40,6 +40,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition +import java.util.concurrent.atomic.AtomicBoolean +import kotlin.concurrent.thread import kotlin.test.assertEquals data class IpAddress(val port: String, val ip: String) @@ -387,6 +389,24 @@ class ResourceAssignmentUtilsTest { ) } + @Test + fun `resource resolution issue of resourceStore HashMap during resource resolution`() { + var uncaughtExceptionOccured = AtomicBoolean(false) + for (i in 1..1000) { + thread { + resourceAssignmentRuntimeService.putResolutionStore("key_$i", "value_$i".asJsonType()) + } + val t = thread(false) { + resourceAssignmentRuntimeService.getResolutionStore() + // often ConcurrentModificationException occurs here + } + t.uncaughtExceptionHandler = + Thread.UncaughtExceptionHandler { t, e -> uncaughtExceptionOccured = AtomicBoolean(true) } + t.start() + } + assertEquals(uncaughtExceptionOccured.get(), false) + } + private fun initInputMapAndExpectedValuesForPrimitiveType() { inputMapToTestPrimitiveTypeWithValue = "1.2.3.1".asJsonType() val keyValue = mutableMapOf()