diff options
author | 2022-07-01 09:04:36 +0000 | |
---|---|---|
committer | 2022-08-22 16:09:10 +0000 | |
commit | 4326f62b48d2309f4626d778fc5ffbb45ec1627d (patch) | |
tree | 016556d53c166596c7b324fe693904fc0dca70e2 /ms/blueprintsprocessor/functions/resource-resolution/src/test | |
parent | 9eb67111794a2a10bc9776775aced9ef9b84345b (diff) |
Use all source-db resources instead of only processor-db
In DatabaseResourceAssignmentProcessor class filter resourceSourceMappings to get all source-db resources instead of using only one: processor-db
Issue-ID: CCSDK-3699
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: I616ca6fe1336427b0b603a0386878ba4c8ea5828
(cherry picked from commit 3395dfa1f31111bb4dd03e89a7e493a2850901f2)
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test')
2 files changed, 33 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt index 0c8ec7d95..8a9f6578d 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt @@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.util import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.TestPropertySource @@ -75,4 +76,34 @@ class DatabaseResourceResolutionProcessorTest { assertNotNull(processorName, "couldn't get Database resource assignment processor name") } } + + @Test + fun `test database resource resolution any db`() { + runBlocking { + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) + + val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) + + ResourceSourceMappingFactory.registerSourceMapping("processor-db", "source-db") + ResourceSourceMappingFactory.registerSourceMapping("any-db", "source-db") + + databaseResourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService + databaseResourceAssignmentProcessor.resourceDictionaries = ResourceAssignmentUtils + .resourceDefinitions(bluePrintContext.rootPath) + + val resourceAssignment = ResourceAssignment().apply { + name = "service-instance-id" + dictionaryName = "service-instance-id" + dictionarySource = "any-db" + property = PropertyDefinition().apply { + type = "string" + } + } + + val processorName = databaseResourceAssignmentProcessor.applyNB(resourceAssignment) + assertNotNull(processorName, "couldn't get Database resource assignment processor name") + } + } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties index 4483ac835..95a650583 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest,vault-data=source-rest,script=source-capability,any-db=source-db + blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1 blueprintsprocessor.db.username=sa blueprintsprocessor.db.password= |