summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json)30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json)70
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json)54
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json)52
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json)44
8 files changed, 152 insertions, 148 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
index f8193b7f9..6645a631a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
@@ -123,12 +123,16 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
checkNotEmpty(resourceAssignment.dictionaryName) {
"resource assignment dictionary name is not defined for template key (${resourceAssignment.name})"
}
- check(resourceAssignment.dictionarySource in arrayOf(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, ResourceDictionaryConstants.SOURCE_PRIMARY_DB))
+ check(resourceAssignment.dictionarySource in getListOfDBSources())
{
- "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
+ "resource assignment source is not ${ResourceDictionaryConstants.PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
}
}
+ //placeholder to get the list of DB sources.
+ //TODO: This will be replaced with a DB
+ private fun getListOfDBSources(): Array<String> = arrayOf(ResourceDictionaryConstants.PROCESSOR_DB)
+
private fun populateNamedParameter(inputKeyMapping: Map<String, String>): Map<String, Any> {
val namedParameters = HashMap<String, Any>()
inputKeyMapping.forEach {
@@ -163,4 +167,4 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
index 7e7e65635..9c6aae250 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
@@ -73,7 +73,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-name"
dictionaryName = "vnf_name"
- dictionarySource = "primary-config-data"
+ dictionarySource = "config-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -106,7 +106,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-aai"
dictionaryName = "aai-get-resource"
- dictionarySource = "primary-aai-data"
+ dictionarySource = "aai-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -139,7 +139,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-aai"
dictionaryName = "aai-put-resource"
- dictionarySource = "primary-aai-data"
+ dictionarySource = "aai-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -150,4 +150,4 @@ class RestResourceResolutionProcessorTest {
println(processorName)
}
}
-} \ No newline at end of file
+}
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 5deea31e1..3218a585d 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,14 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
@@ -30,12 +30,12 @@ blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
-blueprintsprocessor.restclient.primary-config-data.type=basic-auth
-blueprintsprocessor.restclient.primary-config-data.url=http://127.0.0.1:9911
-blueprintsprocessor.restclient.primary-config-data.username=sampleuser
-blueprintsprocessor.restclient.primary-config-data.password=sampletoken
+blueprintsprocessor.restclient.config-data.type=basic-auth
+blueprintsprocessor.restclient.config-data.url=http://127.0.0.1:9911
+blueprintsprocessor.restclient.config-data.username=sampleuser
+blueprintsprocessor.restclient.config-data.password=sampletoken
-blueprintsprocessor.restclient.primary-aai-data.type=basic-auth
-blueprintsprocessor.restclient.primary-aai-data.url=http://127.0.0.1:30800
-blueprintsprocessor.restclient.primary-aai-data.username=admin
-blueprintsprocessor.restclient.primary-aai-data.password=aaiTest \ No newline at end of file
+blueprintsprocessor.restclient.aai-data.type=basic-auth
+blueprintsprocessor.restclient.aai-data.url=http://127.0.0.1:30800
+blueprintsprocessor.restclient.aai-data.username=admin
+blueprintsprocessor.restclient.aai-data.password=aaiTest
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json
index 52e0a7967..256830ef9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json
@@ -1,15 +1,15 @@
-{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
+{
+ "version": "1.0.0",
+ "description": "test Data Type",
+ "properties": {
+ "country": {
+ "required": true,
+ "type": "string"
+ },
+ "state": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json
index 7082a4341..16788c3ba 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json
@@ -1,35 +1,35 @@
-{
- "locations": {
- "name": "locations",
- "data-type": "list",
- "entry-schema": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- },
- "candidate-dependency": {
- "primary-db": {
- "names": [
- "profile_name"
- ]
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "locations": {
+ "name": "locations",
+ "data-type": "list",
+ "entry-schema": "dt-location",
+ "source": {
+ "processor-db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ },
+ "candidate-dependency": {
+ "processor-db": {
+ "names": [
+ "profile_name"
+ ]
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json
index 53e2a11c3..bccf250f1 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json
@@ -1,27 +1,27 @@
-{
- "location": {
- "name": "location",
- "data-type": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "location": {
+ "name": "location",
+ "data-type": "dt-location",
+ "source": {
+ "processor-db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json
index fad088877..843adc1fa 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json
@@ -1,26 +1,26 @@
-{
- "country": {
- "name": "country",
- "data-type": "string",
- "source": {
- "primary-db": {
- "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "country": {
+ "name": "country",
+ "data-type": "string",
+ "source": {
+ "processor-db": {
+ "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "country": "country"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json
index bb392d7be..9d7d44c9c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json
@@ -1,22 +1,22 @@
-[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "primary-db",
- "dependencies": ["state"]
- },
- {
- "name": "state",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "state",
- "dictionary-source": "input",
- "dependencies": []
- }
-]
+[
+ {
+ "name": "country",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "country",
+ "dictionary-source": "processor-db",
+ "dependencies": ["state"]
+ },
+ {
+ "name": "state",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "state",
+ "dictionary-source": "input",
+ "dependencies": []
+ }
+]