diff options
author | Dan Timoney <dtimoney@att.com> | 2020-09-22 19:05:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-09-22 19:05:47 +0000 |
commit | e515a85125e5487ecd3f7127b6af0b192d4a0993 (patch) | |
tree | 1fe08a7d54c28419a44845634037d77f8c434a4b /ms/blueprintsprocessor/modules/blueprints/resource-dict/src | |
parent | 85d8f7f7701570fb745c3d6360d500f97bdf1b25 (diff) | |
parent | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (diff) |
Merge "Enabling Code Formatter"
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/resource-dict/src')
8 files changed, 31 insertions, 17 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt index 70f151b66..556f4a3da 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt @@ -101,12 +101,13 @@ open class ResourceAssignment { dictionaryName = $dictionaryName dictionarySource = $dictionarySource ] - """.trimIndent() + """.trimIndent() } } data class KeyIdentifier(val name: String, val value: JsonNode) data class DictionaryMetadataEntry(val name: String, val value: String) + /** * Data class for exposing summary of resource resolution */ @@ -132,6 +133,7 @@ data class ResolutionSummary( @JsonProperty("message") val message: String ) + /** * Interface for Source Definitions (ex Input Source, * Default Source, Database Source, Rest Sources, etc) @@ -139,5 +141,6 @@ data class ResolutionSummary( interface ResourceSource : Serializable open class ResourceSourceMapping { + lateinit var resourceSourceMappings: MutableMap<String, String> } diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt index a5171d25c..b97492dc8 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt @@ -122,7 +122,7 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio for (resourceAssignment in vs) { s.append( "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name + - ")," + ")," ) } s.append("]") @@ -131,7 +131,7 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio for (resourceAssignment in vs) { s.append( "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name + - ")," + ")," ) } s.append("]") diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt index 422f65157..5117c4388 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt @@ -60,8 +60,10 @@ object BulkResourceSequencingUtils { } else if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { for (dependency in resourceAssignment.dependencies!!) { val ra = resourceAssignmentMap[dependency] - ?: throw BluePrintProcessorException("Couldn't get Resource Assignment dependency " + - "Key($dependency)") + ?: throw BluePrintProcessorException( + "Couldn't get Resource Assignment dependency " + + "Key($dependency)" + ) topologySorting.add(ra, resourceAssignment) } } else { diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt index f26c5098f..c09474a2b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory import java.io.File object ResourceDictionaryUtils { + private val log = LoggerFactory.getLogger(ResourceDictionaryUtils::class.java) @JvmStatic diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java index b8e1d519b..3e9965f5e 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -31,7 +31,8 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionInputSource() { String fileName = basePath + "/input-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = + JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition); } @@ -39,7 +40,8 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDefaultSource() { String fileName = basePath + "/default-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = + JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition); } @@ -47,14 +49,16 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDBSource() { String fileName = basePath + "/db-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = + JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for processor-db type", resourceDefinition); } @Test public void testDictionaryDefinitionMDSALSource() { String fileName = basePath + "/mdsal-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = + JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition); } diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt index 77af5dbe0..66df5078c 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory class ResourceAssignmentValidationServiceTest { private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceTest::class.java) + @Before fun setUp() { // Setup dummy Source Instance Mapping diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java index 30b4d4544..904dbc2c3 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java @@ -32,9 +32,10 @@ public class BulkResourceSequencingUtilsTest { @Test public void testProcess() { - List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); + List<ResourceAssignment> assignments = + JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments); BulkResourceSequencingUtils.process(assignments); } -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java index 8004d2ca2..862f1892d 100644 --- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java +++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java @@ -50,26 +50,27 @@ public class ResourceDictionaryUtilsTest { resourceDefinition.setSources(sources); // To Check Empty Source ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, resourceAssignment.getDictionarySource()); + Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, + resourceAssignment.getDictionarySource()); // To Check First Source resourceAssignment.setDictionarySource(null); sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate()); ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected First source Default, but.", - ResourceDictionaryConstants.SOURCE_DEFAULT, + Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource()); // To Check Assigned Source resourceAssignment.setDictionarySource(ResourceDictionaryConstants.PROCESSOR_DB); ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.PROCESSOR_DB, resourceAssignment.getDictionarySource()); + Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.PROCESSOR_DB, + resourceAssignment.getDictionarySource()); } @Test public void testFindFirstSource() { - //To check if Empty Source + // To check if Empty Source Map<String, NodeTemplate> sources = new HashMap<>(); String firstSource = ResourceDictionaryUtils.findFirstSource(sources); Assert.assertNull("Source populated, which is not expected.", firstSource); @@ -82,7 +83,8 @@ public class ResourceDictionaryUtilsTest { // TO check the multiple Source sources.put(ResourceDictionaryConstants.PROCESSOR_DB, new NodeTemplate()); String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource); + Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, + multipleFirstSource); } |