aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-09-22 19:05:47 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-22 19:05:47 +0000
commite515a85125e5487ecd3f7127b6af0b192d4a0993 (patch)
tree1fe08a7d54c28419a44845634037d77f8c434a4b
parent85d8f7f7701570fb745c3d6360d500f97bdf1b25 (diff)
parent1072867dfac0df993cbd3e44bcc11a5cac7465fd (diff)
Merge "Enabling Code Formatter"
-rw-r--r--ONAP-Java-Code-Style.xml343
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt38
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt54
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt6
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt36
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml37
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt3
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/Check.kt (renamed from components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt)0
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt2
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt79
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ConfigCollector.kt (renamed from components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt)12
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/PortSpeedRAProcessor.kt (renamed from components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt)5
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt21
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt100
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt20
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.kt6
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt12
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt124
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt4
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt10
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt71
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt16
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt1
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt2
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt5
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt1
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt6
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt5
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt4
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt63
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt1
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt8
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt74
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt1
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt5
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt11
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt30
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt54
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt68
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt7
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt8
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt11
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt7
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt18
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt21
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt90
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt28
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt8
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt26
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt7
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt201
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt23
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt41
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt8
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt121
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt71
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt90
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt45
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt12
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt9
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt16
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt6
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt48
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt42
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt76
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt13
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt8
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt4
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt21
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt21
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt15
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt3
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt91
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt49
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt69
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt19
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt4
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt20
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt16
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java12
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java14
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt55
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt1
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt10
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt11
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt9
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt52
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt57
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt93
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt40
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt57
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt108
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt78
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt14
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt8
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt125
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt98
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt44
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt15
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt36
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt9
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt28
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt126
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt66
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt18
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt91
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt98
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt19
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt118
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt82
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt57
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt37
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt26
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt226
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt29
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt73
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt70
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt21
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt22
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt72
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/NoPublishAuditService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/PublishAuditService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt18
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt25
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt107
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt27
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt1
-rw-r--r--ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCatalogException.kt6
-rw-r--r--ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCodes.kt3
-rw-r--r--ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorLibData.kt14
-rw-r--r--ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorMessageLibConstants.kt1
-rw-r--r--ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/utils/ErrorCatalogUtils.kt1
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt1
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt9
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt30
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt14
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt12
-rwxr-xr-xms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt8
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt1
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java4
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java9
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java4
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java3
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java6
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java6
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java39
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java23
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java4
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java38
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java3
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java8
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java20
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java30
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessageTest.java18
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java17
-rw-r--r--pom.xml89
354 files changed, 3970 insertions, 2637 deletions
diff --git a/ONAP-Java-Code-Style.xml b/ONAP-Java-Code-Style.xml
new file mode 100644
index 000000000..176b0c11e
--- /dev/null
+++ b/ONAP-Java-Code-Style.xml
@@ -0,0 +1,343 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="13">
+ <profile kind="CodeFormatterProfile" name="ONAP_GoogleStyle" version="13">
+ <setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled" />
+ <setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="11" />
+ <setting id="org.eclipse.jdt.core.compiler.compliance" value="11" />
+ <setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error" />
+ <setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error" />
+ <setting id="org.eclipse.jdt.core.compiler.source" value="11" />
+ <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependent" value="1585|-1|1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable.count_dependent" value="1585|-1|1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method.count_dependent" value="1585|-1|1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package.count_dependent" value="1585|-1|1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="1040" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter.count_dependent" value="1040|-1|1040" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type.count_dependent" value="1585|-1|1585" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression.count_dependent" value="16|4|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants.count_dependent" value="16|5|48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_field_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_for_statement" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields.count_dependent" value="16|-1|16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class" value="20" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration.count_dependent" value="16|5|80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count_dependent" value="16|4|48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration.count_dependent" value="16|4|49" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration.count_dependent" value="16|4|48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration.count_dependent" value="16|4|48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration.count_dependent" value="16|4|48" />
+ <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1" />
+ <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2" />
+ <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2" />
+ <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off" />
+ <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on" />
+ <setting id="org.eclipse.jdt.core.formatter.force_if_else_statement_brace" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comment_prefix" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert" />
+ <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120" />
+ <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0" />
+ <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="3" />
+ <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space" />
+ <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4" />
+ <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
+ <setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
+ <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_comment_inline_tags" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation" value="false" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true" />
+ <setting id="org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments" value="false" />
+ </profile>
+</profiles> \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
index fe660f590..61cde0521 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
@@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -30,8 +29,6 @@ import org.springframework.http.HttpMethod
import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class ConfigDeploy : AbstractScriptComponentFunction() {
@@ -53,14 +50,14 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
-
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo::class.java)
log.info("Waiting for 2 minutes until vLB intializes ...")
- //Thread.sleep(120000)
- val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
+ // Thread.sleep(120000)
+ val uri =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
@@ -71,16 +68,18 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
- val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
+ val result: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
print(result)
- basicAuthRestClientProperties.url = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ basicAuthRestClientProperties.url =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ val resultOfGet: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
print(resultOfGet)
- }
- catch (e: Exception) {
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -93,27 +92,36 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
}
class NetconfDeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -123,4 +131,4 @@ class NetconfDeviceInfo {
override fun hashCode(): Int {
return javaClass.hashCode()
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
index b09a432f7..04993cdae 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
@@ -16,12 +16,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
* limitations under the License.
*/
-
import com.fasterxml.jackson.databind.node.ObjectNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -31,10 +28,6 @@ import org.springframework.http.HttpMethod
import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentRemoteScriptExecutor
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class HealthCheck : AbstractScriptComponentFunction() {
@@ -50,47 +43,45 @@ open class HealthCheck : AbstractScriptComponentFunction() {
val resolution_key = getDynamicProperties("resolution-key").asText()
log.info("resolution_key: $resolution_key")
- //val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
- //log.info("configuration: $payload")
-
- //val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
- //val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
+ // val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
+ // log.info("configuration: $payload")
+ // val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
+ // val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo2::class.java)
- //log.info("Waiting for 2 minutes until vLB intializes ...")
- //Thread.sleep(120000)
+ // log.info("Waiting for 2 minutes until vLB intializes ...")
+ // Thread.sleep(120000)
val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/operational/health-vnf-onap-plugin:health-vnf-onap-plugin-state/health-check"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
mapOfHeaders.put("Content-Type", "application/json")
- //mapOfHeaders.put("cache-control", " no-cache")
- //mapOfHeaders.put("Accept", "application/json")
+ // mapOfHeaders.put("cache-control", " no-cache")
+ // mapOfHeaders.put("Accept", "application/json")
val basicAuthRestClientProperties: BasicAuthRestClientProperties = BasicAuthRestClientProperties()
basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
log.info(result.body)
val resultJson = JacksonUtils.jsonNode(result.body) as ObjectNode
val health: String = resultJson.get("health-check").get("state").asText()
- super.setAttribute("response-data", resultJson)
+ super.setAttribute("response-data", resultJson)
if (health != "healthy") {
throw Exception("VNF is not healty!!")
}
-
- //basicAuthRestClientProperties.url = //"http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- //val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
- //print(resultOfGet)
- }
- catch (e: Exception) {
+
+ // basicAuthRestClientProperties.url = //"http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ // val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ // print(resultOfGet)
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -103,27 +94,36 @@ open class HealthCheck : AbstractScriptComponentFunction() {
}
class NetconfDeviceInfo2 {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -133,4 +133,4 @@ class NetconfDeviceInfo2 {
override fun hashCode(): Int {
return javaClass.hashCode()
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt
index ef0876f96..f8ef7f804 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt
@@ -39,9 +39,9 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val resolution_key = getDynamicProperties("resolution-key").asText()
- log.info("resolution_key: $resolution_key"\n)
+ log.info("resolution_key: $resolution_key"\ n)
val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
- log.info("configuration: \n$payload"\n)
+ log.info("configuration: \n$payload"\ n)
log.info("Waiting 1 minute and 30 seconds or vLB to initialize ...")
Thread.sleep(90000)
val netconf_device = netconfDevice("netconf-connection")
@@ -58,8 +58,6 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
//var payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
//var vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
netconf_session.disconnect()
-
-
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
index 578492f33..91b985040 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
@@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -30,8 +29,6 @@ import org.springframework.http.HttpMethod
import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class ConfigDeploy : AbstractScriptComponentFunction() {
@@ -53,14 +50,14 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
-
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo::class.java)
log.info("Waiting for 2 minutes until vLB intializes ...")
Thread.sleep(120000)
- val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
+ val uri =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
@@ -71,16 +68,18 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
- val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
+ val result: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
print(result)
- basicAuthRestClientProperties.url = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ basicAuthRestClientProperties.url =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ val resultOfGet: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
print(resultOfGet)
- }
- catch (e: Exception) {
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -93,27 +92,36 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
}
class NetconfDeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -123,4 +131,4 @@ class NetconfDeviceInfo {
override fun hashCode(): Int {
return javaClass.hashCode()
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml b/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml
index f39ded7e5..a737ed3e1 100644
--- a/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml
+++ b/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml
@@ -89,43 +89,6 @@
</resources>
<plugins>
<plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>validate-kotlin</id>
- <phase>validate</phase>
- <configuration>
- <target name="ktlint">
- <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
- <arg value="Scripts/kotlin/**/*.kt"/>
- </java>
- </target>
- <skip>${format.skipValidate}</skip>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <!-- Built-in formatter So that you wouldn't have to fix all style violations by hand.-->
- <id>format-kotlin</id>
- <phase>process-sources</phase>
- <configuration>
- <target name="ktlint">
- <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
- <arg value="-F"/>
- <arg value="Scripts/kotlin/**/*.kt"/>
- </java>
- </target>
- <skip>${format.skipExecute}</skip>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
index 698bf330f..d09244868 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
@@ -73,7 +73,8 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() =
}
}
artifact(
- id = "command-template", type = "artifact-template-velocity",
+ id = "command-template",
+ type = "artifact-template-velocity",
file = "Templates/check-command-template.vtl"
)
}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/Check.kt
index e29055634..e29055634 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/Check.kt
diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt
index a0ca1676e..ee99b04f9 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt
@@ -59,4 +59,4 @@ val deviceResourceDefinitions = BluePrintTypes.resourceDefinitions {
}
}
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt
index 61783d62f..4e66a05c4 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt
@@ -29,55 +29,64 @@ import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions
class ResourceAuditDefinitions : AbstractBluePrintDefinitions() {
+
override fun serviceTemplate(): ServiceTemplate {
return defaultServiceTemplate()
}
}
fun ResourceAuditDefinitions.defaultServiceTemplate() =
- serviceTemplate(name = "resource-audit",
- version = "1.0.0",
- author = "Brinda Santh Muthuramalingam",
- tags = "brinda, tosca") {
+ serviceTemplate(
+ name = "resource-audit",
+ version = "1.0.0",
+ author = "Brinda Santh Muthuramalingam",
+ tags = "brinda, tosca"
+ ) {
- topologyTemplate {
+ topologyTemplate {
- workflow(id = "config-collect", description = "Collect the configuration for Device") {
- inputs {
- property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "")
- property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") {
- entrySchema(BluePrintConstants.DATA_TYPE_STRING)
- }
+ workflow(id = "config-collect", description = "Collect the configuration for Device") {
+ inputs {
+ property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "")
+ property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") {
+ entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- outputs {
- property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
- value(getNodeTemplateAttribute(nodeTemplateId = "config-collector",
- attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA))
- }
- property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
- value(BluePrintConstants.STATUS_SUCCESS)
- }
+ }
+ outputs {
+ property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
+ value(
+ getNodeTemplateAttribute(
+ nodeTemplateId = "config-collector",
+ attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA
+ )
+ )
+ }
+ property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
+ value(BluePrintConstants.STATUS_SUCCESS)
}
- step(id = "config-collector", target = "config-collector", description = "Collect the Configuration")
}
+ step(id = "config-collector", target = "config-collector", description = "Collect the Configuration")
+ }
- val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(
- id = "config-collector", description = "Config collector component") {
+ val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(
+ id = "config-collector",
+ description = "Config collector component"
+ ) {
- definedOperation(description = "Config Collector Operation") {
- inputs {
- type(BluePrintConstants.SCRIPT_KOTLIN)
- scriptClassReference("cba.resource.audit.functions.ConfigCollector")
- }
- outputs {
- status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS))
- responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA))
- }
+ definedOperation(description = "Config Collector Operation") {
+ inputs {
+ type(BluePrintConstants.SCRIPT_KOTLIN)
+ scriptClassReference("cba.resource.audit.functions.ConfigCollector")
+ }
+ outputs {
+ status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS))
+ responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA))
}
}
- nodeTemplate(configCollectorComponent)
}
+ nodeTemplate(configCollectorComponent)
+ }
- nodeType(BluePrintTypes.nodeTypeComponent())
- nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())
- } \ No newline at end of file
+ nodeType(BluePrintTypes.nodeTypeComponent())
+ nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())
+ }
diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ConfigCollector.kt
index 49d0c7348..7ae27dacc 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ConfigCollector.kt
@@ -44,13 +44,15 @@ class ConfigCollector : AbstractScriptComponentFunction() {
// Set the Attributes
setAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive())
- setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, """{
+ setAttribute(
+ ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA,
+ """{
"port-speed" : "10MBS"
- }""".trimIndent().jsonAsJsonType())
-
+ }
+ """.trimIndent().jsonAsJsonType()
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
-
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/PortSpeedRAProcessor.kt
index 660f5918b..453c42933 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/PortSpeedRAProcessor.kt
@@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
class PortSpeedRAProcessor : ResourceAssignmentProcessor() {
+
val log = logger(PortSpeedRAProcessor::class)
override fun getName(): String {
return "PortSpeedRAProcessor"
@@ -31,6 +32,6 @@ class PortSpeedRAProcessor : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt
index 730565959..154792873 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt
+++ b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt
@@ -16,10 +16,8 @@
* ============LICENSE_END=========================================================
*/
-
package cba.pnf.config.aai
-
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.contentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
@@ -35,6 +33,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService.WebClientResponse
class RestconfConfigDeploy : AbstractScriptComponentFunction() {
+
private val CONFIGLET_TEMPLATE_NAME = "config-assign"
private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist"
private val RESTCONF_SERVER_IDENTIFIER = "sdnc"
@@ -57,13 +56,15 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() {
log.debug("Mounting Device : $deviceID")
restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json"))
- //Log the current configuration for the subtree
+ // Log the current configuration for the subtree
val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH)
log.info("Current configuration subtree : $currentConfig")
- //Apply configlet
- val result = restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
- storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
- mutableMapOf("Content-Type" to "application/yang.patch+json")) as WebClientResponse<*>
+ // Apply configlet
+ val result = restconfApplyDeviceConfig(
+ webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
+ storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
+ mutableMapOf("Content-Type" to "application/yang.patch+json")
+ ) as WebClientResponse<*>
val jsonResult = mapper.readTree((result.body).toString())
@@ -72,11 +73,10 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() {
} else {
log.info("Device has been configured succesfully")
}
-
} catch (err: Exception) {
log.error("an error occurred while configuring device {}", err)
} finally {
- //Un mount device
+ // Un mount device
restconfUnMountDevice(webclientService, deviceID, "")
}
} catch (bpe: BluePrintProcessorException) {
@@ -84,10 +84,9 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() {
}
}
-
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Recover function called!")
log.info("Execution request : $executionRequest")
log.error("Exception", runtimeException)
}
-} \ No newline at end of file
+}
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt
index 0540efe80..e238c3e25 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt
+++ b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt
@@ -16,7 +16,6 @@
* ============LICENSE_END=========================================================
*/
-
package cba.pnf.swug
import com.fasterxml.jackson.databind.node.ObjectNode
@@ -45,10 +44,12 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
// Extract request properties
- val model= validatedPayload(executionRequest)
+ val model = validatedPayload(executionRequest)
- log.info("Blueprint invoked for ${model.resolutionKey} for SW Upgrade : " +
- "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.deviceId}")
+ log.info(
+ "Blueprint invoked for ${model.resolutionKey} for SW Upgrade : " +
+ "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.deviceId}"
+ )
try {
val mountPayload = contentFromResolvedArtifactNB("mount-node")
@@ -62,7 +63,6 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
Action.POST_CHECK -> processPostCheck(model)
Action.CANCEL -> processCancel(model)
}
-
} catch (err: Exception) {
log.error("an error occurred while configuring device {}", err)
} finally {
@@ -72,62 +72,72 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
private fun validatedPayload(executionRequest: ExecutionServiceInput): SoftwareUpgradeModel {
val properties = requestPayloadActionProperty(executionRequest.actionIdentifiers.actionName + "-properties")!!.get(0)
- if(!properties?.get("pnf-id")?.textValue().isNullOrEmpty() &&
- !properties?.get("target-software-version")?.textValue().isNullOrEmpty()) {
- return SoftwareUpgradeModel(getDynamicProperties("resolution-key").asText(),
+ if (!properties?.get("pnf-id")?.textValue().isNullOrEmpty() &&
+ !properties?.get("target-software-version")?.textValue().isNullOrEmpty()
+ ) {
+ return SoftwareUpgradeModel(
+ getDynamicProperties("resolution-key").asText(),
BluePrintDependencyService.restClientService(RESTCONF_SERVER_IDENTIFIER),
properties.get("pnf-id").textValue(), properties.get("target-software-version").textValue(),
- Action.getEnumFromActionName(executionRequest.actionIdentifiers.actionName))
- }else{
+ Action.getEnumFromActionName(executionRequest.actionIdentifiers.actionName)
+ )
+ } else {
throw BluePrintException("Invalid parameters sent to CDS. Request parameters pnf-id or target-software-version missing")
}
}
private suspend fun processPreCheck(model: SoftwareUpgradeModel) {
log.debug("In PNF SW upgrade : processPreCheck")
- //Log the current configuration for the subtree
+ // Log the current configuration for the subtree
val payloadObject = getCurrentConfig(model)
- log.debug("Current sw version on pnf : ${payloadObject.get("software-upgrade")?.get("upgrade-package")?.get(0)?.get("software-version")?.asText()}")
+ log.debug(
+ "Current sw version on pnf : ${
+ payloadObject.get("software-upgrade")?.get("upgrade-package")?.get(0)?.get("software-version")?.asText()
+ }"
+ )
log.info("PNF is Healthy!")
}
private suspend fun processDownloadNESw(model: SoftwareUpgradeModel) {
log.debug("In PNF SW upgrade : processDownloadNESw")
- //Check if there is existing config for the targeted software version
+ // Check if there is existing config for the targeted software version
var downloadConfigPayload: String
if (checkIfSwReadyToPerformAction(Action.PRE_CHECK, model)) {
downloadConfigPayload = contentFromResolvedArtifactNB("configure")
- downloadConfigPayload =downloadConfigPayload.replace("%id%", model.yangId)
- }
- else {
+ downloadConfigPayload = downloadConfigPayload.replace("%id%", model.yangId)
+ } else {
downloadConfigPayload = contentFromResolvedArtifactNB("download-ne-sw")
- model.yangId=model.targetSwVersion
+ model.yangId = model.targetSwVersion
}
downloadConfigPayload = downloadConfigPayload.replace("%actionName%", Action.DOWNLOAD_NE_SW.name)
log.info("Config Payload to start download : $downloadConfigPayload")
- //Apply configlet
- restconfApplyDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, downloadConfigPayload,
- mutableMapOf("Content-Type" to "application/yang.patch+json"))
+ // Apply configlet
+ restconfApplyDeviceConfig(
+ model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, downloadConfigPayload,
+ mutableMapOf("Content-Type" to "application/yang.patch+json")
+ )
- //Poll PNF for Download action's progress
+ // Poll PNF for Download action's progress
checkExecution(model)
}
private suspend fun processActivateNESw(model: SoftwareUpgradeModel) {
log.debug("In PNF SW upgrade : processActivateNESw")
- //Check if the software is downloaded and ready to be activated
+ // Check if the software is downloaded and ready to be activated
if (checkIfSwReadyToPerformAction(Action.DOWNLOAD_NE_SW, model)) {
var activateConfigPayload: String = contentFromResolvedArtifactNB("configure")
activateConfigPayload = activateConfigPayload.replace("%actionName%", Action.ACTIVATE_NE_SW.name)
activateConfigPayload = activateConfigPayload.replace("%id%", model.yangId)
log.info("Config Payload to start activate : $activateConfigPayload")
- //Apply configlet
- restconfApplyDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, activateConfigPayload,
- mutableMapOf("Content-Type" to "application/yang.patch+json"))
+ // Apply configlet
+ restconfApplyDeviceConfig(
+ model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, activateConfigPayload,
+ mutableMapOf("Content-Type" to "application/yang.patch+json")
+ )
- //Poll PNF for Activate action's progress
+ // Poll PNF for Activate action's progress
checkExecution(model)
} else {
throw BluePrintRetryException("Software Download not completed for device(${model.deviceId}) to activate sw version: ${model.targetSwVersion}")
@@ -136,21 +146,23 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
private suspend fun processPostCheck(model: SoftwareUpgradeModel) {
log.info("In PNF SW upgrade : processPostCheck")
- //Log the current configuration for the subtree
+ // Log the current configuration for the subtree
if (checkIfSwReadyToPerformAction(Action.POST_CHECK, model)) {
log.info("PNF is healthy post activation!")
}
}
- private fun processCancel(model :SoftwareUpgradeModel) {
- //This is for future implementation of cancel step during software upgrade
+ private fun processCancel(model: SoftwareUpgradeModel) {
+ // This is for future implementation of cancel step during software upgrade
log.info("In PNF SW upgrade : processCancel")
}
- private suspend fun getCurrentConfig(model: SoftwareUpgradeModel) : ObjectNode{
- val currentConfig: BlueprintWebClientService.WebClientResponse<String> = restconfDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH)
+ private suspend fun getCurrentConfig(model: SoftwareUpgradeModel): ObjectNode {
+ val currentConfig: BlueprintWebClientService.WebClientResponse<String> =
+ restconfDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH)
return JacksonUtils.jsonNode(currentConfig.body) as ObjectNode
}
+
private suspend fun checkExecution(model: SoftwareUpgradeModel) {
val checkExecutionBlock: suspend (Int) -> String = {
val result = restconfDeviceConfig(model.client, model.deviceId, TARGET_SOFTWARE_PATH.plus(model.yangId))
@@ -162,15 +174,15 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
}
}
model.client.retry<String>(10, 0, 1000, checkExecutionBlock)
-
}
- private suspend fun checkIfSwReadyToPerformAction(action : Action, model: SoftwareUpgradeModel): Boolean {
+ private suspend fun checkIfSwReadyToPerformAction(action: Action, model: SoftwareUpgradeModel): Boolean {
val configBody = getCurrentConfig(model)
configBody.get("software-upgrade")?.get("upgrade-package")?.iterator()?.forEach { item ->
if (model.targetSwVersion == item.get("software-version")?.asText() &&
- action.completionStatus == item?.get("current-status")?.asText()) {
- model.yangId= item.get("id").textValue()
+ action.completionStatus == item?.get("current-status")?.asText()
+ ) {
+ model.yangId = item.get("id").textValue()
return true
}
}
@@ -191,15 +203,23 @@ enum class Action(val actionName: String, val completionStatus: String) {
POST_CHECK("postCheck", "ACTIVATION_COMPLETED"),
CANCEL("cancel", "CANCELLED")
;
- companion object{
+
+ companion object {
+
fun getEnumFromActionName(name: String): Action {
- for(value in values()){
- if (value.actionName==name) return value
+ for (value in values()) {
+ if (value.actionName == name) return value
}
throw BluePrintException("Invalid Action sent to CDS")
}
}
}
-data class SoftwareUpgradeModel(val resolutionKey: String, val client: BlueprintWebClientService, val deviceId: String,
- val targetSwVersion: String, val action: Action, var yangId: String = "") \ No newline at end of file
+data class SoftwareUpgradeModel(
+ val resolutionKey: String,
+ val client: BlueprintWebClientService,
+ val deviceId: String,
+ val targetSwVersion: String,
+ val action: Action,
+ var yangId: String = ""
+)
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt
index a2372c9db..264f4f725 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt
@@ -16,7 +16,6 @@
* ============LICENSE_END=========================================================
*/
-
package cba.pnf.config
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
@@ -32,6 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.logger
class RestconfConfigDeploy : AbstractScriptComponentFunction() {
+
private val CONFIGLET_TEMPLATE_NAME = "config-assign"
private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist"
private val RESTCONF_SERVER_IDENTIFIER = "sdnc"
@@ -53,18 +53,19 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() {
log.debug("Mounting Device : $deviceID")
restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json"))
- //Log the current configuration for the subtree
+ // Log the current configuration for the subtree
val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH)
log.info("Current configuration subtree : $currentConfig")
- //Apply configlet
- restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
- storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
- mutableMapOf("Content-Type" to "application/yang.patch+json"))
-
+ // Apply configlet
+ restconfApplyDeviceConfig(
+ webclientService, deviceID, CONFIGLET_RESOURCE_PATH,
+ storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME),
+ mutableMapOf("Content-Type" to "application/yang.patch+json")
+ )
} catch (err: Exception) {
log.error("an error occurred while configuring device {}", err)
} finally {
- //Un mount device
+ // Un mount device
restconfUnMountDevice(webclientService, deviceID, "")
}
} catch (bpe: BluePrintProcessorException) {
@@ -72,10 +73,9 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() {
}
}
-
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Recover function called!")
log.info("Execution request : $executionRequest")
log.error("Exception", runtimeException)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
index e9557aed9..f5ccdee18 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.error.catalog"],
+ basePackages = [
+ "org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.error.catalog"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.kt
index 97b7d28b0..e576877e3 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.kt
@@ -31,8 +31,10 @@ import org.springframework.context.annotation.ComponentScan
@SpringBootApplication
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class, HazelcastAutoConfiguration::class])
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog",
- "org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"]
+ basePackages = [
+ "org.onap.ccsdk.cds.error.catalog",
+ "org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"
+ ]
)
open class BlueprintProcessorApplication
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorExceptionHandler.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorExceptionHandler.kt
index f241e3f42..598300f47 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorExceptionHandler.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorExceptionHandler.kt
@@ -22,4 +22,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
@RestControllerAdvice("org.onap.ccsdk.cds")
open class BlueprintProcessorExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
index 8fcffbf06..c795ee5fb 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component
*/
@Component
open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) :
- AbstractHealthIndicator() {
+ AbstractHealthIndicator() {
private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt
index f8e6bd486..5b3843a31 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt
@@ -59,6 +59,7 @@ class MockInvocationLogger(private val marker: Marker) : InvocationListener {
}
companion object {
+
private const val INDENT = " "
private val log = LoggerFactory.getLogger(MockInvocationLogger::class.java)
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt
index 6c5759155..b77caebcb 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
internal class PathDeserializer : StdDeserializer<String>(String::class.java) {
+
override fun deserialize(jp: JsonParser, ctxt: DeserializationContext?): String {
val path = jp.codec.readValue(jp, Any::class.java)
return flatJoin(path)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt
index 0f98d7213..ca60bb3b3 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt
@@ -23,6 +23,7 @@ import com.google.common.collect.Maps
import org.mockito.ArgumentMatcher
class RequiredMapEntriesMatcher<K, V>(private val requiredEntries: Map<K, V>) : ArgumentMatcher<Map<K, V>> {
+
override fun matches(argument: Map<K, V>?): Boolean {
val missingEntries = Maps.difference(requiredEntries, argument).entriesOnlyOnLeft()
return missingEntries.isEmpty()
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt
index 17b79f588..d5bf3f4c6 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt
@@ -47,9 +47,14 @@ data class RequestDefinition(
)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class ResponseDefinition(val status: Int = 200, val body: JsonNode? = null, val headers: Map<String, String> = mapOf("Content-Type" to "application/json")) {
+data class ResponseDefinition(
+ val status: Int = 200,
+ val body: JsonNode? = null,
+ val headers: Map<String, String> = mapOf("Content-Type" to "application/json")
+) {
companion object {
+
val DEFAULT_RESPONSES = listOf(ResponseDefinition())
}
}
@@ -61,9 +66,11 @@ class ExpectationDefinition(
responses: List<ResponseDefinition>? = null,
val times: String = ">= 1"
) {
+
val responses: List<ResponseDefinition> = resolveOneOrMany(response, responses, ResponseDefinition.DEFAULT_RESPONSES)
companion object {
+
fun <T> resolveOneOrMany(one: T?, many: List<T>?, defaultMany: List<T>): List<T> = when {
many != null -> many
one != null -> listOf(one)
@@ -108,7 +115,8 @@ data class UatDefinition(
}
companion object {
+
fun load(mapper: ObjectMapper, spec: String): UatDefinition =
- mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
+ mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
index d120e71d6..7d0c8751d 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
@@ -78,6 +78,7 @@ class UatExecutor(
) {
companion object {
+
private const val NOOP_PASSWORD_PREFIX = "{noop}"
private const val PROPERTY_IN_UAT = "IN_UAT"
private val TIMES_SPEC_REGEX = "([<>]=?)?\\s*(\\d+)".toRegex()
@@ -106,8 +107,8 @@ class UatExecutor(
fun execute(uat: UatDefinition, cbaBytes: ByteArray): UatDefinition {
val defaultHeaders = listOf(BasicHeader(HttpHeaders.AUTHORIZATION, clientAuthToken()))
val httpClient = HttpClientBuilder.create()
- .setDefaultHeaders(defaultHeaders)
- .build()
+ .setDefaultHeaders(defaultHeaders)
+ .build()
// Only if externalServices are defined
val mockInterceptor = MockPreInterceptor()
// Always defined and used, whatever the case
@@ -117,13 +118,13 @@ class UatExecutor(
markUatBegin()
// Configure mocked external services and save their expectations for further validation
val expectationsPerClient = uat.externalServices.associateBy(
- { service ->
- createRestClientMock(service.expectations).also { restClient ->
- // side-effect: register restClient to override real instance
- mockInterceptor.registerMock(service.selector, restClient)
- }
- },
- { service -> service.expectations }
+ { service ->
+ createRestClientMock(service.expectations).also { restClient ->
+ // side-effect: register restClient to override real instance
+ mockInterceptor.registerMock(service.selector, restClient)
+ }
+ },
+ { service -> service.expectations }
)
val newProcesses = httpClient.use { client ->
@@ -134,14 +135,14 @@ class UatExecutor(
log.info("Executing process '${process.name}'")
val responseNormalizer = JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec)
val actualResponse = processBlueprint(
- client, process.request,
- process.expectedResponse, responseNormalizer
+ client, process.request,
+ process.expectedResponse, responseNormalizer
)
ProcessDefinition(
- process.name,
- process.request,
- actualResponse,
- process.responseNormalizerSpec
+ process.name,
+ process.request,
+ actualResponse,
+ process.responseNormalizerSpec
)
}
}
@@ -151,10 +152,10 @@ class UatExecutor(
expectations.forEach { expectation ->
val request = expectation.request
verify(mockClient, evalVerificationMode(expectation.times)).exchangeResource(
- eq(request.method),
- eq(request.path),
- argThat { assertJsonEquals(request.body, this) },
- argThat(RequiredMapEntriesMatcher(request.headers))
+ eq(request.method),
+ eq(request.path),
+ argThat { assertJsonEquals(request.body, this) },
+ argThat(RequiredMapEntriesMatcher(request.headers))
)
}
// Don't mind the invocations to the overloaded exchangeResource(String, String, String)
@@ -163,7 +164,7 @@ class UatExecutor(
}
val newExternalServices = spyInterceptor.getSpies()
- .map(SpyService::asServiceDefinition)
+ .map(SpyService::asServiceDefinition)
return UatDefinition(newProcesses, newExternalServices)
} finally {
@@ -181,43 +182,43 @@ class UatExecutor(
}
private fun createRestClientMock(restExpectations: List<ExpectationDefinition>):
- BlueprintWebClientService {
- val restClient = mock<BlueprintWebClientService>(
+ BlueprintWebClientService {
+ val restClient = mock<BlueprintWebClientService>(
defaultAnswer = Answers.RETURNS_SMART_NULLS,
// our custom verboseLogging handler
invocationListeners = arrayOf(mockLoggingListener)
- )
+ )
- // Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
- whenever(restClient.exchangeResource(any(), any(), any()))
+ // Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
+ whenever(restClient.exchangeResource(any(), any(), any()))
.thenAnswer { invocation ->
val method = invocation.arguments[0] as String
val path = invocation.arguments[1] as String
val request = invocation.arguments[2] as String
restClient.exchangeResource(method, path, request, emptyMap())
}
- for (expectation in restExpectations) {
- var stubbing = whenever(
+ for (expectation in restExpectations) {
+ var stubbing = whenever(
restClient.exchangeResource(
- eq(expectation.request.method),
- eq(expectation.request.path),
- any(),
- any()
+ eq(expectation.request.method),
+ eq(expectation.request.path),
+ any(),
+ any()
)
- )
- for (response in expectation.responses) {
- stubbing = stubbing.thenReturn(WebClientResponse(response.status, response.body.toString()))
+ )
+ for (response in expectation.responses) {
+ stubbing = stubbing.thenReturn(WebClientResponse(response.status, response.body.toString()))
+ }
}
+ return restClient
}
- return restClient
- }
@Throws(AssertionError::class)
private fun uploadBlueprint(client: HttpClient, cbaBytes: ByteArray) {
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .build()
val request = HttpPost("$baseUrl/api/v1/blueprint-model/publish").apply {
entity = multipartEntity
}
@@ -254,7 +255,8 @@ class UatExecutor(
private fun evalVerificationMode(times: String): VerificationMode {
val matchResult = TIMES_SPEC_REGEX.matchEntire(times) ?: throw InvalidUatDefinition(
- "Time specification '$times' does not follow expected format $TIMES_SPEC_REGEX")
+ "Time specification '$times' does not follow expected format $TIMES_SPEC_REGEX"
+ )
val counter = matchResult.groups[2]!!.value.toInt()
return when (matchResult.groups[1]?.value) {
">=" -> atLeast(counter)
@@ -278,21 +280,25 @@ class UatExecutor(
}
private fun localServerPort(): Int =
- (environment.getProperty("local.server.port")
- ?: environment.getRequiredProperty("blueprint.httpPort")).toInt()
+ (
+ environment.getProperty("local.server.port")
+ ?: environment.getRequiredProperty("blueprint.httpPort")
+ ).toInt()
private fun clientAuthToken(): String {
val username = environment.getRequiredProperty("security.user.name")
val password = environment.getRequiredProperty("security.user.password")
val plainPassword = when {
password.startsWith(NOOP_PASSWORD_PREFIX) -> password.substring(
- NOOP_PASSWORD_PREFIX.length)
+ NOOP_PASSWORD_PREFIX.length
+ )
else -> username
}
return "Basic " + Base64Utils.encodeToString("$username:$plainPassword".toByteArray())
}
private class MockPreInterceptor : BluePrintRestLibPropertyService.PreInterceptor {
+
private val mocks = ConcurrentHashMap<String, BlueprintWebClientService>()
override fun getInstance(jsonNode: JsonNode): BlueprintWebClientService? {
@@ -300,7 +306,7 @@ class UatExecutor(
}
override fun getInstance(selector: String): BlueprintWebClientService? =
- mocks[selector]
+ mocks[selector]
fun registerMock(selector: String, client: BlueprintWebClientService) {
mocks[selector] = client
@@ -322,7 +328,7 @@ class UatExecutor(
}
fun getSpies(): List<SpyService> =
- spies.values.toList()
+ spies.values.toList()
}
private class SpyService(
@@ -330,14 +336,15 @@ class UatExecutor(
val selector: String,
private val realService: BlueprintWebClientService
) :
- BlueprintWebClientService by realService {
+ BlueprintWebClientService by realService {
private val expectations: MutableList<ExpectationDefinition> = mutableListOf()
override fun exchangeResource(methodType: String, path: String, request: String): WebClientResponse<String> =
- exchangeResource(methodType, path, request,
- DEFAULT_HEADERS
- )
+ exchangeResource(
+ methodType, path, request,
+ DEFAULT_HEADERS
+ )
override fun exchangeResource(
methodType: String,
@@ -346,7 +353,7 @@ class UatExecutor(
headers: Map<String, String>
): WebClientResponse<String> {
val requestDefinition =
- RequestDefinition(methodType, path, headers, toJson(request))
+ RequestDefinition(methodType, path, headers, toJson(request))
val realAnswer = realService.exchangeResource(methodType, path, request, headers)
val responseBody = when {
// TODO: confirm if we need to normalize the response here
@@ -354,12 +361,12 @@ class UatExecutor(
else -> null
}
val responseDefinition =
- ResponseDefinition(realAnswer.status, responseBody)
+ ResponseDefinition(realAnswer.status, responseBody)
expectations.add(
- ExpectationDefinition(
- requestDefinition,
- responseDefinition
- )
+ ExpectationDefinition(
+ requestDefinition,
+ responseDefinition
+ )
)
return realAnswer
}
@@ -369,7 +376,7 @@ class UatExecutor(
}
fun asServiceDefinition() =
- ServiceDefinition(selector, expectations)
+ ServiceDefinition(selector, expectations)
private fun toJson(str: String): JsonNode? {
return when {
@@ -379,9 +386,10 @@ class UatExecutor(
}
companion object {
+
private val DEFAULT_HEADERS = mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
+ HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+ HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
)
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt
index f40b903de..f6dd88dd5 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt
@@ -87,7 +87,8 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
val uat = UatDefinition.load(mapper, uatSpec)
val cbaBytes = tempFile.readBytes()
val updatedUat = uatExecutor.execute(uat, cbaBytes)
- return@runBlocking updatedUat.dump(mapper,
+ return@runBlocking updatedUat.dump(
+ mapper,
FIELDS_TO_EXCLUDE
)
} catch (t: Throwable) {
@@ -119,6 +120,7 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
}
companion object {
+
// Fields that can be safely ignored from BPP response, and can be omitted on the UAT specification.
private val FIELDS_TO_EXCLUDE = listOf("timestamp")
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
index 7f38608c9..41e997b88 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
@@ -55,6 +55,7 @@ abstract class BaseUatTest {
}
companion object {
+
const val UAT_BLUEPRINTS_BASE_DIR = "../../../components/model-catalog/blueprint-model/uat-blueprints"
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index ff7cd78c0..4a8da536f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -58,9 +58,11 @@ class BlueprintsAcceptanceTest(
@Parameterized.Parameters(name = "{index} {0}")
@JvmStatic
fun scanUatEmpoweredBlueprints(): List<Array<Any>> {
- return (File(UAT_BLUEPRINTS_BASE_DIR)
- .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
- ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
+ return (
+ File(UAT_BLUEPRINTS_BASE_DIR)
+ .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
+ ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR")
+ )
.map { file ->
arrayOf(
file.nameWithoutExtension,
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
index c9d55c18a..33e795728 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
index 4e7d4ce40..fe2d539e3 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
@@ -74,6 +74,7 @@ fun String.prefixIfNot(prefix: String) =
class UatServicesTest : BaseUatTest() {
companion object {
+
private const val BLUEPRINT_NAME = "pnf_config"
private val BLUEPRINT_BASE_DIR = Paths.get(UAT_BLUEPRINTS_BASE_DIR, BLUEPRINT_NAME)
private val UAT_PATH = BLUEPRINT_BASE_DIR.resolve(UAT_SPECIFICATION_FILE)
@@ -223,11 +224,14 @@ class UatServicesTest : BaseUatTest() {
for (response in expectation.responses) {
val responseDefinitionBuilder: ResponseDefinitionBuilder = aResponse()
- .withStatus(response.status)
+ .withStatus(response.status)
if (response.body != null) {
responseDefinitionBuilder.withBody(mapper.writeValueAsBytes(response.body))
- .withHeaders(HttpHeaders(
- response.headers.entries.map { e -> HttpHeader(e.key, e.value) }))
+ .withHeaders(
+ HttpHeaders(
+ response.headers.entries.map { e -> HttpHeader(e.key, e.value) }
+ )
+ )
}
// TODO: MockServer verification for multiple responses should be done using Wiremock scenarios
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
index 4f7ef0ec2..f00eb9d5f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/error/ErrorCatalogServiceTest.kt
@@ -35,10 +35,11 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [ErrorCatalogTestConfiguration::class]
+ classes = [ErrorCatalogTestConfiguration::class]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ErrorCatalogServiceTest {
+
@Autowired
lateinit var errorCatalogService: ErrorCatalogService
@@ -52,46 +53,74 @@ class ErrorCatalogServiceTest {
@BeforeTest
fun setup() {
errorType = ErrorCatalogCodes.GENERIC_FAILURE
- errorCatalogHttp = ErrorCatalog(errorType, domain, 500,
- "Contact CDS administrator team.", "Internal error in Blueprint Processor run time.")
- errorCatalogGrpc = ErrorCatalog(errorType, domain, 2,
- "Contact CDS administrator team.", "Internal error in Blueprint Processor run time.")
+ errorCatalogHttp = ErrorCatalog(
+ errorType, domain, 500,
+ "Contact CDS administrator team.", "Internal error in Blueprint Processor run time."
+ )
+ errorCatalogGrpc = ErrorCatalog(
+ errorType, domain, 2,
+ "Contact CDS administrator team.", "Internal error in Blueprint Processor run time."
+ )
- errorPayloadHttp = ErrorPayload(500, ErrorCatalogCodes.GENERIC_FAILURE,
- "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
- errorMessage = ErrorMessage("org.onap.ccsdk.cds.blueprintsprocessor",
- "Internal error in Blueprint Processor run time.", ""))
- errorPayloadGrpc = ErrorPayload(2, ErrorCatalogCodes.GENERIC_FAILURE,
- "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
- errorMessage = ErrorMessage("org.onap.ccsdk.cds.blueprintsprocessor",
- "Internal error in Blueprint Processor run time.", ""))
+ errorPayloadHttp = ErrorPayload(
+ 500, ErrorCatalogCodes.GENERIC_FAILURE,
+ "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
+ errorMessage = ErrorMessage(
+ "org.onap.ccsdk.cds.blueprintsprocessor",
+ "Internal error in Blueprint Processor run time.", ""
+ )
+ )
+ errorPayloadGrpc = ErrorPayload(
+ 2, ErrorCatalogCodes.GENERIC_FAILURE,
+ "Cause: Internal error in Blueprint Processor run time. \n Action : Contact CDS administrator team.",
+ errorMessage = ErrorMessage(
+ "org.onap.ccsdk.cds.blueprintsprocessor",
+ "Internal error in Blueprint Processor run time.", ""
+ )
+ )
}
@Test
fun errorPayloadHttp() {
- val errorPayload = errorCatalogService.errorPayload(httpProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorPayload = errorCatalogService.errorPayload(
+ httpProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorPayload.isEqualTo(errorPayloadHttp) }
}
@Test
fun errorPayloadGrpc() {
- val errorPayload = errorCatalogService.errorPayload(grpcProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorPayload = errorCatalogService.errorPayload(
+ grpcProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorPayload.isEqualTo(errorPayloadGrpc) }
}
@Test
fun getErrorCatalogHttp() {
- val errorCatalog = errorCatalogService.getErrorCatalog(httpProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorCatalog = errorCatalogService.getErrorCatalog(
+ httpProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorCatalog == errorCatalogHttp }
}
@Test
fun getErrorCatalogGrpc() {
- val errorCatalog = errorCatalogService.getErrorCatalog(grpcProcessorException(errorType, domain,
- "Internal error in Blueprint Processor run time."))
+ val errorCatalog = errorCatalogService.getErrorCatalog(
+ grpcProcessorException(
+ errorType, domain,
+ "Internal error in Blueprint Processor run time."
+ )
+ )
assertTrue { errorCatalog == errorCatalogGrpc }
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
index cad235450..e5d924d36 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
@@ -24,6 +24,7 @@ import ch.qos.logback.core.sift.AbstractDiscriminator
import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.MDC_COLOR_KEY
class SmartColorDiscriminator : AbstractDiscriminator<ILoggingEvent>() {
+
var defaultValue: String = "white"
override fun getKey(): String {
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
index 9090361fb..dd31c0e8f 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/ExtendedTemporaryFolder.kt
@@ -29,6 +29,7 @@ import java.nio.file.attribute.BasicFileAttributes
import javax.annotation.PreDestroy
class ExtendedTemporaryFolder {
+
private val tempFolder = createTempDir("uat")
@PreDestroy
@@ -49,12 +50,15 @@ class ExtendedTemporaryFolder {
* Delete all files under the root temporary folder recursively. The folders are preserved.
*/
fun deleteAllFiles() {
- Files.walkFileTree(tempFolder.toPath(), object : SimpleFileVisitor<Path>() {
- @Throws(IOException::class)
- override fun visitFile(file: Path?, attrs: BasicFileAttributes?): FileVisitResult {
- file?.toFile()?.delete()
- return FileVisitResult.CONTINUE
+ Files.walkFileTree(
+ tempFolder.toPath(),
+ object : SimpleFileVisitor<Path>() {
+ @Throws(IOException::class)
+ override fun visitFile(file: Path?, attrs: BasicFileAttributes?): FileVisitResult {
+ file?.toFile()?.delete()
+ return FileVisitResult.CONTINUE
+ }
}
- })
+ )
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
index e6198b1ba..a4320e654 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt
@@ -38,6 +38,7 @@ class MarkedSlf4jNotifier(private val marker: Marker) : Notifier {
}
companion object {
+
private val log = LoggerFactory.getLogger("uat.WireMock")
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
index 888ab8dcd..eec36c88d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/TestSecuritySettings.kt
@@ -26,6 +26,7 @@ import org.springframework.util.Base64Utils
class TestSecuritySettings {
companion object {
+
private const val authUsername = "walter.white"
private const val authPassword = "Heisenberg"
@@ -34,6 +35,7 @@ class TestSecuritySettings {
}
class ServerContextInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
+
override fun initialize(context: ConfigurableApplicationContext) {
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(
context,
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
index 1e70cdd9e..504757104 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
@@ -69,6 +69,7 @@ open class ComponentRemoteAnsibleExecutor(
var checkDelay: Long = 15_000
companion object {
+
private val log = LoggerFactory.getLogger(ComponentRemoteAnsibleExecutor::class.java)
// input fields names accepted by this executor
@@ -222,7 +223,7 @@ open class ComponentRemoteAnsibleExecutor(
// provide more information via the response, like the ignored_fields, or variables_needed_to_start,
// or resources_needed_to_start, in order to help user pinpoint the problems with the request.
val message = "Execution of job template $job_template_name could not be started for requestId $processId." +
- " (Response: ${response.body}) "
+ " (Response: ${response.body}) "
log.error(message)
setNodeOutputErrors(ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
}
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
index db7128394..c45f5140b 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
@@ -46,6 +46,7 @@ class ComponentRemoteAnsibleExecutorTest {
private val webClientService = mockk<BlueprintWebClientService>()
companion object {
+
private const val jtId = 9
private const val jobId = 223
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
index 50268d39b..3cefa3274 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
@@ -49,10 +49,12 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [CliExecutorConfiguration::class,
+ classes = [
+ CliExecutorConfiguration::class,
ExecutionServiceConfiguration::class,
BluePrintSshLibConfiguration::class, BluePrintScriptsServiceImpl::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class]
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class
+ ]
)
@DirtiesContext
@TestPropertySource(properties = [], locations = ["classpath:application-test.properties"])
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
index 311e95bc2..af3753e1a 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
@@ -56,6 +56,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
AbstractComponentFunction() {
companion object {
+
private val log = LoggerFactory.getLogger(ComponentConfigSnapshotsExecutor::class.java)
// input fields names accepted by this executor
@@ -128,7 +129,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotValue)
} catch (er: NoSuchElementException) {
val message = "No Resource config snapshot identified by resourceId={$resourceId}, " +
- "resourceType={$resourceType} does not exists"
+ "resourceType={$resourceType} does not exists"
setNodeOutputErrors(OUTPUT_STATUS_ERROR, message)
}
}
@@ -217,7 +218,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
val output = StringBuilder()
output.append(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<diff>"
+ "<diff>"
)
val diffIterator = differences.getDifferences().iterator()
while (diffIterator.hasNext()) {
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
index 73c9e22f3..31d84e60d 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
@@ -75,6 +75,7 @@ class ResourceConfigSnapshot : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
index 2383f2c64..06146c200 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
@@ -97,7 +97,7 @@ open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepos
?.let {
log.info(
"Overwriting configuration snapshot entry for resourceId=($resId), " +
- "resourceType=($resType), status=($status)"
+ "resourceType=($resType), status=($status)"
)
resourceConfigSnapshotRepository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
}
@@ -107,8 +107,8 @@ open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepos
storedSnapshot = resourceConfigSnapshotRepository.saveAndFlush(resourceConfigSnapshotEntry)
log.info(
"Stored configuration snapshot for resourceId=($resId), " +
- "resourceType=($resType), status=($status), " +
- "dated=(${storedSnapshot.createdDate})"
+ "resourceType=($resType), status=($status), " +
+ "dated=(${storedSnapshot.createdDate})"
)
} catch (ex: DataIntegrityViolationException) {
throw BluePrintException("Failed to store configuration snapshot entry.", ex)
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
index dab977db0..d00c47b7f 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
@@ -19,13 +19,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
-import org.springframework.http.HttpMethod
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import java.nio.file.Path
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
+import org.springframework.http.HttpMethod
+import java.nio.file.Path
class K8sPluginApi(
val username: String,
@@ -34,6 +34,7 @@ class K8sPluginApi(
val definition: String?,
val definitionVersion: String?
) {
+
private val service: K8sUploadFileRestClientService // BasicAuthRestClientService
private val log = LoggerFactory.getLogger(K8sPluginApi::class.java)!!
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
index 87836428e..c9ddf4846 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
@@ -22,12 +22,16 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
import com.fasterxml.jackson.annotation.JsonProperty
class K8sProfile {
+
@get:JsonProperty("rb-name")
var rbName: String? = null
+
@get:JsonProperty("rb-version")
var rbVersion: String? = null
+
@get:JsonProperty("profile-name")
var profileName: String? = null
+
@get:JsonProperty("namespace")
var namespace: String? = "default"
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
index 337104551..6b575a60a 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
@@ -46,7 +46,6 @@ import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
-import kotlin.collections.ArrayList
@Component("component-k8s-profile-upload")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@@ -58,6 +57,7 @@ open class K8sProfileUploadComponent(
AbstractComponentFunction() {
companion object {
+
const val INPUT_K8S_PROFILE_NAME = "k8s-rb-profile-name"
const val INPUT_K8S_DEFINITION_NAME = "k8s-rb-definition-name"
const val INPUT_K8S_DEFINITION_VERSION = "k8s-rb-definition-version"
@@ -152,8 +152,10 @@ open class K8sProfileUploadComponent(
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, profileSource)
if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
- throw BluePrintProcessorException("Unexpected profile artifact type for profile source " +
- "$profileSource. Expecting: $artifact.type")
+ throw BluePrintProcessorException(
+ "Unexpected profile artifact type for profile source " +
+ "$profileSource. Expecting: $artifact.type"
+ )
var profile = K8sProfile()
profile.profileName = profileName
profile.rbName = definitionName
@@ -197,7 +199,7 @@ open class K8sProfileUploadComponent(
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val bluePrintBasePath: String = bluePrintContext.rootPath
val profileSourceFileFolderPath: String = bluePrintBasePath.plus(File.separator)
- .plus(ks8ProfileLocation)
+ .plus(ks8ProfileLocation)
val profileFilePathTarGz: String = profileSourceFileFolderPath.plus(".tar.gz")
val profileFilePathTgz: String = profileSourceFileFolderPath.plus(".tgz")
@@ -215,26 +217,37 @@ open class K8sProfileUploadComponent(
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = 1
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY] = false
val resolutionResult: Pair<String, JsonNode> = resourceResolutionService.resolveResources(
- bluePrintRuntimeService,
- nodeTemplateName,
- ks8ProfileSource,
- properties)
+ bluePrintRuntimeService,
+ nodeTemplateName,
+ ks8ProfileSource,
+ properties
+ )
val tempMainPath: File = createTempDir("k8s-profile-", "")
val tempProfilePath: File = createTempDir("content-", "", tempMainPath)
try {
- val manifestFiles: ArrayList<File>? = readManifestFiles(Paths.get(profileSourceFileFolderPath).toFile(),
- tempProfilePath)
+ val manifestFiles: ArrayList<File>? = readManifestFiles(
+ Paths.get(profileSourceFileFolderPath).toFile(),
+ tempProfilePath
+ )
if (manifestFiles != null) {
- templateLocation(Paths.get(profileSourceFileFolderPath).toFile(), resolutionResult.second,
- tempProfilePath, manifestFiles)
+ templateLocation(
+ Paths.get(profileSourceFileFolderPath).toFile(), resolutionResult.second,
+ tempProfilePath, manifestFiles
+ )
} else
throw BluePrintProcessorException("Manifest file is missing")
// Preparation of the final profile content
- val finalProfileFilePath = Paths.get(tempMainPath.toString().plus(File.separator).plus(
- "$k8sRbProfileName.tar.gz"))
- if (!BluePrintArchiveUtils.compress(tempProfilePath, finalProfileFilePath.toFile(),
- ArchiveType.TarGz)) {
+ val finalProfileFilePath = Paths.get(
+ tempMainPath.toString().plus(File.separator).plus(
+ "$k8sRbProfileName.tar.gz"
+ )
+ )
+ if (!BluePrintArchiveUtils.compress(
+ tempProfilePath, finalProfileFilePath.toFile(),
+ ArchiveType.TarGz
+ )
+ ) {
throw BluePrintProcessorException("Profile compression has failed")
}
FileUtils.deleteDirectory(tempProfilePath)
@@ -303,8 +316,10 @@ open class K8sProfileUploadComponent(
if (location.extension.toLowerCase() == "vtl") {
templateFile(location, params, destinationFolder, manifestFiles)
} else {
- val finalFilePath = Paths.get(destinationFolder.path.plus(File.separator)
- .plus(location.name)).toFile()
+ val finalFilePath = Paths.get(
+ destinationFolder.path.plus(File.separator)
+ .plus(location.name)
+ ).toFile()
if (isFileInTheManifestFiles(finalFilePath, manifestFiles)) {
if (!destinationFolder.exists())
Files.createDirectories(destinationFolder.toPath())
@@ -328,13 +343,17 @@ open class K8sProfileUploadComponent(
destinationFolder: File,
manifestFiles: ArrayList<File>
) {
- val finalFile = File(destinationFolder.path.plus(File.separator)
- .plus(templatedFile.nameWithoutExtension))
+ val finalFile = File(
+ destinationFolder.path.plus(File.separator)
+ .plus(templatedFile.nameWithoutExtension)
+ )
if (!isFileInTheManifestFiles(finalFile, manifestFiles))
return
val fileContent = templatedFile.bufferedReader().readText()
- val finalFileContent = BluePrintVelocityTemplateService.generateContent(fileContent,
- params, true)
+ val finalFileContent = BluePrintVelocityTemplateService.generateContent(
+ fileContent,
+ params, true
+ )
if (!destinationFolder.exists())
Files.createDirectories(destinationFolder.toPath())
finalFile.bufferedWriter().use { out -> out.write(finalFileContent) }
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
index 193fdda6d..542be8cab 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
@@ -45,6 +45,7 @@ open class K8sProfileUploadConfiguration(private var bluePrintPropertiesService:
class K8sProfileUploadConstants {
companion object {
+
const val PREFIX_K8S_PLUGIN: String = "blueprintprocessor.k8s.plugin"
}
}
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
index b023a5355..ae277e360 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
open class K8sProfileUploadProperties {
+
var type: String = K8sProfileUploadConstants.PREFIX_K8S_PLUGIN
lateinit var url: String
lateinit var username: String
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
index 2cd87ad20..5e6a6d7c8 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
@@ -19,21 +19,21 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.RestLoggerService
import org.apache.commons.io.IOUtils
+import org.apache.http.client.ClientProtocolException
import org.apache.http.client.entity.EntityBuilder
-import org.apache.http.message.BasicHeader
import org.apache.http.client.methods.HttpPost
import org.apache.http.client.methods.HttpUriRequest
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
-import java.nio.file.Files
-import java.nio.file.Path
+import org.apache.http.message.BasicHeader
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.RestLoggerService
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
+import java.io.IOException
import java.nio.charset.Charset
+import java.nio.file.Files
+import java.nio.file.Path
import java.util.Base64
class K8sUploadFileRestClientService(
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
index 424929b82..65b7644a8 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization
import java.io.Serializable
object MessageActionConstants {
+
const val PRIORITIZE = "prioritize"
}
@@ -33,6 +34,7 @@ enum class MessageState(val id: String) {
}
open class PrioritizationConfiguration : Serializable {
+
lateinit var expiryConfiguration: ExpiryConfiguration
lateinit var shutDownConfiguration: ShutDownConfiguration
lateinit var cleanConfiguration: CleanConfiguration
@@ -41,12 +43,14 @@ open class PrioritizationConfiguration : Serializable {
}
open class KafkaConfiguration : Serializable {
+
lateinit var inputTopicSelector: String // Consumer Configuration Selector
lateinit var expiredTopic: String // Publish Configuration Selector
lateinit var outputTopic: String // Publish Configuration Selector
}
open class NatsConfiguration : Serializable {
+
lateinit var connectionSelector: String // Consumer Configuration Selector
lateinit var inputSubject: String // Publish Configuration Selector
lateinit var expiredSubject: String // Publish Configuration Selector
@@ -54,20 +58,24 @@ open class NatsConfiguration : Serializable {
}
open class ExpiryConfiguration : Serializable {
+
var frequencyMilli: Long = 30000L
var maxPollRecord: Int = 1000
}
open class ShutDownConfiguration : Serializable {
+
var waitMill: Long = 30000L
}
open class CleanConfiguration : Serializable {
+
var frequencyMilli: Long = 30000L
var expiredRecordsHoldDays: Int = 5
}
open class UpdateStateRequest : Serializable {
+
lateinit var id: String
var group: String? = null
var state: String? = null
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
index d5ec0233a..4ab399f54 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
@@ -47,46 +47,46 @@ open class KafkaMessagePrioritizationConsumer(
open fun kafkaStreamConsumerFunction(prioritizationConfiguration: PrioritizationConfiguration):
KafkaStreamConsumerFunction {
- return object : KafkaStreamConsumerFunction {
-
- val kafkaConsumerConfiguration = prioritizationConfiguration.kafkaConfiguration
- ?: throw BluePrintProcessorException("failed to get kafka consumer configuration")
-
- override suspend fun createTopology(
- messageConsumerProperties: MessageConsumerProperties,
- additionalConfig: Map<String, Any>?
- ): Topology {
-
- val topology = Topology()
- val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
- as KafkaStreamsBasicAuthConsumerProperties
-
- val topics = kafkaStreamsBasicAuthConsumerProperties.topic.splitCommaAsList()
- log.info("Consuming prioritization topics($topics)")
-
- topology.addSource(MessagePrioritizationConstants.SOURCE_INPUT, *topics.toTypedArray())
-
- topology.addProcessor(
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
- bluePrintProcessorSupplier<ByteArray, ByteArray>(
+ return object : KafkaStreamConsumerFunction {
+
+ val kafkaConsumerConfiguration = prioritizationConfiguration.kafkaConfiguration
+ ?: throw BluePrintProcessorException("failed to get kafka consumer configuration")
+
+ override suspend fun createTopology(
+ messageConsumerProperties: MessageConsumerProperties,
+ additionalConfig: Map<String, Any>?
+ ): Topology {
+
+ val topology = Topology()
+ val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
+ as KafkaStreamsBasicAuthConsumerProperties
+
+ val topics = kafkaStreamsBasicAuthConsumerProperties.topic.splitCommaAsList()
+ log.info("Consuming prioritization topics($topics)")
+
+ topology.addSource(MessagePrioritizationConstants.SOURCE_INPUT, *topics.toTypedArray())
+
+ topology.addProcessor(
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
+ bluePrintProcessorSupplier<ByteArray, ByteArray>(
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
+ ),
+ MessagePrioritizationConstants.SOURCE_INPUT
+ )
+
+ /** To receive completed and error messages */
+ topology.addSink(
+ MessagePrioritizationConstants.SINK_OUTPUT,
+ kafkaConsumerConfiguration.outputTopic,
+ Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
- ),
- MessagePrioritizationConstants.SOURCE_INPUT
- )
-
- /** To receive completed and error messages */
- topology.addSink(
- MessagePrioritizationConstants.SINK_OUTPUT,
- kafkaConsumerConfiguration.outputTopic,
- Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
- )
-
- // Output will be sent to the group-output topic from Processor API
- return topology
+ )
+
+ // Output will be sent to the group-output topic from Processor API
+ return topology
+ }
}
}
- }
suspend fun startConsuming(prioritizationConfiguration: PrioritizationConfiguration) {
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
index 20da2c28c..a0b2cf462 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
@@ -35,6 +35,7 @@ open class NatsMessagePrioritizationConsumer(
private val bluePrintNatsLibPropertyService: BluePrintNatsLibPropertyService,
private val natsMessagePrioritizationService: MessagePrioritizationService
) {
+
private val log = logger(NatsMessagePrioritizationConsumer::class)
lateinit var bluePrintNatsService: BluePrintNatsService
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
index a6963d83f..f4602a810 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
@@ -165,7 +165,7 @@ abstract class AbstractMessagePrioritizationService(
if (!messages.isNullOrEmpty()) {
try {
/** Implement Aggregation logic in overridden class, If necessary,
- Populate New Message and Update status with Prioritized, Forward the message to next processor */
+ Populate New Message and Update status with Prioritized, Forward the message to next processor */
handleAggregation(messages)
} catch (e: Exception) {
val error = "failed in aggregate message(${messages.ids()}) : ${e.message}"
@@ -180,7 +180,8 @@ abstract class AbstractMessagePrioritizationService(
} catch (sendException: Exception) {
log.error(
"failed to update/publish error message(${messagePrioritization.id}) : " +
- "${sendException.message}", e
+ "${sendException.message}",
+ e
)
}
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
index aaefcc773..529d773a4 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
@@ -30,17 +30,18 @@ import org.springframework.stereotype.Service
open class MessagePrioritizationSchedulerService(
private val messagePrioritizationService: MessagePrioritizationService
) {
+
private val log = logger(MessagePrioritizationSchedulerService::class)
@Volatile
var keepGoing = true
/** This is sample scheduler implementation used during starting application with configuration.
- @EventListener(ApplicationReadyEvent::class)
- open fun init() = runBlocking {
- log.info("Starting PrioritizationListeners...")
- startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration())
- }
+ @EventListener(ApplicationReadyEvent::class)
+ open fun init() = runBlocking {
+ log.info("Starting PrioritizationListeners...")
+ startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration())
+ }
*/
open suspend fun startScheduling() {
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
index dde8d95e0..ed16fd44f 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
@@ -65,19 +65,19 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(
- group,
- states, Date(), PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
override suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(
- group,
- states, Date(), PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
override suspend fun getExpiredMessages(expiryDate: Date, count: Int): List<MessagePrioritization>? {
return prioritizationMessageRepository.findByExpiredDate(
@@ -87,11 +87,11 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndExpiredDate(
- group,
- expiryDate, PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndExpiredDate(
+ group,
+ expiryDate, PageRequest.of(0, count)
+ )
+ }
override suspend fun getCorrelatedMessages(
group: String,
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
index fb35df75b..7ab0be098 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
@@ -44,39 +44,39 @@ object MessageCorrelationUtils {
/** Assumption is message is of same group and checking for required types **/
fun correlatedMessagesWithTypes(collectedMessages: List<MessagePrioritization>, types: List<String>?):
- CorrelationCheckResponse {
+ CorrelationCheckResponse {
- return if (!types.isNullOrEmpty() && collectedMessages.size > 1) {
+ return if (!types.isNullOrEmpty() && collectedMessages.size > 1) {
- val unknownMessageTypes = collectedMessages.filter { !types.contains(it.type) }.map { it.id }
- if (!unknownMessageTypes.isNullOrEmpty()) {
- throw BluePrintProcessorException("Messages($unknownMessageTypes) is not in type of($types)")
- }
+ val unknownMessageTypes = collectedMessages.filter { !types.contains(it.type) }.map { it.id }
+ if (!unknownMessageTypes.isNullOrEmpty()) {
+ throw BluePrintProcessorException("Messages($unknownMessageTypes) is not in type of($types)")
+ }
- val copyTypes = types.toTypedArray().copyOf().toMutableList()
+ val copyTypes = types.toTypedArray().copyOf().toMutableList()
- val filteredMessage = collectedMessages.filter {
- !it.correlationId.isNullOrBlank() &&
+ val filteredMessage = collectedMessages.filter {
+ !it.correlationId.isNullOrBlank() &&
types.contains(it.type)
- }
- var correlatedKeys: MutableSet<String> = mutableSetOf()
- if (filteredMessage.isNotEmpty()) {
- val correlatedMap = filteredMessage.groupBy { it.toTypeNCorrelation() }
- val foundType = correlatedMap.keys.map { it.type }
- copyTypes.removeAll(foundType)
- correlatedKeys = correlatedMap.keys.map {
- it.correlationId
- }.toMutableSet()
- }
- /** Check if any Types missing and same correlation id for all types */
- return if (copyTypes.isEmpty()) {
- if (correlatedKeys.size == 1) CorrelationCheckResponse(correlated = true)
- else CorrelationCheckResponse(message = "not matching correlation keys($correlatedKeys)")
+ }
+ var correlatedKeys: MutableSet<String> = mutableSetOf()
+ if (filteredMessage.isNotEmpty()) {
+ val correlatedMap = filteredMessage.groupBy { it.toTypeNCorrelation() }
+ val foundType = correlatedMap.keys.map { it.type }
+ copyTypes.removeAll(foundType)
+ correlatedKeys = correlatedMap.keys.map {
+ it.correlationId
+ }.toMutableSet()
+ }
+ /** Check if any Types missing and same correlation id for all types */
+ return if (copyTypes.isEmpty()) {
+ if (correlatedKeys.size == 1) CorrelationCheckResponse(correlated = true)
+ else CorrelationCheckResponse(message = "not matching correlation keys($correlatedKeys)")
+ } else {
+ CorrelationCheckResponse(message = "couldn't find types($copyTypes)")
+ }
} else {
- CorrelationCheckResponse(message = "couldn't find types($copyTypes)")
+ return correlatedMessages(collectedMessages)
}
- } else {
- return correlatedMessages(collectedMessages)
}
- }
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
index af8d902cd..286a9b5c1 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
@@ -61,43 +61,45 @@ import kotlin.test.assertNotNull
@DataJpaTest
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class, BluePrintNatsLibConfiguration::class,
+ classes = [
+ BluePrintMessageLibConfiguration::class, BluePrintNatsLibConfiguration::class,
BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class]
+ MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class
+ ]
)
@TestPropertySource(
properties =
- [
- "spring.jpa.show-sql=false",
- "spring.jpa.properties.hibernate.show_sql=false",
- "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
-
- "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
- "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
- "blueprintsprocessor.messageconsumer.prioritize-input.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageconsumer.prioritize-input.truststorePassword=truststorePassword",
- "blueprintsprocessor.messageconsumer.prioritize-input.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageconsumer.prioritize-input.keystorePassword=keystorePassword",
- "blueprintsprocessor.messageconsumer.prioritize-input.scramUsername=test-user",
- "blueprintsprocessor.messageconsumer.prioritize-input.scramPassword=testUserPassword",
-
- // To send initial test message
- "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic",
- "blueprintsprocessor.messageproducer.prioritize-input.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.prioritize-input.truststorePassword=truststorePassword",
- "blueprintsprocessor.messageproducer.prioritize-input.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.prioritize-input.keystorePassword=keystorePassword",
- "blueprintsprocessor.messageproducer.prioritize-input.scramUsername=test-user",
- "blueprintsprocessor.messageproducer.prioritize-input.scramPassword=testUserPassword",
-
- "blueprintsprocessor.nats.cds-controller.type=token-auth",
- "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
- "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
- ]
+ [
+ "spring.jpa.show-sql=false",
+ "spring.jpa.properties.hibernate.show_sql=false",
+ "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
+
+ "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
+ "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
+ "blueprintsprocessor.messageconsumer.prioritize-input.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageconsumer.prioritize-input.truststorePassword=truststorePassword",
+ "blueprintsprocessor.messageconsumer.prioritize-input.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageconsumer.prioritize-input.keystorePassword=keystorePassword",
+ "blueprintsprocessor.messageconsumer.prioritize-input.scramUsername=test-user",
+ "blueprintsprocessor.messageconsumer.prioritize-input.scramPassword=testUserPassword",
+
+ // To send initial test message
+ "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic",
+ "blueprintsprocessor.messageproducer.prioritize-input.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.prioritize-input.truststorePassword=truststorePassword",
+ "blueprintsprocessor.messageproducer.prioritize-input.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.prioritize-input.keystorePassword=keystorePassword",
+ "blueprintsprocessor.messageproducer.prioritize-input.scramUsername=test-user",
+ "blueprintsprocessor.messageproducer.prioritize-input.scramPassword=testUserPassword",
+
+ "blueprintsprocessor.nats.cds-controller.type=token-auth",
+ "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
+ "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
+ ]
)
open class MessagePrioritizationConsumerTest {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
index 307e73e6b..b64790065 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
@@ -35,6 +35,7 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
AbstractComponentFunction() {
companion object {
+
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
@@ -66,8 +67,10 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
// Handles both script processing and error handling
scriptComponent.executeScript(executionServiceInput)
- componentFunctionScriptingService.cleanupInstance(bluePrintRuntimeService.bluePrintContext(),
- scriptType)
+ componentFunctionScriptingService.cleanupInstance(
+ bluePrintRuntimeService.bluePrintContext(),
+ scriptType
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
index a69e4d9d6..d1855cb62 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
@@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core.Ne
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
data class NetconfDevice(val deviceInfo: DeviceInfo) {
+
val netconfRpcService = NetconfRpcServiceImpl(deviceInfo)
val netconfSession: NetconfSession
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
index f52cb0a62..b964388cb 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
@@ -44,7 +44,8 @@ fun AbstractComponentFunction.netconfDeviceInfo(requirementName: String): Device
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(
requirement
- .node!!, requirement.capability!!
+ .node!!,
+ requirement.capability!!
)
return netconfDeviceInfo(capabilityProperties)
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
index 4456cb0de..25cfb3392 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
@@ -20,20 +20,28 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
class DeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 30
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonProperty("reply-time-out")
var replyTimeout: Int = 30
+
@get:JsonIgnore
var idleTimeout: Int = 99999
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
index 23982dcb5..1cb4b3732 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
@@ -16,5 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api
interface NetconfSessionListener {
+
fun accept(event: NetconfReceivedEvent)
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
index 8f8fc1463..b2d4d98fe 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
@@ -120,6 +120,7 @@ class NetconfDeviceCommunicator(
internal enum class NetconfMessageState {
NO_MATCHING_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> FIRST_BRACKET
@@ -129,6 +130,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> SECOND_BRACKET
@@ -137,6 +139,7 @@ class NetconfDeviceCommunicator(
}
},
SECOND_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'>' -> FIRST_BIGGER
@@ -145,6 +148,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_BIGGER {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> THIRD_BRACKET
@@ -153,6 +157,7 @@ class NetconfDeviceCommunicator(
}
},
THIRD_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> ENDING_BIGGER
@@ -161,6 +166,7 @@ class NetconfDeviceCommunicator(
}
},
ENDING_BIGGER {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'>' -> END_PATTERN
@@ -169,6 +175,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_LF {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'#' -> FIRST_HASH
@@ -179,6 +186,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_HASH {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'#' -> SECOND_HASH
@@ -187,6 +195,7 @@ class NetconfDeviceCommunicator(
}
},
SECOND_HASH {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'\n' -> END_CHUNKED_PATTERN
@@ -195,11 +204,13 @@ class NetconfDeviceCommunicator(
}
},
END_CHUNKED_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return NO_MATCHING_PATTERN
}
},
END_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return NO_MATCHING_PATTERN
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
index 3d3eee8f0..7aefbb0d6 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
@@ -65,7 +65,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
try {
log.info(
"$deviceInfo: Connecting to Netconf Device with timeouts C:${deviceInfo.connectTimeout}, " +
- "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}"
+ "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}"
)
startConnection()
log.info("$deviceInfo: Connected to Netconf Device")
@@ -78,7 +78,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
override fun disconnect() {
var retryNum = 3
while (rpcService.closeSession(false).status
- .equals(RpcStatus.FAILURE, true) && retryNum > 0
+ .equals(RpcStatus.FAILURE, true) && retryNum > 0
) {
log.error("disconnect: graceful disconnect failed, retrying $retryNum times...")
retryNum--
@@ -228,7 +228,8 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
ImmutableSet.of(
ClientSession.ClientSessionEvent.WAIT_AUTH,
ClientSession.ClientSessionEvent.CLOSED, ClientSession.ClientSessionEvent.AUTHED
- ), 0
+ ),
+ 0
)
if (!event.contains(ClientSession.ClientSessionEvent.AUTHED)) {
throw NetconfException("$deviceInfo: Failed to authenticate session.")
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
index 03177e8ec..54877d5eb 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
@@ -27,11 +27,13 @@ enum class ModifyAction(val action: String) {
}
object RpcStatus {
+
const val SUCCESS = "success"
const val FAILURE = "failure"
}
object RpcMessageUtils {
+
const val OPEN = "<"
const val CLOSE = ">"
const val EQUAL = "="
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
index 232dca621..32d7dcadc 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
@@ -31,6 +31,7 @@ import kotlin.text.Charsets.UTF_8
class NetconfMessageUtils {
companion object {
+
val log = LoggerFactory.getLogger(NetconfMessageUtils::class.java)
const val NEW_LINE = "\n"
@@ -141,13 +142,13 @@ class NetconfMessageUtils {
if (!persist.isEmpty() && !persistId.isEmpty()) {
throw NetconfException(
"Can't proceed <commit> with both persist($persist) and " +
- "persistId($persistId) specified. Only one should be specified."
+ "persistId($persistId) specified. Only one should be specified."
)
}
if (confirmed && !persistId.isEmpty()) {
throw NetconfException(
"Can't proceed <commit> with both confirmed flag and " +
- "persistId($persistId) specified. Only one should be specified."
+ "persistId($persistId) specified. Only one should be specified."
)
}
@@ -366,8 +367,10 @@ class NetconfMessageUtils {
if (!message.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
// chunk encode message
message =
- (RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH +
- RpcMessageUtils.NEW_LINE)
+ (
+ RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH +
+ RpcMessageUtils.NEW_LINE
+ )
}
return message
}
@@ -383,9 +386,10 @@ class NetconfMessageUtils {
if (!request.contains(RpcMessageUtils.XML_HEADER)) {
if (request.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
request =
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length
- )
+ request.split("<".toRegex()).dropLastWhile { it.isEmpty() }
+ .toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
+ request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length
+ )
} else {
request = RpcMessageUtils.XML_HEADER + "\n" + request
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
index ab051597b..930fb1276 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
@@ -20,6 +20,7 @@ import org.junit.Test
import kotlin.test.assertEquals
class DeviceInfoTest {
+
@Test
fun testToString() {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
index e5bacc547..f4e352165 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
@@ -22,6 +22,7 @@ import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
class NetconfMessageTest {
+
@Test
fun testSuccessfulDeviceResponse() {
val dr: DeviceResponse = genSuccessfulEmptyDeviceResponse()
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
index 1991fc4f6..c70a43e49 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
@@ -42,6 +42,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
class NetconfDeviceCommunicatorTest {
+
private lateinit var netconfSession: NetconfSession
private lateinit var netconfSessionListener: NetconfSessionListener
private lateinit var mockInputStream: InputStream
@@ -51,7 +52,9 @@ class NetconfDeviceCommunicatorTest {
private val endPatternCharArray: List<Int> = stringToCharArray(RpcMessageUtils.END_PATTERN)
companion object {
+
private val chunkedEnding = "\n##\n"
+
// using example from section 4.2 of RFC6242 (https://tools.ietf.org/html/rfc6242#section-4.2)
private val validChunkedEncodedMsg = """
|
@@ -197,7 +200,8 @@ class NetconfDeviceCommunicatorTest {
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<close-session/>
</rpc>
- """.trimIndent(), eventSlot.captured.messagePayload
+ """.trimIndent(),
+ eventSlot.captured.messagePayload
)
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
index 9a3652aa1..b119d26f0 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
@@ -33,9 +33,11 @@ import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
class NetconfRpcServiceImplTest {
+
private lateinit var mockNetconfSession: NetconfSessionImpl
companion object {
+
private const val someString = "someString"
private const val replyStr = "this is a reply"
private val failedDeviceResponse = DeviceResponse(
@@ -46,6 +48,7 @@ class NetconfRpcServiceImplTest {
status = RpcStatus.SUCCESS,
requestMessage = "request message", responseMessage = replyStr
) // responseMessage will be null in this POJO
+
// but will be set later from mockSession
private const val msgId = "100"
private const val timeout = 5
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
index b94c092e3..41e4f8290 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
@@ -53,6 +53,7 @@ import kotlin.test.assertTrue
class NetconfSessionImplTest {
companion object {
+
val SUCCESSFUL_DEVICE_RESPONSE = DeviceResponse().apply {
status = RpcStatus.SUCCESS
errorMessage = ""
@@ -150,7 +151,7 @@ class NetconfSessionImplTest {
// rpcService.closeSession succeeds with status not RpcStatus.FAILURE
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { rpcService.closeSession(any()) } returns
- FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
+ FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
every { mockClientSession.close() } just Runs
every { mockSshClient.close() } just Runs
every { mockClientChannel.close() } just Runs
@@ -247,7 +248,7 @@ class NetconfSessionImplTest {
// make sure the replies didn't change
assertTrue {
netconfSessionSpy.getReplies().size == 1 &&
- netconfSessionSpy.getReplies().containsKey("somekey")
+ netconfSessionSpy.getReplies().containsKey("somekey")
}
verify(exactly = 0) { netconfSessionSpy.clearReplies() }
}
@@ -312,7 +313,7 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } just Runs
every { netconfSessionSpy.checkAndReestablish() } just Runs
netconfSessionSpy.setSession(mockClientSession)
@@ -329,7 +330,7 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } throws IOException("got an IO exception")
every { netconfSessionSpy.checkAndReestablish() } just Runs
// call the method
@@ -429,7 +430,7 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
+ setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
@@ -451,11 +452,11 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(
- ClientSession.ClientSessionEvent.WAIT_AUTH,
- ClientSession.ClientSessionEvent.CLOSED,
- ClientSession.ClientSessionEvent.AUTHED
- )
+ setOf(
+ ClientSession.ClientSessionEvent.WAIT_AUTH,
+ ClientSession.ClientSessionEvent.CLOSED,
+ ClientSession.ClientSessionEvent.AUTHED
+ )
every { mockClientSession.createSubsystemChannel(any()) } returns mockSubsystem
every { mockClientChannel.invertedOut } returns sampleInputStream
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
index ab762e821..abb3a8c4c 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
@@ -25,6 +25,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.Dev
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfReceivedEvent
class NetconfSessionListenerImplTest {
+
// Note: mockk's verifyAll is akin to verify with verifyNoMoreInteractions in Mockito
private val netconSession = mockk<NetconfSessionImpl>()
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
index 0d791c2a6..98d17e38b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
@@ -27,10 +27,12 @@ class RpcMessageUtilsTest {
@Test
fun getConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<get-config><source><candidate/></source><filter type=\"subtree\">Test-Filter-Content</filter>" +
- "</get-config></rpc>")
+ "</get-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -45,10 +47,12 @@ class RpcMessageUtilsTest {
@Test
fun editConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<edit-config><target><candidate/></target><default-operation>Test-Default-Operation</default-operation>" +
- "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>")
+ "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -64,9 +68,11 @@ class RpcMessageUtilsTest {
@Test
fun validate() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<validate><source><candidate/></source></validate></rpc>")
+ "<validate><source><candidate/></source></validate></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -80,11 +86,13 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommit() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<cancel-commit>" +
"<persist-id>1234</persist-id>" +
- "</cancel-commit></rpc>")
+ "</cancel-commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -98,10 +106,12 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommitNoPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<cancel-commit>" +
- "</cancel-commit></rpc>")
+ "</cancel-commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -113,9 +123,11 @@ class RpcMessageUtilsTest {
@Test
fun commit() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit></commit></rpc>")
+ "<commit></commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -132,11 +144,13 @@ class RpcMessageUtilsTest {
@Test
fun commitPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<commit>" +
"<persist-id>1234</persist-id>" +
- "</commit></rpc>")
+ "</commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -160,13 +174,15 @@ class RpcMessageUtilsTest {
@Test
fun commitPersist() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<commit>" +
"<confirmed/>" +
"<confirm-timeout>30</confirm-timeout>" +
"<persist>1234</persist>" +
- "</commit></rpc>")
+ "</commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -189,9 +205,11 @@ class RpcMessageUtilsTest {
@Test
fun unlock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<unlock><target><candidate/></target></unlock></rpc>")
+ "<unlock><target><candidate/></target></unlock></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -204,9 +222,11 @@ class RpcMessageUtilsTest {
@Test
fun deleteConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<delete-config><target><candidate/></target></delete-config></rpc>")
+ "<delete-config><target><candidate/></target></delete-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val netconfTargetConfig = NetconfDatastore.CANDIDATE.datastore
@@ -228,9 +248,11 @@ class RpcMessageUtilsTest {
@Test
fun discardChanges() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<discard-changes/></rpc>")
+ "<discard-changes/></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -242,9 +264,11 @@ class RpcMessageUtilsTest {
@Test
fun lock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<lock><target><candidate/></target></lock></rpc>")
+ "<lock><target><candidate/></target></lock></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -273,8 +297,10 @@ class RpcMessageUtilsTest {
@Test
fun createHelloString() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
- "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>"
+ )
val capability = listOf<String>("hi", "hello")
@@ -306,12 +332,16 @@ class RpcMessageUtilsTest {
@Test
fun formatRPCRequest() {
- val checkString = ("#199" +
+ val checkString = (
+ "#199" +
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>" +
- "##")
+ "##"
+ )
- val request = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
- "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val request = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>"
+ )
val messageId = "Test-Message-ID"
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
index 03daf2aa9..bd7227744 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
@@ -57,22 +57,22 @@ open class ComponentJythonExecutor(
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
private suspend fun populateJythonComponentInstance() {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
+ .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
+ ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
+ ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
@@ -81,7 +81,7 @@ open class ComponentJythonExecutor(
checkNotEmpty(content) { "artifact ($artifactName) content is empty" }
val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
+ ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
val jythonInstance: MutableMap<String, Any> = hashMapOf()
jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName)
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index b06da3810..ce51bd9ee 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -57,6 +57,7 @@ open class ComponentRemotePythonExecutor(
private val log = LoggerFactory.getLogger(ComponentRemotePythonExecutor::class.java)!!
companion object {
+
const val SELECTOR_CMD_EXEC = "blueprintsprocessor.remote-script-command"
const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
@@ -151,7 +152,8 @@ open class ComponentRemotePythonExecutor(
subRequestId = executionServiceInput.commonHeader.subRequestId,
remoteIdentifier = RemoteIdentifier(
blueprintName = blueprintName,
- blueprintVersion = blueprintVersion),
+ blueprintVersion = blueprintVersion
+ ),
packages = packages,
timeOut = envPrepTimeout.toLong()
@@ -175,8 +177,10 @@ open class ComponentRemotePythonExecutor(
// in cases where the exception is caught in BP side due to timeout, we do not have `err_msg` returned by cmd-exec (inside `payload`),
// hence `artifact` field will be empty
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val componentLevelWarningMsg = if (timeout < envPrepTimeout) "Note: component-level timeout ($timeout) is shorter than env-prepare timeout ($envPrepTimeout). " else ""
- val grpcErrMsg = "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId).$componentLevelWarningMsg grpcError: (${grpcEx.cause?.message})"
+ val componentLevelWarningMsg =
+ if (timeout < envPrepTimeout) "Note: component-level timeout ($timeout) is shorter than env-prepare timeout ($envPrepTimeout). " else ""
+ val grpcErrMsg =
+ "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId).$componentLevelWarningMsg grpcError: (${grpcEx.cause?.message})"
// no execution log in case of timeout (as cmd-exec side hasn't finished to transfer output)
// set prepare-env-log to the error msg, and cmd-exec-log to empty
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, grpcErrMsg.asJsonPrimitive())
@@ -184,7 +188,8 @@ open class ComponentRemotePythonExecutor(
addError(StatusType.FAILURE.name, STEP_PREPARE_ENV, grpcErrMsg)
log.error(grpcErrMsg, grpcEx)
} catch (e: Exception) {
- val catchallErrMsg = "Command executor failed during env. preparation.. catch-all case. timeout($envPrepTimeout) requestId ($processId). exception msg: ${e.message}"
+ val catchallErrMsg =
+ "Command executor failed during env. preparation.. catch-all case. timeout($envPrepTimeout) requestId ($processId). exception msg: ${e.message}"
// no environment prepare log from executor in case of timeout (as cmd-exec side hasn't finished to transfer output), set it to error msg. Execution logs is empty.
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, catchallErrMsg.asJsonPrimitive())
setNodeOutputErrors(STEP_PREPARE_ENV, "[]".asJsonPrimitive(), "{}".asJsonPrimitive(), isLogResponseEnabled)
@@ -204,7 +209,8 @@ open class ComponentRemotePythonExecutor(
remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
command = scriptCommand,
properties = properties,
- timeOut = executionTimeout.toLong())
+ timeOut = executionTimeout.toLong()
+ )
val remoteExecutionOutputDeferred = GlobalScope.async {
remoteScriptExecutionService.executeCommand(remoteExecutionInput)
@@ -228,18 +234,22 @@ open class ComponentRemotePythonExecutor(
setNodeOutputProperties(remoteExecutionOutput.status, STEP_EXEC_CMD, logs, returnedPayload, isLogResponseEnabled)
} // In timeout exception cases, we don't have payload, hence `payload` is empty value.
} catch (timeoutEx: TimeoutCancellationException) {
- val componentLevelWarningMsg = if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
- val timeoutErrMsg = "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
+ val componentLevelWarningMsg =
+ if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
+ val timeoutErrMsg =
+ "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, timeoutEx)
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val timeoutErrMsg = "Command executor timed out executing after $executionTimeout seconds requestId ($processId) grpcErr: ${grpcEx.status}"
+ val timeoutErrMsg =
+ "Command executor timed out executing after $executionTimeout seconds requestId ($processId) grpcErr: ${grpcEx.status}"
setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, grpcEx)
} catch (e: Exception) {
- val catchAllErrMsg = "Command executor failed during process catch-all case requestId ($processId) timeout($envPrepTimeout) exception msg: ${e.message}"
+ val catchAllErrMsg =
+ "Command executor failed during process catch-all case requestId ($processId) timeout($envPrepTimeout) exception msg: ${e.message}"
setNodeOutputErrors(STEP_PREPARE_ENV, listOf(catchAllErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, catchAllErrMsg)
log.error(catchAllErrMsg, e)
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
index 6998f0229..3df25c402 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
@@ -112,9 +112,9 @@ fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(
description: String,
block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit
):
- NodeTemplate {
- return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build()
-}
+ NodeTemplate {
+ return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build()
+ }
class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() {
@@ -135,7 +135,7 @@ class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() {
class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description: String) :
AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorNodeTemplateBuilder.InputsBuilder,
- ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(
+ ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(
id, "component-remote-python-executor",
"ComponentRemotePythonExecutor", description
) {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
index 9000d65d8..b0ce73588 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
@@ -67,23 +67,23 @@ class BlueprintJythonServiceImpl(
override fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String):
BlueprintFunctionNode<*, *> {
- val pythonFileName = bluePrintContext.rootPath
- .plus(File.separator)
- .plus(scriptClassReference)
+ val pythonFileName = bluePrintContext.rootPath
+ .plus(File.separator)
+ .plus(scriptClassReference)
- val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
- log.info("Getting Jython Script Class($pythonClassName)")
+ val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
+ log.info("Getting Jython Script Class($pythonClassName)")
- val content: String = JacksonUtils.getContent(pythonFileName)
+ val content: String = JacksonUtils.getContent(pythonFileName)
- val jythonInstances: MutableMap<String, Any> = hashMapOf()
- jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
+ val jythonInstances: MutableMap<String, Any> = hashMapOf()
+ jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
- return jythonInstance<BlueprintFunctionNode<*, *>>(
- bluePrintContext, pythonClassName,
- content, jythonInstances
- )
- }
+ return jythonInstance<BlueprintFunctionNode<*, *>>(
+ bluePrintContext, pythonClassName,
+ content, jythonInstances
+ )
+ }
suspend fun jythonComponentInstance(abstractComponentFunction: AbstractComponentFunction): AbstractComponentFunction {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
index 3d2f10ec0..f8f0e7e32 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
@@ -23,6 +23,7 @@ import org.python.util.PythonInterpreter
@Deprecated("CDS won't support JythonService")
open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) {
+
private val blueprintPythonInterpreterProxy: BlueprintPythonInterpreterProxy
init {
@@ -46,8 +47,10 @@ open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) {
return blueprintPythonInterpreterProxy.getPythonInstance(properties)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to get python instance."
- throw e.updateErrorMessage(ExecutionServiceDomains.PYTHON_EXECUTOR, errorMsg,
- "Error in environment properties")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.PYTHON_EXECUTOR, errorMsg,
+ "Error in environment properties"
+ )
} catch (e: Exception) {
throw BluePrintProcessorException("Failed to execute Jython component $e", e)
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
index 8951e3e7b..593c0552b 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
@@ -37,13 +37,16 @@ open class PythonExecutorProperty {
@Value("\${blueprints.processor.functions.python.executor.executionPath}")
lateinit var executionPath: String
+
@Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
lateinit var modulePaths: List<String>
}
@Deprecated("CDS won't support JythonService")
class PythonExecutorConstants {
+
companion object {
+
const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 784c6b7ff..d5fa0b20c 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -37,13 +37,17 @@ import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
- ComponentJythonExecutor::class, MockInstanceConfiguration::class]
+ classes = [
+ PythonExecutorConfiguration::class, PythonExecutorProperty::class,
+ ComponentJythonExecutor::class, MockInstanceConfiguration::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class ComponentJythonExecutorTest {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
index 5e77937bc..46a3120d5 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
@@ -44,7 +44,8 @@ class ComponentRemotePythonExecutorDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
argumentProperties("""["one", "two"]""")
packages {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index d4edf4bb2..0a0d1659e 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -49,8 +49,8 @@ class ComponentRemotePythonExecutorTest {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val executionServiceInput =
@@ -93,8 +93,8 @@ class ComponentRemotePythonExecutorTest {
runBlocking {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("123456-1000")
@@ -112,113 +112,114 @@ class ComponentRemotePythonExecutorTest {
*/
fun getMockedOutput(svc: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
-
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
-
- val mapper = ObjectMapper()
- val rootNode = mapper.createObjectNode()
- rootNode.put("ip-address", "0.0.0.0")
- rootNode.put("type", "rest")
-
- val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
- operationalInputs.putJsonElement("endpoint-selector", "aai")
- operationalInputs.putJsonElement("dynamic-properties", rootNode)
- operationalInputs.putJsonElement("command", "./run.sh")
- operationalInputs.putJsonElement("packages", "py")
-
- every {
- svc.resolveNodeTemplateInterfaceOperationInputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
- )
- } returns operationalInputs
-
- val stepInputData = StepData().apply {
- name = "execute-remote-python"
- properties = stepMetaData
- }
-
- val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile(
- "payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java
- )!!
- executionServiceInput.stepData = stepInputData
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- svc.resolveNodeTemplateInterfaceOperationOutputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns operationOutputs
- val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
- "123456-1000",
- "./../../../../components/model-" +
- "catalog/blueprint-model/test-blueprint/" +
- "remote_scripts"
- )
- every {
- svc.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
- )
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python", "prepare-environment-logs",
- "prepared successfully".asJsonPrimitive()
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs", "N/A".asJsonPrimitive()
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs",
- "processed successfully".asJsonPrimitive()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns Unit
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
+ )
+ operationalInputs.putJsonElement("endpoint-selector", "aai")
+ operationalInputs.putJsonElement("dynamic-properties", rootNode)
+ operationalInputs.putJsonElement("command", "./run.sh")
+ operationalInputs.putJsonElement("packages", "py")
+
+ every {
+ svc.resolveNodeTemplateInterfaceOperationInputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
+ } returns operationalInputs
- every {
- svc.resolveDSLExpression("aai")
- } returns """{"url" : "http://xxx.com"}""".asJsonType()
+ val stepInputData = StepData().apply {
+ name = "execute-remote-python"
+ properties = stepMetaData
+ }
- every {
- svc.bluePrintContext()
- } returns bluePrintRuntimeService.bluePrintContext()
- return executionServiceInput
- }
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java
+ )!!
+ executionServiceInput.stepData = stepInputData
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ svc.resolveNodeTemplateInterfaceOperationOutputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
+ } returns operationOutputs
+ val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts"
+ )
+ every {
+ svc.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script"
+ )
+ } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script"
+ )
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive()
+ )
+ } returns Unit
+
+ every {
+ svc.resolveDSLExpression("aai")
+ } returns """{"url" : "http://xxx.com"}""".asJsonType()
+
+ every {
+ svc.bluePrintContext()
+ } returns bluePrintRuntimeService.bluePrintContext()
+ return executionServiceInput
+ }
}
class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
+
override suspend fun init(selector: Any) {
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
index bec8ccae7..0efaaa113 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
@@ -29,8 +29,10 @@ import kotlin.test.assertNotNull
@ContextConfiguration(classes = [BluePrintPython::class, PythonExecutorProperty::class, String::class])
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class BlueprintPythonHostTest {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
index 7c6ba603b..c755e89bf 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
@@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
/** Resource Definition DSL **/
fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit):
- MutableMap<String, ResourceDefinition> {
- return ResourceDefinitionsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceDefinition> {
+ return ResourceDefinitionsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceDefinition(
name: String,
@@ -39,9 +39,9 @@ fun BluePrintTypes.resourceDefinition(
/** Resource Mapping DSL **/
fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit):
- MutableMap<String, ResourceAssignment> {
- return ResourceAssignmentsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceAssignment> {
+ return ResourceAssignmentsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceAssignment(
name: String,
@@ -53,6 +53,7 @@ fun BluePrintTypes.resourceAssignment(
}
class ResourceDefinitionsBuilder() {
+
private val resourceDefinitions: MutableMap<String, ResourceDefinition> = hashMapOf()
fun resourceDefinition(
@@ -74,6 +75,7 @@ class ResourceDefinitionsBuilder() {
}
class ResourceDefinitionBuilder(private val name: String, private val description: String) {
+
private val resourceDefinition = ResourceDefinition()
fun updatedBy(updatedBy: String) {
@@ -115,6 +117,7 @@ class ResourceDefinitionBuilder(private val name: String, private val descriptio
}
class ResourceDefinitionSourcesBuilder {
+
var sources: MutableMap<String, NodeTemplate> = hashMapOf()
fun source(source: NodeTemplate) {
@@ -147,6 +150,7 @@ class ResourceDefinitionSourcesBuilder {
}
class ResourceAssignmentsBuilder() {
+
private val resourceAssignments: MutableMap<String, ResourceAssignment> = hashMapOf()
fun resourceAssignment(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index 3ebd2f893..dac237fc5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -37,6 +37,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
AbstractComponentFunction() {
companion object {
+
const val INPUT_REQUEST_ID = "request-id"
const val INPUT_RESOURCE_ID = "resource-id"
const val INPUT_ACTION_NAME = "action-name"
@@ -68,7 +69,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val resourceType =
getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
val resolutionSummary =
- getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult
@@ -99,7 +100,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
} else if (resourceType.isEmpty() && resourceId.isEmpty() && resolutionKey.isEmpty()) {
throw BluePrintProcessorException(
"Can't proceed with the resolution: can't persist resolution without a correlation key. " +
- "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false."
+ "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false."
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index 8c854b840..774873a43 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -83,7 +83,7 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
property(
ResourceResolutionComponent.INPUT_RESOLUTION_SUMMARY, BluePrintConstants.DATA_TYPE_BOOLEAN,
- false, "Enables ResolutionSummary output"
+ false, "Enables ResolutionSummary output"
)
property(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
index 0f04ea38e..6451b8fc8 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
@@ -48,9 +48,9 @@ suspend fun AbstractComponentFunction.contentFromResolvedArtifactNB(artifactPref
*/
fun AbstractComponentFunction.storedContentFromResolvedArtifact(resolutionKey: String, artifactName: String):
- String = runBlocking {
- storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
-}
+ String = runBlocking {
+ storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
+ }
fun AbstractComponentFunction.contentFromResolvedArtifact(artifactPrefix: String): String = runBlocking {
contentFromResolvedArtifactNB(artifactPrefix)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 836db4c70..07eb15dda 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -197,8 +197,8 @@ open class ResourceResolutionServiceImpl(
false
) as Boolean
val assignmentMap = resourceAssignments
- .associateBy({ it.name }, { it.property?.value })
- .asJsonNode()
+ .associateBy({ it.name }, { it.property?.value })
+ .asJsonNode()
val resolvedParamJsonContent =
ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
val artifactTemplateDefinition =
@@ -213,7 +213,7 @@ open class ResourceResolutionServiceImpl(
ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE]
.asJsonPrimitive()
- )
+ )
)
}
resolutionSummary -> {
@@ -443,10 +443,12 @@ open class ResourceResolutionServiceImpl(
// Comparision between what we have in the database vs what we have to assign.
private fun compareOne(resourceResolution: ResourceResolution, resourceAssignment: ResourceAssignment): Boolean {
- return (resourceResolution.name == resourceAssignment.name &&
- resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
- resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
- resourceResolution.dictionaryVersion == resourceAssignment.version)
+ return (
+ resourceResolution.name == resourceAssignment.name &&
+ resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
+ resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
+ resourceResolution.dictionaryVersion == resourceAssignment.version
+ )
}
private fun exposeOccurrencePropertyInResourceAssignments(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
index d541fe60c..62ec2bdf4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
@@ -247,6 +247,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -286,6 +287,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
}
class KeyMappingBuilder() {
+
val map: MutableMap<String, String> = hashMapOf()
fun map(key: String, value: String) {
map[key] = value
@@ -312,6 +314,7 @@ class SourceRestNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -390,6 +393,7 @@ class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
index 7a7edc92b..e2fef746b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
@@ -23,61 +23,84 @@ import com.fasterxml.jackson.annotation.JsonProperty
open class ResourceSourceProperties
open class InputResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DefaultResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DatabaseResourceSource : ResourceSourceProperties() {
+
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
lateinit var query: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class RestResourceSource : ResourceSourceProperties() {
+
lateinit var verb: String
+
@get:JsonProperty("payload")
var payload: String? = null
+
@get:JsonProperty("resolved-payload")
var resolvedPayload: String? = null
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
+
@get:JsonProperty("url-path")
lateinit var urlPath: String
lateinit var path: String
+
@get:JsonProperty("expression-type")
lateinit var expressionType: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("headers")
var headers: Map<String, String> = emptyMap()
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class CapabilityResourceSource : ResourceSourceProperties() {
+
@get:JsonProperty("script-type")
lateinit var scriptType: String
+
@get:JsonProperty("script-class-reference")
lateinit var scriptClassReference: String
+
@get:JsonProperty("instance-dependencies")
var instanceDependencies: List<String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
index b38c32056..03a90d134 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
@@ -122,21 +122,21 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() {
/** Generates aggregated request payload for Ip Assign mS. Parses the resourceassignments of
* sourceCapability "ipassign-ms". It generates below sample payload
* {
- "requests": [{
- "name": "fixed_ipv4_Address_01",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }, {
- "name": "fixed_ipv4_Address_02",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }
- ]
- } */
+ "requests": [{
+ "name": "fixed_ipv4_Address_01",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }, {
+ "name": "fixed_ipv4_Address_02",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
index dbac70a39..7a5986aa6 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
@@ -125,25 +125,25 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
* sourceCapability "naming-ms". "naming-type" should be provides as property metadata for
* each resourceassigment of sourceCapability "naming-ms". It generates below sample payload
* {
- "elements": [{
- "vf-module-name": "${vf-module-name}",
- "naming-type": "VF-MODULE",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }, {
- "vnfc-name": "${vnfc-name}",
- "naming-type": "VNFC",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }
- ]
- } */
+ "elements": [{
+ "vf-module-name": "${vf-module-name}",
+ "naming-type": "VF-MODULE",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }, {
+ "vnfc-name": "${vnfc-name}",
+ "naming-type": "VNFC",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
@@ -158,7 +158,8 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
val moduleValue = "\${".plus(moduleName.plus("}"))
val request: MutableMap<String, String> = input.mapValues {
- it.value.toString().removeSurrounding("\"") } as MutableMap<String, String>
+ it.value.toString().removeSurrounding("\"")
+ } as MutableMap<String, String>
if (namingType != null) {
request["naming-type"] = namingType
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
index db023acfb..55a4d1120 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
@@ -112,6 +112,7 @@ class ResourceResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
index 1a5d062a3..5958c7899 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
@@ -215,10 +215,10 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
resolutionKey: String
) {
resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName,
- blueprintVersion,
- artifactName,
- resolutionKey
+ blueprintName,
+ blueprintVersion,
+ artifactName,
+ resolutionKey
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index 8b235925b..971caa338 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -89,6 +89,7 @@ class TemplateResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
index 895bc993f..4bdd5d985 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
@@ -147,7 +147,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
+ "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
)
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resolutionKey,
@@ -163,7 +163,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
+ "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
)
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resourceId,
@@ -178,13 +178,14 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
try {
log.info(
"Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
)
templateResolutionRepository.saveAndFlush(resourceResolutionResult)
} catch (ex: DataIntegrityViolationException) {
log.error(
"Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}",
+ ex.message
)
throw BluePrintException("Failed to store resource api result.", ex)
}
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 42e086137..b1dc14091 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
@@ -97,14 +97,14 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>):
ResourceAssignmentProcessor {
- log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
+ log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
- val scriptComponent = componentFunctionScriptingService
- .scriptInstance<ResourceAssignmentProcessor>(
- raRuntimeService.bluePrintContext(), scriptType,
- scriptClassReference
- )
+ val scriptComponent = componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(
+ raRuntimeService.bluePrintContext(), scriptType,
+ scriptClassReference
+ )
- return scriptComponent
- }
+ return scriptComponent
+ }
}
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 2640b5b85..0417024d3 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
@@ -18,15 +18,15 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -68,8 +68,10 @@ open class DatabaseResourceAssignmentProcessor(
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process Database resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or DB resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or DB resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
@@ -99,13 +101,13 @@ open class DatabaseResourceAssignmentProcessor(
}
sourceProperties.inputKeyMapping
- ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
logger.info(
"DatabaseResource ($dSource) dictionary information: " +
- "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val jdbcTemplate = blueprintDBLibService(sourceProperties, dSource)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
index 2921cb6fb..892d8fbc9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
@@ -53,8 +53,10 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process default resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong default value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong default value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
index d078a2d70..131e2ae9a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
@@ -52,8 +52,10 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process input resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong input value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong input value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index 0c0735ff0..cffc5e3bf 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -106,12 +106,12 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, JsonNode>):
String {
- if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
- return valueToResolve
+ if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
+ return valueToResolve
+ }
+ // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
+ return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
}
- // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
- return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
- }
final override suspend fun applyNB(resourceAssignment: ResourceAssignment): Boolean {
try {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index c60bc7648..c2cf30247 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -23,10 +23,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.util
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -80,8 +80,8 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
val resolvedInputKeyMapping = resolveInputKeyMappingVariables(inputKeyMapping).toMutableMap()
inputKeyMapping?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
// Resolving content Variables
val payload = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.payload), resolvedInputKeyMapping)
@@ -92,7 +92,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
logger.info(
"RestResource ($dSource) dictionary information: " +
- "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val requestHeaders = sourceProperties.headers
logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
@@ -120,8 +120,10 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process REST resource resolution in template key ($resourceAssignment) assignments."
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, errorMsg)
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 1be9649b9..54231da61 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
@@ -93,7 +93,7 @@ class ResourceAssignmentUtils {
resourceAssignment.dictionaryName = resourceAssignment.name
logger.warn(
"Missing dictionary key, setting with template key (${resourceAssignment.name}) " +
- "as dictionary key (${resourceAssignment.dictionaryName})"
+ "as dictionary key (${resourceAssignment.dictionaryName})"
)
}
@@ -103,8 +103,8 @@ class ResourceAssignmentUtils {
val valueToPrint = getValueToLog(metadata, value)
logger.info(
"Setting Resource Value ($valueToPrint) for Resource Name " +
- "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
- "of type (${resourceProp.type})"
+ "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
+ "of type (${resourceProp.type})"
)
setResourceValue(resourceAssignment, raRuntimeService, value)
resourceAssignment.updatedDate = Date()
@@ -114,8 +114,9 @@ class ResourceAssignmentUtils {
} catch (e: Exception) {
throw BluePrintProcessorException(
"Failed in setting value for template key " +
- "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " +
- "type (${resourceProp.type}) with error message (${e.message})", e
+ "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " +
+ "type (${resourceProp.type}) with error message (${e.message})",
+ e
)
}
}
@@ -132,29 +133,32 @@ class ResourceAssignmentUtils {
val metadata = resourceAssignment.property?.metadata
metadata?.get(ResourceResolutionConstants.METADATA_TRANSFORM_TEMPLATE)
- ?.let { if (it.contains("$")) it else null }
- ?.let { template ->
- val resolutionStore = raRuntimeService.getResolutionStore()
- .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
- val newValue: JsonNode
- try {
- newValue = BluePrintVelocityTemplateService
- .generateContent(template, null, true, resolutionStore)
- .also { if (hasLogProtect(metadata))
- logger.info("Transformed value: $resourceAssignment.name")
- else
- logger.info("Transformed value: $value -> $it") }
- .let { v -> v.asJsonType() }
- } catch (e: Exception) {
- throw BluePrintProcessorException(
- "transform-template failed: $template", e)
- }
- with(resourceAssignment) {
- raRuntimeService.putResolutionStore(this.name, newValue)
- raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
- this.property!!.value = newValue
- }
+ ?.let { if (it.contains("$")) it else null }
+ ?.let { template ->
+ val resolutionStore = raRuntimeService.getResolutionStore()
+ .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
+ val newValue: JsonNode
+ try {
+ newValue = BluePrintVelocityTemplateService
+ .generateContent(template, null, true, resolutionStore)
+ .also {
+ if (hasLogProtect(metadata))
+ logger.info("Transformed value: $resourceAssignment.name")
+ else
+ logger.info("Transformed value: $value -> $it")
+ }
+ .let { v -> v.asJsonType() }
+ } catch (e: Exception) {
+ throw BluePrintProcessorException(
+ "transform-template failed: $template", e
+ )
}
+ with(resourceAssignment) {
+ raRuntimeService.putResolutionStore(this.name, newValue)
+ raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
+ this.property!!.value = newValue
+ }
+ }
}
fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) {
@@ -199,7 +203,7 @@ class ResourceAssignmentUtils {
}
}
result = mapper.writerWithDefaultPrettyPrinter()
- .writeValueAsString(mapper.treeToValue(root, Object::class.java))
+ .writeValueAsString(mapper.treeToValue(root, Object::class.java))
if (!containsLogProtected) {
logger.info("Generated Resource Param Data ($result)")
@@ -238,35 +242,35 @@ class ResourceAssignmentUtils {
val definition = resourceDefinitions[it.name]
val description = definition?.property?.description ?: ""
val value = it.property?.value
- ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
- ?: emptyTextNode
+ ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
+ ?: emptyTextNode
var payload: JsonNode = definition?.sources?.get(it.dictionarySource)
- ?.properties?.get("resolved-payload")
- ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
- ?: emptyTextNode
+ ?.properties?.get("resolved-payload")
+ ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
+ ?: emptyTextNode
val metadata = definition?.property?.metadata
- ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
- ?.toMutableList() ?: mutableListOf()
+ ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
+ ?.toMutableList() ?: mutableListOf()
val keyIdentifiers: MutableList<KeyIdentifier> = it.keyIdentifiers.map { k ->
if (k.value.isNullOrMissing()) KeyIdentifier(k.name, emptyTextNode) else k
}.toMutableList()
ResolutionSummary(
- it.name,
- value,
- it.property?.required ?: false,
- it.property?.type ?: "",
- keyIdentifiers,
- description,
- metadata,
- it.dictionaryName ?: "",
- it.dictionarySource ?: "",
- payload,
- it.status ?: "",
- it.message ?: ""
+ it.name,
+ value,
+ it.property?.required ?: false,
+ it.property?.type ?: "",
+ keyIdentifiers,
+ description,
+ metadata,
+ it.dictionaryName ?: "",
+ it.dictionarySource ?: "",
+ payload,
+ it.status ?: "",
+ it.message ?: ""
)
}
// Wrapper needed for integration with SDNC
@@ -409,7 +413,7 @@ class ResourceAssignmentUtils {
if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) {
throw BluePrintProcessorException(
"Couldn't get data type for dictionary type " +
- "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
+ "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
)
}
val entrySchemaType = resourceAssignment.property!!.entrySchema!!.type
@@ -487,7 +491,7 @@ class ResourceAssignmentUtils {
val outputKeyMap = outputKeyMapping.entries.first()
if (resourceAssignment.keyIdentifiers.none { it.name == outputKeyMap.key }) {
resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
+ KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
)
}
return parseSingleElementNodeWithOneOutputKeyMapping(
@@ -576,13 +580,14 @@ class ResourceAssignmentUtils {
logKeyValueResolvedResource(metadata, outputKeyMappingKey, responseKeyValue, type)
JacksonUtils.populateJsonNodeValues(outputKeyMappingKey, responseKeyValue, type, arrayChildNode)
resourceAssignment.keyIdentifiers.find { it.name == outputKeyMappingKey && it.value.isArray }
- .let {
- if (it != null)
- (it.value as ArrayNode).add(responseKeyValue)
- else
- resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMappingKey, responseKeyValue))
- }
+ .let {
+ if (it != null)
+ (it.value as ArrayNode).add(responseKeyValue)
+ else
+ resourceAssignment.keyIdentifiers.add(
+ KeyIdentifier(outputKeyMappingKey, responseKeyValue)
+ )
+ }
return arrayChildNode
}
@@ -694,7 +699,7 @@ class ResourceAssignmentUtils {
logger.info(
"For List Type Resource: key ($key), value ($valueToPrint), " +
- "type ({$type})"
+ "type ({$type})"
)
}
@@ -703,6 +708,6 @@ class ResourceAssignmentUtils {
}
fun getValueToLog(metadata: MutableMap<String, String>?, value: Any): Any =
- if (hasLogProtect(metadata)) LOG_REDACTED else value
+ if (hasLogProtect(metadata)) LOG_REDACTED else value
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
index d3641a850..1bf854cbd 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
@@ -45,47 +45,48 @@ object ResourceDefinitionUtils {
resolveDefinition: String,
sources: List<String>
):
- MutableList<ResourceAssignment> {
- /** Check if resolve definition is defined in the resource definition Map */
- val resourceDefinition = resourceDefinitions[resolveDefinition]
- ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
+ MutableList<ResourceAssignment> {
+ /** Check if resolve definition is defined in the resource definition Map */
+ val resourceDefinition = resourceDefinitions[resolveDefinition]
+ ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
- val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- /** Get the dependency property fields for the the resource definition to resolve */
- val definitionDependencies = definitionDependencies(resourceDefinition, sources)
- definitionDependencies.forEach { definitionDependencyName ->
- val definitionDependency = resourceDefinitions[definitionDependencyName]
- ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
+ val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- val resourceAssignment = ResourceAssignment().apply {
- name = definitionDependency.name
- dictionaryName = definitionDependency.name
- /** The assumption is al resource are already resolved and shall get as input source */
- dictionarySource = "input"
- property = definitionDependency.property
- }
- resourceAssignments.add(resourceAssignment)
- }
+ /** Get the dependency property fields for the the resource definition to resolve */
+ val definitionDependencies = definitionDependencies(resourceDefinition, sources)
+ definitionDependencies.forEach { definitionDependencyName ->
+ val definitionDependency = resourceDefinitions[definitionDependencyName]
+ ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
- resourceDefinition.sources.forEach { (sourceName, source) ->
- if (sources.contains(sourceName)) {
val resourceAssignment = ResourceAssignment().apply {
- name = "$sourceName:${resourceDefinition.name}"
- dictionaryName = resourceDefinition.name
- dictionarySource = sourceName
- dictionarySourceDefinition = source
- // Clone the PropertyDefinition, otherwise property value will be overridden
- property = JacksonUtils
- .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
- val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
- if (keyDependenciesExists) {
- dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
- }
+ name = definitionDependency.name
+ dictionaryName = definitionDependency.name
+ /** The assumption is al resource are already resolved and shall get as input source */
+ dictionarySource = "input"
+ property = definitionDependency.property
}
resourceAssignments.add(resourceAssignment)
}
+
+ resourceDefinition.sources.forEach { (sourceName, source) ->
+ if (sources.contains(sourceName)) {
+ val resourceAssignment = ResourceAssignment().apply {
+ name = "$sourceName:${resourceDefinition.name}"
+ dictionaryName = resourceDefinition.name
+ dictionarySource = sourceName
+ dictionarySourceDefinition = source
+ // Clone the PropertyDefinition, otherwise property value will be overridden
+ property = JacksonUtils
+ .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
+ val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
+ if (keyDependenciesExists) {
+ dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
+ }
+ }
+ resourceAssignments.add(resourceAssignment)
+ }
+ }
+ // Populate Resource Definition's dependencies as Input Resource Assignment
+ return resourceAssignments
}
- // Populate Resource Definition's dependencies as Input Resource Assignment
- return resourceAssignments
- }
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
index d1347113a..f7c41bdac 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
@@ -48,7 +48,8 @@ class ResourceResolutionComponentDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
}
outputs {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index d6fc52230..a22a73f2f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -95,7 +95,8 @@ class ResourceResolutionServiceTest {
"source-input", "source-default", "source-db",
"source-rest", "source-capability"
)
- ), "failed to get registered sources : $sources"
+ ),
+ "failed to get registered sources : $sources"
)
}
@@ -140,9 +141,9 @@ class ResourceResolutionServiceTest {
assertEquals("This is Sample Velocity Template", templateMap)
val expectedAssignmentMap = hashMapOf(
- "service-instance-id" to "siid_1234",
- "vnf-id" to "vnf_1234",
- "vnf_name" to "temp_vnf"
+ "service-instance-id" to "siid_1234",
+ "vnf-id" to "vnf_1234",
+ "vnf_name" to "temp_vnf"
).asJsonType()
assertEquals(expectedAssignmentMap, assignmentMap)
}
@@ -226,7 +227,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
@@ -239,36 +241,36 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
val artifactPrefix = "notemplate"
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
val summaries = JacksonUtils.jsonNode(it.first)["resolution-summary"]
@@ -285,43 +287,46 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
- assertEquals("""
+ assertEquals(
+ """
{
"service-instance-id" : "siid_1234",
"vnf-id" : "vnf_1234",
"vnf_name" : "temp_vnf"
}
- """.trimIndent(), it.first)
+ """.trimIndent(),
+ it.first
+ )
assertEquals("siid_1234", it.second["service-instance-id"].asText())
}
}
@@ -364,7 +369,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
index 121fff7cb..096d7ff27 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
index e252b4153..8a954c130 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
@@ -51,6 +51,7 @@ import kotlin.test.assertTrue
*/
class IpAssignResolutionCapabilityTest {
+
val log = logger(IpAssignResolutionCapabilityTest::class)
@Before
@@ -61,7 +62,8 @@ class IpAssignResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse(
- 200, """{
+ 200,
+ """{
"fixed_ipv4_Address_01" : "10.10.10.11",
"fixed_ipv4_Address_02" : "10.10.10.12",
"fixed_ipv4_Address_03" : "10.10.10.13"
@@ -133,8 +135,10 @@ class IpAssignResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
@@ -148,7 +152,7 @@ class IpAssignResolutionCapabilityTest {
}
}
- /** Test dictionaries */
+ /** Test dictionaries */
/** Test dictionaries */
private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
index ee53f8a04..449845f7f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
@@ -64,7 +64,8 @@ class NamingResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse<String>(
- 200, """{
+ 200,
+ """{
"vf-module-name" : "dlsst001dbcx-adsf-Base-01",
"vnfc-name" : "dlsst001dbcx"
}
@@ -136,8 +137,10 @@ class NamingResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
index 672d4b75d..fa59876a9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
@@ -239,8 +239,8 @@ open class ResourceResolutionDBServiceTest {
} returns ResourceResolution()
runBlocking {
resourceResolutionDBService.write(
- props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
- )
+ props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
+ )
val res = slot.captured
@@ -255,7 +255,8 @@ open class ResourceResolutionDBServiceTest {
} returns Unit
runBlocking {
val res = resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName, blueprintVersion, artifactPrefix, resolutionKey)
+ blueprintName, blueprintVersion, artifactPrefix, resolutionKey
+ )
assertEquals(Unit, res)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
index 61e9f51c9..a2ec75d02 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
@@ -24,13 +24,13 @@ class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintProperti
fun mockBlueprintWebClientService(selector: String):
MockBlueprintWebClientService {
- val prefix = "blueprintsprocessor.restclient.$selector"
- val restClientProperties = restClientProperties(prefix)
- return mockBlueprintWebClientService(restClientProperties)
- }
+ val prefix = "blueprintsprocessor.restclient.$selector"
+ val restClientProperties = restClientProperties(prefix)
+ return mockBlueprintWebClientService(restClientProperties)
+ }
private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties):
MockBlueprintWebClientService {
- return MockBlueprintWebClientService(restClientProperties)
- }
+ return MockBlueprintWebClientService(restClientProperties)
+ }
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
index e27f3ef1b..53db7563f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
@@ -29,6 +29,7 @@ import java.util.Base64
class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) :
BlueprintWebClientService {
+
private var mockServer: ClientAndServer
private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080"
else restClientProperties.url.split(":")[2]
@@ -41,7 +42,8 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
// Create expected requests and responses
setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456")
setRequest(
- "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
+ "GET",
+ "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
"vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
)
setRequestWithPayload(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
index 3600156ce..0312126b7 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
@@ -33,7 +33,7 @@ import java.util.HashMap
class MockRestResourceResolutionProcessor(
private val blueprintRestLibPropertyService:
- MockBluePrintRestLibPropertyService
+ MockBluePrintRestLibPropertyService
) : ResourceAssignmentProcessor() {
private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
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 5fbe32e07..f618b41db 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
@@ -139,6 +139,7 @@ class CapabilityResourceResolutionProcessorTest {
open class MockCapabilityService
open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
+
val log = logger(MockCapabilityScriptRA::class)
override fun getName(): String {
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 57d2c1b60..0c8ec7d95 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
@@ -36,10 +36,12 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [TestDatabaseConfiguration::class,
+ classes = [
+ TestDatabaseConfiguration::class,
PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class,
DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class,
- MockBlueprintProcessorCatalogServiceImpl::class]
+ MockBlueprintProcessorCatalogServiceImpl::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class DatabaseResourceResolutionProcessorTest {
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 af78a604a..cb7214123 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
@@ -37,8 +37,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class]
+ classes = [
+ MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class RestResourceResolutionProcessorTest {
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 59be79568..2f07e3b9a 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
@@ -48,6 +48,7 @@ data class ExpectedResponseIp(val ip: String)
data class ExpectedResponseIpAddress(val ipAddress: IpAddress)
class ResourceAssignmentUtilsTest {
+
private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService
private lateinit var resourceAssignment: ResourceAssignment
@@ -180,9 +181,11 @@ class ResourceAssignmentUtilsTest {
}
val result = ResourceAssignmentUtils.generateResolutionSummaryData(
- listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition))
+ listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition)
+ )
- assertEquals("""
+ assertEquals(
+ """
{
"resolution-summary":[
{
@@ -203,7 +206,9 @@ class ResourceAssignmentUtilsTest {
}
]
}
- """.replace("\n|\\s".toRegex(), ""), result)
+ """.replace("\n|\\s".toRegex(), ""),
+ result
+ )
}
private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment {
@@ -243,8 +248,8 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for primitive type of key-value String"
)
assertEquals(
- expectedValueToTestPrimitiveType,
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestPrimitiveType,
+ resourceAssignment.keyIdentifiers[0].value
)
}
@@ -262,8 +267,8 @@ class ResourceAssignmentUtilsTest {
val expectedKeyIdentifierValue = JacksonUtils.getJsonNode(outcome.map { it["ip"] })
assertEquals(
- expectedKeyIdentifierValue,
- resourceAssignment.keyIdentifiers[0].value
+ expectedKeyIdentifierValue,
+ resourceAssignment.keyIdentifiers[0].value
)
// FIXME("Map is not collection type, It is known complex type")
@@ -313,8 +318,9 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for complex type"
)
assertEquals(
- expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
- resourceAssignment.keyIdentifiers[0].value)
+ expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
+ resourceAssignment.keyIdentifiers[0].value
+ )
}
@Test
@@ -330,13 +336,13 @@ class ResourceAssignmentUtilsTest {
)
assertEquals(2, resourceAssignment.keyIdentifiers.size)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
+ resourceAssignment.keyIdentifiers[0].value
)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
- resourceAssignment.keyIdentifiers[1].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
+ resourceAssignment.keyIdentifiers[1].value
)
}
@@ -351,13 +357,15 @@ class ResourceAssignmentUtilsTest {
// Enable transform template
resourceAssignment.property!!.metadata =
- mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
+ mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
ResourceAssignmentUtils
- .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
+ .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
- assertEquals("abc-vnf_private2",
- resourceAssignment.property!!.value!!.asText())
+ assertEquals(
+ "abc-vnf_private2",
+ resourceAssignment.property!!.value!!.asText()
+ )
}
private fun initInputMapAndExpectedValuesForPrimitiveType() {
@@ -412,7 +420,8 @@ class ResourceAssignmentUtilsTest {
expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(
ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
- ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
+ ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")),
+ ExpectedResponseIpAddress(
IpAddress("3333", "1.2.3.3")
)
).asJsonType()
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
index 408eaf45b..7aabb73e6 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
@@ -81,7 +81,7 @@ suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(
log.debug("headers: $additionalHeaders")
log.info("configuring device: $deviceId, Configlet: $configletToApply")
val applyConfigUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
- "$deviceId/$configletResourcePath"
+ "$deviceId/$configletResourcePath"
return webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
}
@@ -90,13 +90,13 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(
deviceId: String,
configletResourcePath: String
):
- BlueprintWebClientService.WebClientResponse<String> {
+ BlueprintWebClientService.WebClientResponse<String> {
- val configPathUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
+ val configPathUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
- log.debug("sending GET request, url: $configPathUrl")
- return webClientService.exchangeResource("GET", configPathUrl, "")
-}
+ log.debug("sending GET request, url: $configPathUrl")
+ return webClientService.exchangeResource("GET", configPathUrl, "")
+ }
/**
* Generic UnMount function
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
index e1643b576..a8e02f391 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
@@ -32,6 +32,7 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
lateinit var scriptComponent: RestfulCMComponentFunction
companion object {
+
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
@@ -53,8 +54,10 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
* Populate the Script Instance based on the Type
*/
scriptComponent = componentFunctionScriptingService
- .scriptInstance<RestfulCMComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
+ .scriptInstance<RestfulCMComponentFunction>(
+ this, scriptType,
+ scriptClassReference, scriptDependencies
+ )
checkNotNull(scriptComponent) { "failed to get restfulCM script component" }
@@ -64,6 +67,6 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
index 46fec3126..9cd6f57a4 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
@@ -15,18 +15,18 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient
import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
@@ -41,7 +41,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
}
open fun bluePrintRestLibPropertyService(): BluePrintRestLibPropertyService =
- functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
+ functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
fun restClientService(clientInfo: JsonNode): BlueprintWebClientService {
return bluePrintRestLibPropertyService().blueprintWebClientService(clientInfo)
@@ -105,7 +105,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
}
}
"config-delete" -> {
- for (managed_object_instance in managed_object_instances) {
+ for (managed_object_instance in managed_object_instances) {
// invoke deleteMOI for each managed-object-instance
log.info("invoke deleteMOI for each managed-object-instance")
var NRM_Restful_client = RestfulNRMServiceClient()
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
index 31ad377c9..259670d47 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
@@ -19,12 +19,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfun
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.springframework.http.HttpMethod
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import java.util.UUID
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.http.HttpMethod
import org.springframework.web.util.UriComponentsBuilder
+import java.util.UUID
class RestfulNRMServiceClient() {
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
index e7f04a5d4..6f76c9b40 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
@@ -17,40 +17,42 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction
import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.junit.Test
import org.junit.Ignore
-import org.springframework.beans.factory.annotation.Autowired
+import org.junit.Test
import org.junit.runner.RunWith
-import org.springframework.test.context.junit4.SpringRunner
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.http.HttpStatus
+import org.springframework.http.ResponseEntity
import org.springframework.test.context.ContextConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration
import org.springframework.test.context.TestPropertySource
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
-import kotlin.test.assertNotNull
-import kotlin.test.assertEquals
-import org.springframework.web.bind.annotation.RestController
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.PutMapping
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PatchMapping
-import org.springframework.web.bind.annotation.DeleteMapping
-import org.springframework.http.ResponseEntity
-import org.springframework.http.HttpStatus
+import org.springframework.web.bind.annotation.PutMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, NrmTestController::class])
-@TestPropertySource(properties = [
- "blueprintsprocessor.restclient.nrm.type=basic-auth",
- "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080",
- "blueprintsprocessor.restclient.nrm.username=admin",
- "blueprintsprocessor.restclient.nrm.password=admin"
-])
+@TestPropertySource(
+ properties = [
+ "blueprintsprocessor.restclient.nrm.type=basic-auth",
+ "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080",
+ "blueprintsprocessor.restclient.nrm.username=admin",
+ "blueprintsprocessor.restclient.nrm.password=admin"
+ ]
+)
@Ignore
class RestfulNRMServiceClientTest {
@@ -100,7 +102,11 @@ class RestfulNRMServiceClientTest {
test_moi_data.put("data", test_attributes_data)
val response = restfulNRMServiceClient.modifyMOIAttributes(restClientService, idStr, test_moi_data)
assertNotNull(response, "failed to get modifyMOIAttributes response")
- assertEquals("Modify MOI object attributes successfully", response.get("body").get("data").toString(), "failed to get modifyMOIAttributes response")
+ assertEquals(
+ "Modify MOI object attributes successfully",
+ response.get("body").get("data").toString(),
+ "failed to get modifyMOIAttributes response"
+ )
}
@Test
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
index a0ef565cc..0eba001c2 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
@@ -116,6 +116,7 @@ object BluePrintConstants {
const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo"
const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo"
const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo"
+
// CDS Defined Relationship Types
const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_DB = "tosca.relationships.ConnectsTo.Db"
const val MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_REST_CLIENT = "tosca.relationships.ConnectsTo.RestClient"
@@ -154,6 +155,7 @@ object BluePrintConstants {
const val MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT = "tosca.capabilities.Attachment"
const val MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM = "tosca.capabilities.OperatingSystem"
const val MODEL_TYPE_CAPABILITY_TYPE_BINDABLE = "tosca.capabilities.network.Bindable"
+
// Custom capabilities
const val MODEL_TYPE_CAPABILITY_TYPE_CONTENT = "tosca.capabilities.Content"
const val MODEL_TYPE_CAPABILITY_TYPE_MAPPING = "tosca.capabilities.Mapping"
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
index 66d54f52e..71a107171 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.controllerblueprints.core
class BluePrintError {
+
var errors: MutableList<String> = arrayListOf()
fun addError(type: String, name: String, error: String) {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
index 310c9b05b..c818b0a44 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
@@ -130,40 +130,40 @@ fun grpcProcessorException(type: String, domain: String, message: String): BlueP
}
fun httpProcessorException(type: String, domain: String, message: String, cause: Throwable):
- BluePrintProcessorException {
- val bluePrintProcessorException = processorException(message, cause).http(type)
- return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
-}
+ BluePrintProcessorException {
+ val bluePrintProcessorException = processorException(message, cause).http(type)
+ return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
+ }
fun grpcProcessorException(type: String, domain: String, message: String, cause: Throwable):
- BluePrintProcessorException {
- val bluePrintProcessorException = processorException(message, cause).grpc(type)
- return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
-}
+ BluePrintProcessorException {
+ val bluePrintProcessorException = processorException(message, cause).grpc(type)
+ return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
+ }
fun httpProcessorException(type: String, domain: String, message: String, cause: Throwable, vararg args: Any?):
- BluePrintProcessorException {
- val bluePrintProcessorException = processorException(cause, message, args).http(type)
- return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
-}
+ BluePrintProcessorException {
+ val bluePrintProcessorException = processorException(cause, message, args).http(type)
+ return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
+ }
fun grpcProcessorException(type: String, domain: String, message: String, cause: Throwable, vararg args: Any?):
- BluePrintProcessorException {
- val bluePrintProcessorException = processorException(cause, message, args).grpc(type)
- return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
-}
+ BluePrintProcessorException {
+ val bluePrintProcessorException = processorException(cause, message, args).grpc(type)
+ return bluePrintProcessorException.addDomainAndErrorMessage(domain, message, ExceptionUtils.getRootCauseMessage(cause))
+ }
fun BluePrintProcessorException.updateErrorMessage(domain: String, message: String, cause: String):
- BluePrintProcessorException {
- return this.addDomainAndErrorMessage(domain, message, cause).domain(domain)
+ BluePrintProcessorException {
+ return this.addDomainAndErrorMessage(domain, message, cause).domain(domain)
.addErrorPayloadMessage(message)
.payloadMessage(message)
-}
+ }
fun BluePrintProcessorException.updateErrorMessage(domain: String, message: String): BluePrintProcessorException {
return this.addDomainAndErrorMessage(domain, message).domain(domain)
- .addErrorPayloadMessage(message)
- .payloadMessage(message)
+ .addErrorPayloadMessage(message)
+ .payloadMessage(message)
}
private fun BluePrintProcessorException.addDomainAndErrorMessage(
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 4ab3d6f86..ebe682611 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -61,8 +61,10 @@ fun String.splitCommaAsList(): List<String> {
}
fun String.isJson(): Boolean {
- return ((this.trim().startsWith("{") && this.trim().endsWith("}")) ||
- (this.trim().startsWith("[") && this.trim().endsWith("]")))
+ return (
+ (this.trim().startsWith("{") && this.trim().endsWith("}")) ||
+ (this.trim().startsWith("[") && this.trim().endsWith("]"))
+ )
}
fun Any.asJsonString(intend: Boolean? = false): String {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
index 35f7ef184..229fc7cc6 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.controllerblueprints.core.common
object ApplicationConstants {
+
const val ACTIVE_Y = "Y"
const val ACTIVE_N = "N"
const val ASDC_ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL"
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
index 0128f64a5..adfbf2905 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.controllerblueprints.core.config
open class BluePrintLoadConfiguration {
+
lateinit var blueprintDeployPath: String
lateinit var blueprintArchivePath: String
lateinit var blueprintWorkingPath: String
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
index 9c9b1f9bf..b833db755 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
@@ -38,6 +38,7 @@ enum class NodeStatus(val id: String) {
}
class Graph {
+
val nodes: MutableMap<String, Node> = hashMapOf()
val edges: MutableSet<Edge> = mutableSetOf()
@@ -93,6 +94,7 @@ class Graph {
}
data class Node(val id: String, var status: NodeStatus = NodeStatus.NOT_STARTED) {
+
val edges: MutableList<Edge> = ArrayList()
fun neighbors(): List<Node> = edges.map { edge -> edge.target(this) }
@@ -116,7 +118,7 @@ class Graph {
fun equivalentTo(other: Edge) =
(source == other.source && target == other.target) ||
- (source == other.target && target == other.source)
+ (source == other.target && target == other.source)
override fun toString() =
"${source.id}>${target.id}/$label($status)"
@@ -125,6 +127,7 @@ class Graph {
data class TermForm(val nodes: Collection<String>, val edges: List<Term>) {
data class Term(val source: String, val target: String, val label: EdgeLabel) {
+
override fun toString() = "Term($source, $target, $label)"
}
}
@@ -141,6 +144,7 @@ class Graph {
}
data class Link<out String, out EdgeLabel>(val node: String, val label: EdgeLabel) {
+
override fun toString() = if (label == null) "$node" else "$node/$label"
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
index 8968ce3ef..9f32d8830 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
@@ -38,6 +38,7 @@ open class EntityType {
var description: String? = null
var version: String = "1.0.0"
var metadata: MutableMap<String, String>? = null
+
@get:JsonProperty("derived_from")
lateinit var derivedFrom: String
var attributes: MutableMap<String, AttributeDefinition>? = null
@@ -54,6 +55,7 @@ class Credential {
@get:JsonIgnore
var id: String? = null
var protocol: String? = null
+
@get:JsonProperty("token_type")
lateinit var tokenType: String
lateinit var token: String
@@ -68,21 +70,29 @@ A constraint clause defines an operation along with one or more compatible value
class ConstraintClause {
var equal: JsonNode? = null
+
@get:JsonProperty("greater_than")
var greaterThan: JsonNode? = null
+
@get:JsonProperty("greater_or_equal")
var greaterOrEqual: JsonNode? = null
+
@get:JsonProperty("less_than")
var lessThan: JsonNode? = null
+
@get:JsonProperty("less_or_equal")
var lessOrEqual: JsonNode? = null
+
@get:JsonProperty("in_range")
var inRange: MutableList<JsonNode>? = null
+
@get:JsonProperty("valid_values")
var validValues: MutableList<JsonNode>? = null
var length: JsonNode? = null
+
@get:JsonProperty("min_length")
var minLength: JsonNode? = null
+
@get:JsonProperty("max_length")
var maxLength: JsonNode? = null
var pattern: String? = null
@@ -95,6 +105,7 @@ A node filter definition defines criteria for selection of a TOSCA Node Template
*/
class NodeFilterDefinition {
+
var properties: MutableMap<String, PropertyDefinition>? = null
var capabilities: MutableList<String>? = null
}
@@ -126,6 +137,7 @@ class ArtifactDefinition {
lateinit var file: String
var repository: String? = null
var description: String? = null
+
@get:JsonProperty("deploy_Path")
var deployPath: String? = null
var properties: MutableMap<String, JsonNode>? = null
@@ -143,8 +155,10 @@ class ImportDefinition {
var id: String? = null
lateinit var file: String
var repository: String? = null
+
@get:JsonProperty("namespace_uri")
var namespaceUri: String? = null
+
@get:JsonProperty("namespace_prefix")
var namespacePrefix: String? = null
}
@@ -162,17 +176,22 @@ class PropertyDefinition {
var description: String? = null
var required: Boolean? = null
lateinit var type: String
+
@get:JsonProperty("input-param")
var inputparam: Boolean? = null
+
@get:JsonProperty("default")
var defaultValue: JsonNode? = null
var status: String? = null
var constraints: MutableList<ConstraintClause>? = null
+
@get:JsonProperty("entry_schema")
var entrySchema: EntrySchema? = null
+
@get:JsonProperty("external-schema")
var externalSchema: String? = null
var metadata: MutableMap<String, String>? = null
+
// Mainly used in Workflow Outputs
@get:ApiModelProperty(notes = "Property Value, It may be Expression or Json type values")
var value: JsonNode? = null
@@ -189,17 +208,21 @@ from the instance model and used as values to other entities within TOSCA Servic
*/
class AttributeDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
var required: Boolean? = null
lateinit var type: String
+
@JsonProperty("default")
var defaultValue: JsonNode? = null
var status: String? = null
var constraints: MutableList<ConstraintClause>? = null
+
@JsonProperty("entry_schema")
var entrySchema: EntrySchema? = null
+
// Mainly used in DSL definitions
@get:ApiModelProperty(notes = "Attribute Value, It may be Expression or Json type values")
var value: JsonNode? = null
@@ -220,16 +243,20 @@ class OperationDefinition {
}
class Implementation {
+
var primary: String? = null
var dependencies: MutableList<String>? = null
+
@get:JsonProperty("operation_host")
var operationHost: String = BluePrintConstants.PROPERTY_SELF
+
// Timeout value in seconds
var timeout: Int = 180
var lock: LockAssignment? = null
}
class LockAssignment {
+
lateinit var key: JsonNode
var acquireTimeout: JsonNode = Integer(180).asJsonType()
}
@@ -269,8 +296,10 @@ class TriggerDefinition {
@get:JsonIgnore
var id: String? = null
var description: String? = null
+
@get:JsonProperty("event_type")
lateinit var eventType: String
+
@get:JsonProperty("target_filter")
var targetFilter: EventFilterDefinition? = null
var condition: ConditionClause? = null
@@ -290,8 +319,10 @@ class TriggerDefinition {
class Activity {
var delegate: String? = null
+
@get:JsonProperty("set_state")
var setState: String? = null
+
@get:JsonProperty("call_operation")
var callOperation: String? = null
var inlines: ArrayList<String>? = null
@@ -306,6 +337,7 @@ class PreConditionDefinition {
@get:JsonIgnore
var id: String? = null
lateinit var target: String
+
@get:JsonProperty("target_relationship")
lateinit var targetRelationship: String
lateinit var condition: ArrayList<ConditionClause>
@@ -321,13 +353,17 @@ class Step {
var id: String? = null
var description: String? = null
var target: String? = null
+
@JsonProperty("target_relationship")
var targetRelationship: String? = null
+
@JsonProperty("operation_host")
var operationHost: String? = null
var activities: ArrayList<Activity>? = null
+
@get:JsonProperty("on_success")
var onSuccess: ArrayList<String>? = null
+
@get:JsonProperty("on_failure")
var onFailure: ArrayList<String>? = null
}
@@ -338,11 +374,13 @@ A capability definition defines a named, typed set of data that can be associate
*/
class CapabilityDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
var description: String? = null
var properties: MutableMap<String, PropertyDefinition>? = null
+
@get:JsonProperty("valid_source_types")
var validSourceTypes: MutableList<String>? = null
var occurrences: MutableList<Any>? = null
@@ -371,6 +409,7 @@ class ArtifactType : EntityType() {
@get:JsonProperty("mime_type")
var mimeType: String? = null
+
@get:JsonProperty("file_ext")
var fileExt: MutableList<String>? = null
}
@@ -381,6 +420,7 @@ A Data Type definition defines the schema for new named datatypes in TOSCA.
*/
class DataType : EntityType() {
+
var constraints: MutableList<ConstraintClause>? = null
}
@@ -391,6 +431,7 @@ A Node Type is a reusable entity that defines the type of one or more Node Templ
*/
class NodeType : EntityType() {
+
var capabilities: MutableMap<String, CapabilityDefinition>? = null
var requirements: MutableMap<String, RequirementDefinition>? = null
var interfaces: MutableMap<String, InterfaceDefinition>? = null
@@ -406,6 +447,7 @@ along with a named Feature notation.
*/
class RequirementType : EntityType() {
+
var requirements: MutableMap<String, RequirementDefinition>? = null
var capabilities: MutableMap<String, CapabilityDefinition>? = null
var interfaces: MutableMap<String, InterfaceDefinition>? = null
@@ -418,7 +460,9 @@ A Relationship Type is a reusable entity that defines the type of one or more re
*/
class RelationshipType : EntityType() {
+
var interfaces: MutableMap<String, InterfaceDefinition>? = null
+
@get:JsonProperty("valid_target_types")
var validTargetTypes: MutableList<String>? = null
}
@@ -432,6 +476,7 @@ Groups can effectively be viewed as logical nodes that are not part of the physi
*/
class GroupType : EntityType() {
+
var members: MutableList<String>? = null
var requirements: ArrayList<RequirementDefinition>? = null
var capabilities: MutableMap<String, CapabilityDefinition>? = null
@@ -502,18 +547,22 @@ class TopologyTemplate {
var id: String? = null
var description: String? = null
var inputs: MutableMap<String, PropertyDefinition>? = null
+
@get:JsonProperty("node_templates")
var nodeTemplates: MutableMap<String, NodeTemplate>? = null
+
@get:JsonProperty("relationship_templates")
var relationshipTemplates: MutableMap<String, RelationshipTemplate>? = null
var policies: MutableMap<String, PolicyDefinition>? = null
var outputs: MutableMap<String, PropertyDefinition>? = null
+
@get:JsonProperty("substitution_mappings")
var substitutionMappings: Any? = null
var workflows: MutableMap<String, Workflow>? = null
}
class SubstitutionMapping {
+
@get:JsonProperty("node_type")
lateinit var nodeType: String
lateinit var capabilities: ArrayList<String>
@@ -521,11 +570,13 @@ class SubstitutionMapping {
}
class EntrySchema {
+
lateinit var type: String
var constraints: MutableList<ConstraintClause>? = null
}
class InterfaceAssignment {
+
@get:JsonIgnore
var id: String? = null
var operations: MutableMap<String, OperationAssignment>? = null
@@ -538,12 +589,14 @@ A Node Template specifies the occurrence of a manageable software component as p
*/
open class NodeTemplate {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
lateinit var type: String
var metadata: MutableMap<String, String>? = null
var directives: MutableList<String>? = null
+
// @get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
var properties: MutableMap<String, JsonNode>? = null
var attributes: MutableMap<String, JsonNode>? = null
@@ -551,12 +604,14 @@ open class NodeTemplate {
var requirements: MutableMap<String, RequirementAssignment>? = null
var interfaces: MutableMap<String, InterfaceAssignment>? = null
var artifacts: MutableMap<String, ArtifactDefinition>? = null
+
@get:JsonProperty("node_filter")
var nodeFilter: NodeFilterDefinition? = null
var copy: String? = null
}
class OperationAssignment {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -571,6 +626,7 @@ A Relationship Template specifies the occurrence of a manageable relationship be
*/
class RelationshipTemplate {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -588,15 +644,18 @@ A Requirement assignment allows template authors to provide either concrete name
*/
class RequirementAssignment {
+
@get:JsonIgnore
var id: String? = null
var capability: String? = null
var node: String? = null
+
// Relationship Type or Relationship Template
var relationship: String? = null
}
class Workflow {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -607,8 +666,10 @@ class Workflow {
}
class ConditionClause {
+
var and: ArrayList<MutableMap<String, Any>>? = null
var or: ArrayList<MutableMap<String, Any>>? = null
+
@get:JsonProperty("assert")
var assertConditions: ArrayList<MutableMap<String, Any>>? = null
}
@@ -619,31 +680,41 @@ A TOSCA Service Template (YAML) document contains element definitions of buildin
*/
@JsonPropertyOrder(
- value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
- "topologyTemplate"]
+ value = [
+ "toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
+ "topologyTemplate"
+ ]
)
class ServiceTemplate : Cloneable {
@get:JsonIgnore
var id: String? = null
+
@get:JsonProperty("tosca_definitions_version")
var toscaDefinitionsVersion: String = "controller_blueprint_1_0_0"
var metadata: MutableMap<String, String>? = null
var description: String? = null
+
@get:JsonProperty("dsl_definitions")
var dslDefinitions: MutableMap<String, JsonNode>? = null
var repositories: MutableMap<String, RepositoryDefinition>? = null
var imports: MutableList<ImportDefinition>? = null
+
@get:JsonProperty("artifact_types")
var artifactTypes: MutableMap<String, ArtifactType>? = null
+
@get:JsonProperty("data_types")
var dataTypes: MutableMap<String, DataType>? = null
+
@get:JsonProperty("relationship_types")
var relationshipTypes: MutableMap<String, RelationshipType>? = null
+
@get:JsonProperty("node_types")
var nodeTypes: MutableMap<String, NodeType>? = null
+
@get:JsonProperty("policy_types")
var policyTypes: MutableMap<String, PolicyType>? = null
+
@get:JsonProperty("topology_template")
var topologyTemplate: TopologyTemplate? = null
@@ -653,6 +724,7 @@ class ServiceTemplate : Cloneable {
}
class ToscaMetaData {
+
lateinit var toscaMetaFileVersion: String
lateinit var csarVersion: String
lateinit var createdBy: String
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
index 8bdedd429..50f5becca 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
@@ -34,51 +34,61 @@ enum class ErrorCode(val value: Int, val httpCode: Int) {
}
},
INVALID_FILE_EXTENSION(2, 415) {
+
override fun message(detailMsg: String): String {
return "Unexpected file extension. Details : {$detailMsg}"
}
},
BLUEPRINT_PATH_MISSING(3, 503) {
+
override fun message(detailMsg: String): String {
return "Blueprint path missing or wrong. Details : {$detailMsg}"
}
},
BLUEPRINT_WRITING_FAIL(4, 503) {
+
override fun message(detailMsg: String): String {
return "Fail to write blueprint files. Details : {$detailMsg}"
}
},
IO_FILE_INTERRUPT(5, 503) {
+
override fun message(detailMsg: String): String {
return "IO file system interruption. Details : {$detailMsg}"
}
},
INVALID_REQUEST_FORMAT(6, 400) {
+
override fun message(detailMsg: String): String {
return "Bad request. Details : {$detailMsg}"
}
},
UNAUTHORIZED_REQUEST(7, 401) {
+
override fun message(detailMsg: String): String {
return "The request requires user authentication. Details : {$detailMsg}"
}
},
REQUEST_NOT_FOUND(8, 404) {
+
override fun message(detailMsg: String): String {
return "Request mapping doesn't exist. Details : {$detailMsg}"
}
},
RESOURCE_NOT_FOUND(9, 404) {
+
override fun message(detailMsg: String): String {
return "No response was found for this request in the server. Details : {$detailMsg}"
}
},
CONFLICT_ADDING_RESOURCE(10, 409) {
+
override fun message(detailMsg: String): String {
return "Duplicated entry while saving Blueprint. Details : {$detailMsg}"
}
},
DUPLICATE_DATA(11, 409) {
+
override fun message(detailMsg: String): String {
return "Duplicated data - was expecting one result, got more than one. Details : {$detailMsg}"
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
index 13e9f0e5a..bb426049f 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
@@ -16,13 +16,12 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
-abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignmentBuilder,
- In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
- id: String,
- type: String,
- private val interfaceName: String,
- description: String
- ) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
+abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignmentBuilder, In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
+ id: String,
+ type: String,
+ private val interfaceName: String,
+ description: String
+) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
open fun definedOperation(description: String, block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
typedOperation<In, Out>(interfaceName, description, block)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
index 64553230a..88f852d41 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
@@ -319,10 +319,10 @@ fun ServiceTemplateBuilder.artifactTypeK8sProfileFolder() {
fun BluePrintTypes.artifactTypeK8sProfileFolder(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "K8s Profile Folder Artifact"
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "K8s Profile Folder Artifact"
) {
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
index f2e964a1d..b469ded74 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
@@ -338,6 +338,7 @@ class DSLRegistryComponentBuilder(
}
class DSLWorkflowBuilder(private val actionName: String, private val description: String) {
+
private val dslWorkflow = DSLWorkflow()
private var steps: MutableMap<String, Step>? = null
private var inputs: MutableMap<String, PropertyDefinition>? = null
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
index 8b5c4151a..370531d2a 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
@@ -43,6 +43,7 @@ class DSLBluePrint {
}
class DSLWorkflow {
+
@get:JsonIgnore
var id: String? = null
lateinit var description: String
@@ -53,6 +54,7 @@ class DSLWorkflow {
}
class DSLComponent {
+
@get:JsonIgnore
lateinit var id: String
lateinit var type: String
@@ -67,6 +69,7 @@ class DSLComponent {
}
class DSLRegistryComponent {
+
lateinit var id: String
lateinit var type: String
lateinit var version: String
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index a89267387..3a3503403 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -35,6 +35,7 @@ import kotlin.reflect.full.createInstance
import kotlin.reflect.jvm.reflect
open class TopologyTemplateBuilder {
+
private var topologyTemplate = TopologyTemplate()
var nodeTemplates: MutableMap<String, NodeTemplate>? = null
var relationshipTemplates: MutableMap<String, RelationshipTemplate>? = null
@@ -222,6 +223,7 @@ open class RelationshipTemplateBuilder(
private val type: String,
private val description: String? = ""
) {
+
var relationshipTemplate: RelationshipTemplate = RelationshipTemplate()
var properties: MutableMap<String, JsonNode>? = null
@@ -293,6 +295,7 @@ class ArtifactDefinitionBuilder(private val id: String, private val type: String
}
open class CapabilityAssignmentBuilder(private val id: String) {
+
var capabilityAssignment: CapabilityAssignment = CapabilityAssignment()
var attributes: MutableMap<String, JsonNode>? = null
var properties: MutableMap<String, JsonNode>? = null
@@ -418,6 +421,7 @@ class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : Propert
}
class ImplementationBuilder(private val timeout: Int, private val operationHost: String) {
+
private val implementation = Implementation()
fun primary(primary: String) {
@@ -440,6 +444,7 @@ class ImplementationBuilder(private val timeout: Int, private val operationHost:
}
open class PropertiesAssignmentBuilder {
+
var properties: MutableMap<String, JsonNode> = hashMapOf()
fun property(id: String, value: Any) {
@@ -460,6 +465,7 @@ open class PropertiesAssignmentBuilder {
}
open class AttributesAssignmentBuilder {
+
var attributes: MutableMap<String, JsonNode> = hashMapOf()
fun attribute(id: String, value: String) {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
index e183b8090..3dfdbac57 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
@@ -402,6 +402,7 @@ class AttributeDefinitionBuilder(
}
class PropertiesDefinitionBuilder {
+
private val properties: MutableMap<String, PropertyDefinition> = hashMapOf()
fun property(id: String, property: PropertyDefinition) {
@@ -487,6 +488,7 @@ class PropertyDefinitionBuilder(
}
class ConstraintsClauseBuilder {
+
val constraints: MutableList<ConstraintClause> = mutableListOf()
fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
@@ -500,6 +502,7 @@ class ConstraintsClauseBuilder {
}
class ConstraintClauseBuilder {
+
private val constraintClause = ConstraintClause()
fun equal(equal: Any) = equal(equal.asJsonType())
@@ -564,6 +567,7 @@ class ConstraintClauseBuilder {
}
class EntrySchemaBuilder(private val type: String) {
+
private var entrySchema: EntrySchema = EntrySchema()
fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
index b657199c7..2080cd161 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
@@ -33,6 +33,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
interface BluePrintEnhancer<T> {
+
fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
index 6f6979772..1958e23ac 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
@@ -55,6 +55,7 @@ open class BluePrintJsonNodeFactory : JsonNodeFactory() {
}
open class BluePrintTextNode(v: String) : TextNode(v) {
+
override fun toString(): String {
var len = this._value.length
len = len + 2 + (len shr 4)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
index a9684a14d..d1b42ffe5 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
@@ -36,9 +36,11 @@ import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
import kotlin.system.measureTimeMillis
open class BluePrintCompileService {
+
val log = logger(BluePrintCompileService::class)
companion object {
+
val classPaths = classpathFromClasspathProperty()?.joinToString(File.pathSeparator) {
it.absolutePath
}
@@ -85,10 +87,12 @@ open class BluePrintCompileService {
}
val deferredCompile = async {
val k2jvmCompiler = K2JVMCompiler()
+
/** Construct Arguments */
val arguments = k2jvmCompiler.createArguments()
parseCommandLineArguments(args, arguments)
val messageCollector = CompilationMessageCollector()
+
/** Compile with arguments */
val exitCode: ExitCode = k2jvmCompiler.exec(messageCollector, Services.EMPTY, arguments)
when (exitCode) {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
index cb6616f38..a0efc619c 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
@@ -25,6 +25,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import java.net.URLClassLoader
object BluePrintCompileCache {
+
val log = logger(BluePrintCompileCache::class)
private val classLoaderCache: LoadingCache<String, URLClassLoader> = CacheBuilder.newBuilder()
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
index 7c0970202..7b11f71a2 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
@@ -57,6 +57,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
* Blueprint CBA extracted file location
*/
var rootPath = "."
+
/**
* Root Definition file path
*/
@@ -262,8 +263,8 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String):
Implementation? {
- return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).implementation
- }
+ return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).implementation
+ }
fun nodeTemplateInterfaceOperationInputs(
nodeTemplateName: String,
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
index b6c432b4d..193ff7888 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -46,9 +46,11 @@ object BluePrintExpressionService {
fun checkContainsExpression(propertyAssignmentNode: JsonNode): Boolean {
val json = propertyAssignmentNode.toString()
// FIXME("Check if any Optimisation needed")
- return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT) ||
+ return (
+ json.contains(BluePrintConstants.EXPRESSION_GET_INPUT) ||
json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE) ||
- json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
+ json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY)
+ )
}
@JvmStatic
@@ -110,8 +112,9 @@ object BluePrintExpressionService {
throw BluePrintException(
String.format(
"missing property expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
- "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
+ "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}",
+ jsonNode
)
)
}
@@ -149,8 +152,9 @@ object BluePrintExpressionService {
throw BluePrintException(
String.format(
"missing attribute expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
- " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
+ " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}",
+ jsonNode
)
)
}
@@ -189,7 +193,7 @@ object BluePrintExpressionService {
throw BluePrintException(
String.format(
"missing operation output expression, " +
- "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}",
+ "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}",
jsonNode
)
)
@@ -216,7 +220,8 @@ object BluePrintExpressionService {
throw BluePrintException(
String.format(
"missing artifact expression, " +
- "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode
+ "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}",
+ jsonNode
)
)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
index 24b7e261c..80b742705 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
@@ -30,6 +30,7 @@ import java.nio.charset.Charset
class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate, private val blueprintBasePath: String) {
companion object {
+
private const val PARENT_SERVICE_TEMPLATE: String = "parent"
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 53af9f7cb..873e3a082 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -450,19 +450,19 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability($capabilityName)")
- val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+ log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability($capabilityName)")
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
- val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+ val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
- val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
- .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+ val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
+ .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
- /**
- * Resolve the Capability Property Assignment Values.
- */
- return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions, propertyAssignments)
- }
+ /**
+ * Resolve the Capability Property Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions, propertyAssignments)
+ }
override fun resolveNodeTemplateInterfaceOperationInputs(
nodeTemplateName: String,
@@ -515,6 +515,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
?: hashMapOf()
+
/**
* Resolve the Property Output Assignment Values.
*/
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
index 51a6e10ee..d7f7b9a60 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
@@ -57,7 +57,7 @@ class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrint
else -> {
throw BluePrintProcessorException(
"Unknown Artifact type, expecting ${BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA}" +
- "or ${BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY}"
+ "or ${BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY}"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
index f492c2bc6..8a8ded752 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -331,7 +331,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
?: throw BluePrintException(
format(
"Failed to get NodeTemplate({}) capability definition ({}) " +
- "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type
+ "from NodeType({}) ",
+ nodeTemplateName, capabilityName, nodeTemplate.type
)
)
@@ -363,7 +364,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
?: throw BluePrintException(
format(
"Failed to get NodeTemplate({}) requirement definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type
+ " NodeType({}) ",
+ nodeTemplateName, requirementName, nodeTemplate.type
)
)
// Validate Requirement Assignment
@@ -422,7 +424,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
?: throw BluePrintException(
format(
"Failed to get NodeTemplate({}) interface definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type
+ " NodeType({}) ",
+ nodeTemplateName, interfaceAssignmentName, nodeTemplate.type
)
)
@@ -485,7 +488,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
?: throw BluePrintException(
format(
"Failed to get NodeTemplate({}) operation definition ({}) " +
- "property definition({})", nodeTemplateName, operationAssignmentName, propertyName
+ "property definition({})",
+ nodeTemplateName, operationAssignmentName, propertyName
)
)
// Check the property values with property definition
@@ -497,7 +501,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
?: throw BluePrintException(
format(
"Failed to get NodeTemplate({}) operation definition ({}) " +
- "output property definition({})", nodeTemplateName, operationAssignmentName,
+ "output property definition({})",
+ nodeTemplateName, operationAssignmentName,
propertyName
)
)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
index 0444bbeef..b246054e2 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -298,7 +298,8 @@ open class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRunti
?: throw BluePrintException(
format(
"failed to get artifact definitions for node template ({})'s " +
- "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName
+ "artifact name ({}) ",
+ nodeTemplateName, artifactExpression.artifactName
)
)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
index 595dbce6b..1a7c23cf1 100755
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
@@ -19,6 +19,17 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
import com.google.common.base.Predicates
+import org.apache.commons.compress.archivers.ArchiveEntry
+import org.apache.commons.compress.archivers.ArchiveInputStream
+import org.apache.commons.compress.archivers.ArchiveOutputStream
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
+import org.apache.commons.compress.archivers.zip.ZipFile
+import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
+import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
import java.io.BufferedInputStream
@@ -27,28 +38,17 @@ import java.io.ByteArrayOutputStream
import java.io.Closeable
import java.io.File
import java.io.FileOutputStream
+import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
-import java.io.IOException
import java.io.OutputStream
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.SimpleFileVisitor
import java.nio.file.attribute.BasicFileAttributes
-import java.util.function.Predicate
-import org.apache.commons.compress.archivers.ArchiveEntry
-import org.apache.commons.compress.archivers.ArchiveInputStream
-import org.apache.commons.compress.archivers.ArchiveOutputStream
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
-import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
-import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
-import org.apache.commons.compress.archivers.zip.ZipFile
-import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
-import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream
import java.util.Enumeration
+import java.util.function.Predicate
import java.util.zip.Deflater
enum class ArchiveType {
@@ -59,6 +59,7 @@ enum class ArchiveType {
class BluePrintArchiveUtils {
companion object {
+
private val log = LoggerFactory.getLogger(BluePrintArchiveUtils::class.java)
/**
@@ -115,49 +116,54 @@ class BluePrintArchiveUtils {
compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
fixedModificationTime: Long? = null
): T
- where T : OutputStream {
+ where T : OutputStream {
val stream: ArchiveOutputStream = if (archiveType == ArchiveType.Zip)
ZipArchiveOutputStream(output).apply { setLevel(compressionLevel) }
else
TarArchiveOutputStream(GzipCompressorOutputStream(output))
stream
.use { aos ->
- Files.walkFileTree(baseDir, object : SimpleFileVisitor<Path>() {
- @Throws(IOException::class)
- override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
- if (pathFilter.test(file)) {
- var archiveEntry: ArchiveEntry = aos.createArchiveEntry(file.toFile(),
- baseDir.relativize(file).toString())
+ Files.walkFileTree(
+ baseDir,
+ object : SimpleFileVisitor<Path>() {
+ @Throws(IOException::class)
+ override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
+ if (pathFilter.test(file)) {
+ var archiveEntry: ArchiveEntry = aos.createArchiveEntry(
+ file.toFile(),
+ baseDir.relativize(file).toString()
+ )
+ if (archiveType == ArchiveType.Zip) {
+ val entry = archiveEntry as ZipArchiveEntry
+ fixedModificationTime?.let {
+ entry.time = it
+ }
+ entry.time = 0
+ }
+ aos.putArchiveEntry(archiveEntry)
+ Files.copy(file, aos)
+ aos.closeArchiveEntry()
+ }
+ return FileVisitResult.CONTINUE
+ }
+
+ @Throws(IOException::class)
+ override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
+ var archiveEntry: ArchiveEntry?
if (archiveType == ArchiveType.Zip) {
- val entry = archiveEntry as ZipArchiveEntry
+ val entry = ZipArchiveEntry(baseDir.relativize(dir).toString() + "/")
fixedModificationTime?.let {
entry.time = it
}
- entry.time = 0
- }
+ archiveEntry = entry
+ } else
+ archiveEntry = TarArchiveEntry(baseDir.relativize(dir).toString() + "/")
aos.putArchiveEntry(archiveEntry)
- Files.copy(file, aos)
aos.closeArchiveEntry()
+ return FileVisitResult.CONTINUE
}
- return FileVisitResult.CONTINUE
}
-
- @Throws(IOException::class)
- override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
- var archiveEntry: ArchiveEntry?
- if (archiveType == ArchiveType.Zip) {
- val entry = ZipArchiveEntry(baseDir.relativize(dir).toString() + "/")
- fixedModificationTime?.let {
- entry.time = it
- }
- archiveEntry = entry
- } else
- archiveEntry = TarArchiveEntry(baseDir.relativize(dir).toString() + "/")
- aos.putArchiveEntry(archiveEntry)
- aos.closeArchiveEntry()
- return FileVisitResult.CONTINUE
- }
- })
+ )
}
return output
}
@@ -210,6 +216,7 @@ class BluePrintArchiveUtils {
}
class ArchiveEnumerator : Enumeration<ArchiveEntry>, Closeable {
+
private val zipArchive: ZipFile?
private val zipEnumeration: Enumeration<ZipArchiveEntry>?
private val archiveStream: ArchiveInputStream?
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
index 60d26a703..292eca92e 100755
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
@@ -116,8 +116,9 @@ class BluePrintFileUtils {
check(definitionDir.exists()) {
throw BluePrintException(
- ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${definitionDir.absolutePath})"
+ ErrorCode.BLUEPRINT_PATH_MISSING.value,
+ "couldn't get definition file under " +
+ "path(${definitionDir.absolutePath})"
)
}
@@ -208,8 +209,9 @@ class BluePrintFileUtils {
Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(definitionFile.exists()) {
throw BluePrintException(
- ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
- "path(${definitionFile.absolutePath})"
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value,
+ "couldn't write definition file under " +
+ "path(${definitionFile.absolutePath})"
)
}
}
@@ -220,21 +222,22 @@ class BluePrintFileUtils {
Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(typeFile.exists()) {
throw BluePrintException(
- ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
- "path(${typeFile.absolutePath})"
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value,
+ "couldn't write $type.json file under " +
+ "path(${typeFile.absolutePath})"
)
}
}
private fun getMetaDataContent(): String {
return "TOSCA-Meta-File-Version: 1.0.0" +
- "\nCSAR-Version: <VERSION>" +
- "\nCreated-By: <AUTHOR NAME>" +
- "\nEntry-Definitions: Definitions/<BLUEPRINT_NAME>.json" +
- "\nTemplate-Name: <BLUEPRINT_NAME>" +
- "\nTemplate-Version: <BLUEPRINT_VERSION>" +
- "\nTemplate-Type: <BLUEPRINT_TYPE>" +
- "\nTemplate-Tags: <TAGS>"
+ "\nCSAR-Version: <VERSION>" +
+ "\nCreated-By: <AUTHOR NAME>" +
+ "\nEntry-Definitions: Definitions/<BLUEPRINT_NAME>.json" +
+ "\nTemplate-Name: <BLUEPRINT_NAME>" +
+ "\nTemplate-Version: <BLUEPRINT_VERSION>" +
+ "\nTemplate-Type: <BLUEPRINT_TYPE>" +
+ "\nTemplate-Tags: <TAGS>"
}
fun getBluePrintFile(fileName: String, targetPath: Path): File {
@@ -242,8 +245,9 @@ class BluePrintFileUtils {
val file = File(filePath)
check(file.exists()) {
throw BluePrintException(
- ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${file.absolutePath})"
+ ErrorCode.BLUEPRINT_PATH_MISSING.value,
+ "couldn't get definition file under " +
+ "path(${file.absolutePath})"
)
}
return file
@@ -252,8 +256,9 @@ class BluePrintFileUtils {
fun getCbaStorageDirectory(path: String): Path {
check(StringUtils.isNotBlank(path)) {
throw BluePrintException(
- ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
- "Blueprint folder under path($path)"
+ ErrorCode.BLUEPRINT_PATH_MISSING.value,
+ "couldn't get " +
+ "Blueprint folder under path($path)"
)
}
@@ -305,12 +310,12 @@ class BluePrintFileUtils {
val urls = arrayListOf<URL>()
directory.walkTopDown()
- .filter { it.name.endsWith(COMPILED_JAR_SUFFIX) }
- .forEach {
- log.debug("Adding (${it.absolutePath}) to classLoader (${directory.absolutePath})")
+ .filter { it.name.endsWith(COMPILED_JAR_SUFFIX) }
+ .forEach {
+ log.debug("Adding (${it.absolutePath}) to classLoader (${directory.absolutePath})")
- urls.add(it.toURI().toURL())
- }
+ urls.add(it.toURI().toURL())
+ }
return URLClassLoader(urls.toTypedArray(), this.javaClass.classLoader)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
index 64be5897a..43f3a0b53 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -40,6 +40,7 @@ import java.util.Properties
class BluePrintMetadataUtils {
companion object {
+
private val log = LoggerFactory.getLogger(this::class.toString())
suspend fun toscaMetaData(basePath: String): ToscaMetaData {
@@ -104,47 +105,47 @@ class BluePrintMetadataUtils {
/** Get the default blueprint runtime for [id] and [blueprintBasePath] */
suspend fun getBluePrintRuntime(id: String, blueprintBasePath: String):
BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
- return getBluePrintRuntime(id, bluePrintContext)
- }
+ val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
+ return getBluePrintRuntime(id, bluePrintContext)
+ }
/** Get the default blocking blueprint runtime api for [id] and [blueprintBasePath] used in testing */
fun bluePrintRuntime(id: String, blueprintBasePath: String):
BluePrintRuntimeService<MutableMap<String, JsonNode>> = runBlocking {
- val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
- getBluePrintRuntime(id, bluePrintContext)
- }
+ val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
+ getBluePrintRuntime(id, bluePrintContext)
+ }
/** Get the default blueprint runtime from [bluePrintContext] */
fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext):
BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- checkNotEmpty(bluePrintContext.rootPath) { "blueprint context root path is missing." }
- checkNotEmpty(bluePrintContext.entryDefinition) { "blueprint context entry definition is missing." }
- val blueprintBasePath = bluePrintContext.rootPath
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- bluePrintRuntimeService.put(
- BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH,
- blueprintBasePath.asJsonPrimitive()
- )
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
- return bluePrintRuntimeService
- }
+ checkNotEmpty(bluePrintContext.rootPath) { "blueprint context root path is missing." }
+ checkNotEmpty(bluePrintContext.entryDefinition) { "blueprint context entry definition is missing." }
+ val blueprintBasePath = bluePrintContext.rootPath
+ val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
+ bluePrintRuntimeService.put(
+ BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH,
+ blueprintBasePath.asJsonPrimitive()
+ )
+ bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
+ return bluePrintRuntimeService
+ }
/** Get the blueprint runtime for enhancement start for [id] and [blueprintBasePath] */
suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String):
BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath)
+ val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath)
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- bluePrintRuntimeService.put(
- BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH,
- blueprintBasePath.asJsonPrimitive()
- )
- bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
+ val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
+ bluePrintRuntimeService.put(
+ BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH,
+ blueprintBasePath.asJsonPrimitive()
+ )
+ bluePrintRuntimeService.put(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID, id.asJsonPrimitive())
- return bluePrintRuntimeService
- }
+ return bluePrintRuntimeService
+ }
/** Get the default blueprint runtime for enhancement start for [id], [blueprintBasePath] and [executionContext] */
suspend fun getBluePrintRuntime(
@@ -153,15 +154,15 @@ class BluePrintMetadataUtils {
executionContext: MutableMap<String, JsonNode>
):
BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
- val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
- executionContext.forEach {
- bluePrintRuntimeService.put(it.key, it.value)
- }
+ val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
+ val bluePrintRuntimeService = DefaultBluePrintRuntimeService(id, bluePrintContext)
+ executionContext.forEach {
+ bluePrintRuntimeService.put(it.key, it.value)
+ }
- bluePrintRuntimeService.setExecutionContext(executionContext)
- return bluePrintRuntimeService
- }
+ bluePrintRuntimeService.setExecutionContext(executionContext)
+ return bluePrintRuntimeService
+ }
/** Get the default blueprint context for [blueprintBasePath]*/
suspend fun getBluePrintContext(blueprintBasePath: String): BluePrintContext {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
index c44355070..f4c51d455 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -40,7 +40,7 @@ object BluePrintRuntimeUtils {
bluePrintContext: BluePrintContext,
fileName: String,
context: MutableMap<String,
- JsonNode>
+ JsonNode>
) {
val jsonNode = JacksonUtils.jsonNodeFromClassPathFile(fileName)
return assignInputs(bluePrintContext, jsonNode, context)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
index 6645ff7b4..ad30bfb2f 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
@@ -45,7 +45,8 @@ class JacksonReactorUtils {
// log.trace("Reading Classpath File($fileName)")
IOUtils.toString(
JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset()
+ .getResourceAsStream(fileName),
+ Charset.defaultCharset()
)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
index 573fc17d2..ace66cf7a 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
@@ -85,7 +85,8 @@ class JacksonUtils {
withContext(Dispatchers.Default) {
IOUtils.toString(
JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset()
+ .getResourceAsStream(fileName),
+ Charset.defaultCharset()
)
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt
index 35f2f6d83..48319325c 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/PropertyDefinitionUtils.kt
@@ -21,17 +21,18 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
class PropertyDefinitionUtils {
companion object {
+
fun hasLogProtect(metadata: MutableMap<String, String>?) = metadata?.get(LOG_PROTECT)
- ?.let {
- when (it.toLowerCase()) {
- "true" -> true
- "yes" -> true
- "y" -> true
- else -> false
- }
- } ?: false
+ ?.let {
+ when (it.toLowerCase()) {
+ "true" -> true
+ "yes" -> true
+ "y" -> true
+ else -> false
+ }
+ } ?: false
fun hasLogProtect(propertyDefinition: PropertyDefinition?) = propertyDefinition
- ?.let { p -> hasLogProtect(p.metadata) } ?: false
+ ?.let { p -> hasLogProtect(p.metadata) } ?: false
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
index 9903b57f1..453193596 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
@@ -92,14 +92,14 @@ object ServiceTemplateUtils {
toMerge.topologyTemplate?.nodeTemplates?.let {
parentServiceTemplate.topologyTemplate?.nodeTemplates =
parentServiceTemplate.topologyTemplate?.nodeTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.nodeTemplates?.putAll(parentServiceTemplate.topologyTemplate?.nodeTemplates as MutableMap)
}
toMerge.topologyTemplate?.relationshipTemplates?.let {
parentServiceTemplate.topologyTemplate?.relationshipTemplates =
parentServiceTemplate.topologyTemplate?.relationshipTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.relationshipTemplates?.putAll(parentServiceTemplate.topologyTemplate?.relationshipTemplates as MutableMap)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
index 6383fb4a8..8aa295071 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
@@ -20,6 +20,7 @@ import org.junit.Test
import kotlin.test.assertTrue
class FileExtensionFunctionTest {
+
val blueprintBasePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
@Test
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
index 498a85239..643549be0 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
@@ -26,7 +26,9 @@ import kotlin.test.Test
import kotlin.test.assertEquals
class MDCContextTest {
+
val log = logger(MDCContextTest::class)
+
@Before
fun setup() {
MDC.clear()
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt
index 4182a3fcd..d5c19c184 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.controllerblueprints.core
object TestConstants {
+
const val PATH_TEST_BLUEPRINTS = "./../../../../../components/model-catalog/blueprint-model/test-blueprint"
const val PATH_TEST_BLUEPRINTS_BASECONFIG = "$PATH_TEST_BLUEPRINTS/baseconfiguration"
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index 824d7ddec..9aea47a9e 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -277,8 +277,8 @@ fun BluePrintTypes.nodeTemplateComponentTestExecutor(
block: TestNodeTemplateOperationImplBuilder.() -> Unit
):
NodeTemplate {
- return TestNodeTemplateOperationImplBuilder(id, description).apply(block).build()
-}
+ return TestNodeTemplateOperationImplBuilder(id, description).apply(block).build()
+ }
class TestNodeTemplateOperationImplBuilder(id: String, description: String) :
AbstractNodeTemplateOperationImplBuilder<TestProperty, TestInput, TestOutput>(
@@ -288,6 +288,7 @@ class TestNodeTemplateOperationImplBuilder(id: String, description: String) :
)
class TestProperty : PropertiesAssignmentBuilder() {
+
fun prop1(prop1: String) {
property("prop1", prop1.asJsonPrimitive())
}
@@ -298,12 +299,14 @@ class TestProperty : PropertiesAssignmentBuilder() {
}
class TestInput : PropertiesAssignmentBuilder() {
+
fun request(request: String) {
property("request", request.asJsonPrimitive())
}
}
class TestOutput : PropertiesAssignmentBuilder() {
+
fun response(response: String) {
response(response.asJsonPrimitive())
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
index 60bef8a8d..0803d921b 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
@@ -55,6 +55,7 @@ class BluePrintScriptsServiceImplTest {
val bluePrintScriptsService = BluePrintScriptsServiceImpl()
val basePath = normalizedPathName("src/test/resources/compile")
+
/** Load the Definitions */
val bluePrintDefinitions = bluePrintScriptsService
.scriptInstance<BluePrintDefinitions>(
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index 79979b949..4fcbb2d98 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -240,8 +240,9 @@ class BluePrintRuntimeServiceTest {
val bluePrintRuntimeService = getBluePrintRuntimeService()
bluePrintRuntimeService.setNodeTemplateAttributeValue(
- "resource-assignment", "assignment-map",
- JacksonUtils.jsonNode("""
+ "resource-assignment", "assignment-map",
+ JacksonUtils.jsonNode(
+ """
{
"a-prefix":{
"an-object":{
@@ -249,13 +250,15 @@ class BluePrintRuntimeServiceTest {
}
}
}
- """.trimIndent())
+ """.trimIndent()
+ )
)
val propertyDefinitions = mutableMapOf<String, PropertyDefinition>(
- "resolution" to PropertyDefinition().apply {
- this.type = "json"
- this.value = JacksonUtils.jsonNode("""
+ "resolution" to PropertyDefinition().apply {
+ this.type = "json"
+ this.value = JacksonUtils.jsonNode(
+ """
{
"get_attribute":[
"resource-assignment",
@@ -266,8 +269,9 @@ class BluePrintRuntimeServiceTest {
"a-key"
]
}
- """.trimIndent())
- }
+ """.trimIndent()
+ )
+ }
)
val result = bluePrintRuntimeService.resolvePropertyDefinitions("workflow", "WORKFLOW", propertyDefinitions)
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
index 72fa3e1eb..eb6246989 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
@@ -34,6 +34,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.toGraph
import kotlin.test.assertNotNull
class BluePrintWorkflowServiceTest {
+
@Test
fun testSimpleFlow() {
runBlocking {
@@ -210,9 +211,9 @@ class TestBluePrintWorkFlowService :
}
override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
- NodeExecuteMessage<String, String> {
- return NodeExecuteMessage(node, "$node Input", "")
- }
+ NodeExecuteMessage<String, String> {
+ return NodeExecuteMessage(node, "$node Input", "")
+ }
override suspend fun executeNode(
node: Graph.Node,
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
index fc11947de..4334bce2e 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory
class TopologicalSortingUtilsTest {
private val log = LoggerFactory.getLogger(TopologicalSortingUtilsTest::class.java)
+
@Test
fun testSorting() {
val graph: TopologicalSortingUtils<String> = TopologicalSortingUtils()
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
index 2dfc09be6..6fa83119e 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
@@ -102,7 +102,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
?: throw BluePrintException(
"Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
- "from NodeType(${nodeTemplate.type})"
+ "from NodeType(${nodeTemplate.type})"
)
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -135,7 +135,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val requirementDefinition = nodeType.requirements?.get(requirementName)
?: throw BluePrintException(
"Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
- " NodeType(${nodeTemplate.type})"
+ " NodeType(${nodeTemplate.type})"
)
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
@@ -166,13 +166,13 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
?: throw BluePrintException(
"Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)"
+ "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)"
)
relationShipNodeTemplate.capabilities?.get(capabilityName)
?: throw BluePrintException(
"Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)"
+ "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)"
)
}
@@ -186,7 +186,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
?: throw BluePrintException(
"Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
- " NodeType(${nodeTemplate.type})"
+ " NodeType(${nodeTemplate.type})"
)
validateInterfaceAssignment(
@@ -232,7 +232,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
log.debug(
"Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
- "($operationAssignmentName)"
+ "($operationAssignmentName)"
)
val inputs = operationAssignments.inputs
@@ -242,7 +242,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
?: throw BluePrintException(
"Failed to get NodeTemplate($nodeTemplateName) operation " +
- "definition ($operationAssignmentName) property definition($propertyName)"
+ "definition ($operationAssignmentName) property definition($propertyName)"
)
// Check the property values with property definition
propertyAssignmentValidationUtils
@@ -253,7 +253,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
?: throw BluePrintException(
"Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
- "output property definition($propertyName)"
+ "output property definition($propertyName)"
)
// Check the property values with property definition
propertyAssignmentValidationUtils
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
index 5384744ee..04a3fd046 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -141,7 +141,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
relationShipNodeType.capabilities?.get(capabilityName)
?: throw BluePrintException(
"failed to get requirement NodeType($requirementNodeTypeName)'s " +
- "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) "
+ "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) "
)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
index 1fb70503f..db7d91a22 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
@@ -38,6 +38,7 @@ import org.springframework.stereotype.Service
class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
companion object {
+
const val PREFIX_DEFAULT = "default"
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
index a2b598017..25b5af0b2 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
@@ -66,16 +66,17 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
check(
nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW ||
- nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT
) {
"NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected " +
- "'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
+ "'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
}
} catch (e: Exception) {
bluePrintRuntimeService.getBluePrintError()
.addError(
"Failed to validate Workflow($workflowName)'s step($stepName)'s " +
- "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!
+ "definition",
+ paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!
)
}
}
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);
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
index 637031972..d4b3f807b 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
@@ -62,6 +62,7 @@ fun BluePrintDependencyService.primaryDBLibGenericService(): BluePrintDBLibGener
class DBLibConstants {
companion object {
+
const val PREFIX_DB: String = "blueprintsprocessor.db"
// list of database
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
index f78334fcd..7023106eb 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
open class DBDataSourceProperties {
+
var type: String = DBLibConstants.MARIA_DB
lateinit var url: String
lateinit var username: String
@@ -25,6 +26,7 @@ open class DBDataSourceProperties {
}
open class PrimaryDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
@@ -32,6 +34,7 @@ open class PrimaryDataSourceProperties : DBDataSourceProperties() {
}
open class MariaDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
@@ -40,6 +43,7 @@ open class MariaDataSourceProperties : DBDataSourceProperties() {
}
open class MySqlDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
index e686e8396..79f5c09bc 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
@@ -33,44 +33,47 @@ import org.springframework.stereotype.Service
class BluePrintDBLibPropertyService(private var bluePrintPropertiesService: BluePrintPropertiesService) {
fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService =
- blueprintDBDataSourceService(dBDataSourceProperties(jsonNode))
+ blueprintDBDataSourceService(dBDataSourceProperties(jsonNode))
fun JdbcTemplate(selector: String): BluePrintDBLibGenericService =
- blueprintDBDataSourceService(dBDataSourceProperties("blueprintsprocessor.db.$selector"))
+ blueprintDBDataSourceService(dBDataSourceProperties("blueprintsprocessor.db.$selector"))
private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties =
- when (val type = jsonNode.get("type").textValue()) {
- MYSQL_DB -> JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)
- MARIA_DB -> JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)
- else -> {
- throw BluePrintProcessorException(
- "DB type ($type) is not supported. Valid types: $MARIA_DB, $MYSQL_DB")
- }
- }!!
+ when (val type = jsonNode.get("type").textValue()) {
+ MYSQL_DB -> JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)
+ MARIA_DB -> JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)
+ else -> {
+ throw BluePrintProcessorException(
+ "DB type ($type) is not supported. Valid types: $MARIA_DB, $MYSQL_DB"
+ )
+ }
+ }!!
private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java).let {
- return when (it) {
- MARIA_DB, PROCESSOR_DB -> mariaDBConnectionProperties(prefix)
- MYSQL_DB -> mySqlDBConnectionProperties(prefix)
- else -> {
- throw BluePrintProcessorException(
- "DB type ($it) is not supported. Valid types: $MARIA_DB, $MYSQL_DB, $PROCESSOR_DB")
- }
+ bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java).let {
+ return when (it) {
+ MARIA_DB, PROCESSOR_DB -> mariaDBConnectionProperties(prefix)
+ MYSQL_DB -> mySqlDBConnectionProperties(prefix)
+ else -> {
+ throw BluePrintProcessorException(
+ "DB type ($it) is not supported. Valid types: $MARIA_DB, $MYSQL_DB, $PROCESSOR_DB"
+ )
}
}
+ }
private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService =
- when (dBConnetionProperties) {
- is MariaDataSourceProperties -> MariaDatabaseConfiguration(dBConnetionProperties)
- is MySqlDataSourceProperties -> MySqlDatabaseConfiguration(dBConnetionProperties)
- else -> throw BluePrintProcessorException(
- "Failed to create db configuration for ${dBConnetionProperties.url}")
- }
+ when (dBConnetionProperties) {
+ is MariaDataSourceProperties -> MariaDatabaseConfiguration(dBConnetionProperties)
+ is MySqlDataSourceProperties -> MySqlDatabaseConfiguration(dBConnetionProperties)
+ else -> throw BluePrintProcessorException(
+ "Failed to create db configuration for ${dBConnetionProperties.url}"
+ )
+ }
private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
index 49b7ec9eb..0761b72d2 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
@@ -24,6 +24,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource
import javax.sql.DataSource
class MySqlDatabaseConfiguration(private val mySqlDataSourceProperties: MySqlDataSourceProperties) : BluePrintDBLibGenericService {
+
override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
return mySqlNamedParameterJdbcTemplate(mySqlDataSource())
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
index 43bcb6741..9f4d32e7a 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
@@ -124,6 +124,7 @@ class BlueprintModel : Serializable {
var blueprintModelContent: BlueprintModelContent? = null
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
index a18ae8b1d..08977f6aa 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
@@ -78,9 +78,9 @@ class BlueprintModelContent : Serializable {
override fun toString(): String {
return "[" + "id = " + id +
- ", name = " + name +
- ", contentType = " + contentType +
- "]"
+ ", name = " + name +
+ ", contentType = " + contentType +
+ "]"
}
override fun equals(o: Any?): Boolean {
@@ -92,8 +92,10 @@ class BlueprintModelContent : Serializable {
return false
}
val blueprintModelContent = o as BlueprintModelContent?
- return (id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
- contentType == blueprintModelContent.contentType)
+ return (
+ id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
+ contentType == blueprintModelContent.contentType
+ )
}
override fun hashCode(): Int {
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
index b1c006793..e6373d9b8 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
@@ -83,6 +83,7 @@ class BlueprintModelSearch : Serializable {
var tags: String? = null
companion object {
+
const val serialversionuid = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
index 59ace723a..4bfc07845 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
@@ -48,7 +48,7 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @return B?
*/
fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
- BlueprintModelContent?
+ BlueprintModelContent?
/**
* This is a findByBlueprintModelAndContentType method
@@ -58,7 +58,7 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @return List<B>
*/
fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
- List<BlueprintModelContent>
+ List<BlueprintModelContent>
/**
* This is a findByBlueprintModel method
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
index 5986603ca..7ba9dd710 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
@@ -37,13 +37,13 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
*
* @param id id
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
fun findById(id: String): BlueprintModelSearch?
/**
* This is a findAll method
* @return List<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
override fun findAll(): List<BlueprintModelSearch>
/**
@@ -52,7 +52,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @param artifactName artifactName
* @param artifactVersion artifactVersion
* @return Optional<AsdcArtifacts>
- </AsdcArtifacts> */
+ </AsdcArtifacts> */
fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModelSearch?
/**
@@ -60,7 +60,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
*
* @param tags
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModelSearch>
/**
@@ -74,7 +74,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @param artifactVersion
* @param artifactType
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch>
+ </BlueprintModelSearch>
*/
fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
updatedBy: String,
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
index d10ec17b0..1b58bc082 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
@@ -103,7 +103,7 @@ class BlueprintProcessorCatalogServiceImpl(
deleteNBDir(deployFile.absolutePath)
throw BluePrintProcessorException(
"failed to get get cba file name($name), version($version) from db" +
- " : ${e.message}"
+ " : ${e.message}"
)
} finally {
deleteNBDir(cbaFile.parentFile.absolutePath)
@@ -149,7 +149,8 @@ class BlueprintProcessorCatalogServiceImpl(
blueprintModel.artifactVersion = artifactVersion
blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!!
blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!!
- val description = if (null != metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION]) metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION] else ""
+ val description =
+ if (null != metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION]) metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION] else ""
blueprintModel.artifactDescription = description
val blueprintModelContent = BlueprintModelContent()
@@ -166,8 +167,10 @@ class BlueprintProcessorCatalogServiceImpl(
blueprintModelRepository.saveAndFlush(blueprintModel)
} catch (ex: DataIntegrityViolationException) {
throw BluePrintException(
- ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
- "is already exist in database: ${ex.message}", ex
+ ErrorCode.CONFLICT_ADDING_RESOURCE.value,
+ "The blueprint entry " +
+ "is already exist in database: ${ex.message}",
+ ex
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index 5d546c2ef..b7b1f78cf 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -45,8 +45,10 @@ import kotlin.test.assertTrue
@EnableAutoConfiguration
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor"])
@ContextConfiguration(
- classes = [BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
- MockBlueprintProcessorCatalogServiceImpl::class]
+ classes = [
+ BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
+ MockBlueprintProcessorCatalogServiceImpl::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BlueprintProcessorCatalogServiceImplTest {
@@ -123,7 +125,8 @@ class BlueprintProcessorCatalogServiceImplTest {
File(
blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath +
"/baseconfiguration"
- ).deleteRecursively(), "Couldn't get blueprint archive " +
+ ).deleteRecursively(),
+ "Couldn't get blueprint archive " +
"${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " +
"from data base."
)
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
index 8ccd8cd56..dfe95733f 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
@@ -28,8 +28,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
* Representation of DMAAP client service for AAF auth type.
*/
class AafAuthDmaapClientService(
- private val clientProps:
- AafAuthDmaapClientProperties
+ private val clientProps: AafAuthDmaapClientProperties
) :
BluePrintDmaapClientService {
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
index cbde4d003..82c3f3a80 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
@@ -96,7 +96,8 @@ interface BluePrintDmaapClientService {
} catch (e: IOException) {
log.warn(
"Unable to cleanly close the connection from the " +
- "client $client", e
+ "client $client",
+ e
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
index 44ed5316b..20d9afdef 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
@@ -39,8 +39,9 @@ open class BluePrintDmaapLibConfiguration
class DmaapLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY = "blueprint" +
- "-dmaap-lib-property-service"
+ "-dmaap-lib-property-service"
const val TYPE_HTTP_NO_AUTH = "HTTPNOAUTH"
const val TYPE_HTTP_AAF_AUTH = "HTTPAAF"
}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
index a3eed159f..e5c9d432f 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
@@ -70,21 +70,21 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
* node.
*/
fun blueprintDmaapClientService(jsonNode: JsonNode):
- BluePrintDmaapClientService {
- val dmaapProps = dmaapClientProperties(jsonNode)
- return blueprintDmaapClientService(dmaapProps)
- }
+ BluePrintDmaapClientService {
+ val dmaapProps = dmaapClientProperties(jsonNode)
+ return blueprintDmaapClientService(dmaapProps)
+ }
/**
* Returns the DMAAP client by providing the input properties as a
* selector string.
*/
fun blueprintDmaapClientService(selector: String):
- BluePrintDmaapClientService {
- val prefix = "blueprintsprocessor.dmaapclient.$selector"
- val dmaapProps = dmaapClientProperties(prefix)
- return blueprintDmaapClientService(dmaapProps)
- }
+ BluePrintDmaapClientService {
+ val prefix = "blueprintsprocessor.dmaapclient.$selector"
+ val dmaapProps = dmaapClientProperties(prefix)
+ return blueprintDmaapClientService(dmaapProps)
+ }
/**
* Returns the DMAAP client properties from the type of connection it
@@ -114,7 +114,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
else -> {
throw BluePrintProcessorException(
"DMAAP adaptor($type) is " +
- "not supported"
+ "not supported"
)
}
}
@@ -149,7 +149,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
else -> {
throw BluePrintProcessorException(
"DMAAP adaptor($type) is " +
- "not supported"
+ "not supported"
)
}
}
@@ -160,24 +160,24 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
* Returns DMAAP client service according to the type of client properties.
*/
private fun blueprintDmaapClientService(clientProps: DmaapClientProperties):
- BluePrintDmaapClientService {
- when (clientProps) {
- is HttpNoAuthDmaapClientProperties -> {
- return HttpNoAuthDmaapClientService(clientProps)
- }
-
- is AafAuthDmaapClientProperties -> {
- return AafAuthDmaapClientService(clientProps)
- }
-
- else -> {
- throw BluePrintProcessorException(
- "Unable to get the DMAAP " +
+ BluePrintDmaapClientService {
+ when (clientProps) {
+ is HttpNoAuthDmaapClientProperties -> {
+ return HttpNoAuthDmaapClientService(clientProps)
+ }
+
+ is AafAuthDmaapClientProperties -> {
+ return AafAuthDmaapClientService(clientProps)
+ }
+
+ else -> {
+ throw BluePrintProcessorException(
+ "Unable to get the DMAAP " +
"client"
- )
+ )
+ }
}
}
- }
/**
* Parses the event.properties file which contains the default values for
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
index a3e347adc..d4adfcaac 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
@@ -29,7 +29,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
*/
class HttpNoAuthDmaapClientService(
private val clientProps:
- HttpNoAuthDmaapClientProperties
+ HttpNoAuthDmaapClientProperties
) :
BluePrintDmaapClientService {
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
index 3fb7f6802..e6043caae 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
@@ -50,17 +50,21 @@ import kotlin.test.assertNotNull
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(
- classes = [BluePrintDmaapLibConfiguration::class, TestController::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintDmaapLibConfiguration::class, TestController::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
- properties = ["server.port=9111",
+ properties = [
+ "server.port=9111",
"blueprintsprocessor.dmaapclient.aai.topic=cds_aai",
"blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH",
"blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111",
"blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2",
"blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"]
+ "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"
+ ]
)
class TestDmaapEventPublisher {
@@ -77,8 +81,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -95,8 +99,8 @@ class TestDmaapEventPublisher {
fun testEventPropertiesWithSingleMsg() {
val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
val str: String = "{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
dmaapClient.sendMessage(str)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 1)
@@ -114,8 +118,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -132,10 +136,10 @@ class TestDmaapEventPublisher {
@Test
fun testMultiTopicPropertiesWithJsonInput() {
val jsonString = "{\n" +
- " \"topic\" : \"cds_json1,cds_json2\",\n" +
- " \"type\" : \"HTTPNOAUTH\",\n" +
- " \"host\" : \"127.0.0.1:9111\"\n" +
- "}"
+ " \"topic\" : \"cds_json1,cds_json2\",\n" +
+ " \"type\" : \"HTTPNOAUTH\",\n" +
+ " \"host\" : \"127.0.0.1:9111\"\n" +
+ "}"
val mapper = ObjectMapper()
val node = mapper.readTree(jsonString)
val strList = mutableListOf<String>()
@@ -143,8 +147,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -165,13 +169,13 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
strList.add(
"{\n" +
- " \"a\" : \"second\"\n" +
- "}"
+ " \"a\" : \"second\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -190,8 +194,9 @@ class TestDmaapEventPublisher {
)
assertNotNull(properties, "failed to create property bean")
assertNotNull(
- properties.host, "failed to get url property" +
- " in property bean"
+ properties.host,
+ "failed to get url property" +
+ " in property bean"
)
}
@@ -221,11 +226,11 @@ open class TestController {
*/
@PostMapping(path = ["/{topic}"])
fun postTopic(@PathVariable(value = "topic") topic: String):
- ResponseEntity<Any> {
- var a = "{\n" +
+ ResponseEntity<Any> {
+ var a = "{\n" +
" \"message\" : \"The message is published into $topic " +
"topic\"\n" +
"}"
- return ResponseEntity(a, HttpStatus.OK)
- }
+ return ResponseEntity(a, HttpStatus.OK)
+ }
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
index a3823c6ac..e94400d9b 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
@@ -44,6 +44,7 @@ fun BluePrintDependencyService.grpcClientService(jsonNode: JsonNode): BluePrintG
class GRPCLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_GRPC_LIB_PROPERTY = "blueprint-grpc-lib-property-service"
const val PROPERTY_GRPC_CLIENT_PREFIX = "blueprintsprocessor.grpcclient."
const val PROPERTY_GRPC_SERVER_PREFIX = "blueprintsprocessor.grpcserver."
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
index f94d918a2..ebb9a5b32 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
@@ -25,12 +25,15 @@ open class GrpcServerProperties {
}
open class TokenAuthGrpcServerProperties : GrpcServerProperties() {
+
lateinit var token: String
}
open class TLSAuthGrpcServerProperties : GrpcServerProperties() {
+
lateinit var certChain: String
lateinit var privateKey: String
+
/** Below Used only for Mutual TLS */
var trustCertCollection: String? = null
}
@@ -44,17 +47,21 @@ open class GrpcClientProperties {
}
open class TokenAuthGrpcClientProperties : GrpcClientProperties() {
+
lateinit var token: String
}
open class TLSAuthGrpcClientProperties : GrpcClientProperties() {
+
var trustCertCollection: String? = null
+
/** Below Used only for Mutual TLS */
var clientCertChain: String? = null
var clientPrivateKey: String? = null
}
open class BasicAuthGrpcClientProperties : GrpcClientProperties() {
+
lateinit var username: String
lateinit var password: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
index 43e56606f..56384ceff 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
@@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.GrpcLoggerService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
class GrpcClientLoggingInterceptor : ClientInterceptor {
+
val log = logger(GrpcClientLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
index a49b96743..aaa4d5f26 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
@@ -32,6 +32,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn
import org.slf4j.MDC
class GrpcServerLoggingInterceptor : ServerInterceptor {
+
val log = logger(GrpcServerLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
@@ -42,59 +43,59 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
):
ServerCall.Listener<ReqT> {
- val forwardingServerCall = object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
- override fun sendHeaders(responseHeaders: Metadata) {
- loggingService.grpResponding(requestHeaders, responseHeaders)
- super.sendHeaders(responseHeaders)
+ val forwardingServerCall = object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
+ override fun sendHeaders(responseHeaders: Metadata) {
+ loggingService.grpResponding(requestHeaders, responseHeaders)
+ super.sendHeaders(responseHeaders)
+ }
}
- }
- return object :
- ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
- next.startCall(forwardingServerCall, requestHeaders)
- ) {
+ return object :
+ ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
+ next.startCall(forwardingServerCall, requestHeaders)
+ ) {
- override fun onMessage(message: ReqT) {
- /** Get the requestId, SubRequestId and Originator Id and set in MDS context
- * If you are using other GRPC services, Implement own Logging Interceptors to get tracing.
- * */
- when (message) {
- is ExecutionServiceInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintUploadInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintDownloadInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintRemoveInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- else -> {
- loggingService.grpcRequesting(call, requestHeaders, next)
+ override fun onMessage(message: ReqT) {
+ /** Get the requestId, SubRequestId and Originator Id and set in MDS context
+ * If you are using other GRPC services, Implement own Logging Interceptors to get tracing.
+ * */
+ when (message) {
+ is ExecutionServiceInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintUploadInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintDownloadInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintRemoveInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ else -> {
+ loggingService.grpcRequesting(call, requestHeaders, next)
+ }
}
+ super.onMessage(message)
}
- super.onMessage(message)
- }
- override fun onComplete() {
- MDC.clear()
- super.onComplete()
- }
+ override fun onComplete() {
+ MDC.clear()
+ super.onComplete()
+ }
- override fun onCancel() {
- MDC.clear()
- super.onCancel()
+ override fun onCancel() {
+ MDC.clear()
+ super.onCancel()
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
index 79da447a1..a102ee6da 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
@@ -88,15 +88,15 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
private fun blueprintGrpcServerService(grpcServerProperties: GrpcServerProperties):
BluePrintGrpcServerService {
- when (grpcServerProperties) {
- is TLSAuthGrpcServerProperties -> {
- return TLSAuthGrpcServerService(grpcServerProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get grpc client service for properties $grpcServerProperties")
+ when (grpcServerProperties) {
+ is TLSAuthGrpcServerProperties -> {
+ return TLSAuthGrpcServerService(grpcServerProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get grpc client service for properties $grpcServerProperties")
+ }
}
}
- }
/** GRPC Client Lib Property Service */
@@ -152,21 +152,21 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
fun blueprintGrpcClientService(grpcClientProperties: GrpcClientProperties):
BluePrintGrpcClientService {
- return when (grpcClientProperties) {
- is TokenAuthGrpcClientProperties -> {
- TokenAuthGrpcClientService(grpcClientProperties)
- }
- is TLSAuthGrpcClientProperties -> {
- TLSAuthGrpcClientService(grpcClientProperties)
- }
- is BasicAuthGrpcClientProperties -> {
- BasicAuthGrpcClientService(grpcClientProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get grpc service for type(${grpcClientProperties.type})")
+ return when (grpcClientProperties) {
+ is TokenAuthGrpcClientProperties -> {
+ TokenAuthGrpcClientService(grpcClientProperties)
+ }
+ is TLSAuthGrpcClientProperties -> {
+ TLSAuthGrpcClientService(grpcClientProperties)
+ }
+ is BasicAuthGrpcClientProperties -> {
+ BasicAuthGrpcClientService(grpcClientProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get grpc service for type(${grpcClientProperties.type})")
+ }
}
}
- }
private fun tokenAuthGrpcClientProperties(prefix: String): TokenAuthGrpcClientProperties {
return bluePrintPropertiesService.propertyBeanType(prefix, TokenAuthGrpcClientProperties::class.java)
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
index e71525f0a..d2db14a53 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
@@ -21,9 +21,11 @@ import io.grpc.ManagedChannel
import io.grpc.netty.NettyServerBuilder
interface BluePrintGrpcServerService {
+
fun serverBuilder(): NettyServerBuilder
}
interface BluePrintGrpcClientService {
+
suspend fun channel(): ManagedChannel
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
index d9a8082d4..30722c8e3 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
@@ -40,36 +40,39 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintGrpcLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintGrpcLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.grpcclient.sample.type=basic-auth",
- "blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.sample.port=50505",
- "blueprintsprocessor.grpcclient.sample.username=sampleuser",
- "blueprintsprocessor.grpcclient.sample.password=sampleuser",
-
- "blueprintsprocessor.grpcclient.token.type=token-auth",
- "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.token.port=50505",
- "blueprintsprocessor.grpcclient.token.username=sampleuser",
- "blueprintsprocessor.grpcclient.token.password=sampleuser",
-
- "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcserver.tls-sample.port=50505",
- "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
- "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
- "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
-
- "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.tls-sample.port=50505",
- "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
- ]
+ [
+ "blueprintsprocessor.grpcclient.sample.type=basic-auth",
+ "blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.sample.port=50505",
+ "blueprintsprocessor.grpcclient.sample.username=sampleuser",
+ "blueprintsprocessor.grpcclient.sample.password=sampleuser",
+
+ "blueprintsprocessor.grpcclient.token.type=token-auth",
+ "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.token.port=50505",
+ "blueprintsprocessor.grpcclient.token.username=sampleuser",
+ "blueprintsprocessor.grpcclient.token.password=sampleuser",
+
+ "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcserver.tls-sample.port=50505",
+ "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
+ "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
+ "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
+
+ "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.tls-sample.port=50505",
+ "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
+ ]
)
class BluePrintGrpcLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
index fb7282f75..78fa27d3a 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
@@ -51,6 +51,7 @@ fun main() {
}
class MockTLSBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
+
override fun process(responseObserver: StreamObserver<ExecutionServiceOutput>): StreamObserver<ExecutionServiceInput> {
return object : StreamObserver<ExecutionServiceInput> {
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
index c6587c799..659295a6b 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
@@ -57,6 +57,7 @@ fun BluePrintDependencyService.messageConsumerService(jsonNode: JsonNode): Bluep
class MessageLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY = "blueprint-message-lib-property-service"
const val PROPERTY_MESSAGE_CONSUMER_PREFIX = "blueprintsprocessor.messageconsumer."
const val PROPERTY_MESSAGE_PRODUCER_PREFIX = "blueprintsprocessor.messageproducer."
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
index d76621c26..67dba1f19 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
@@ -32,6 +32,7 @@ import org.apache.kafka.streams.StreamsConfig
/** Common Properties **/
abstract class CommonProperties {
+
lateinit var type: String
lateinit var topic: String
lateinit var bootstrapServers: String
@@ -73,6 +74,7 @@ open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties()
/** SSL Auth */
open class KafkaSslAuthMessageProducerProperties : KafkaBasicAuthMessageProducerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -100,6 +102,7 @@ open class KafkaSslAuthMessageProducerProperties : KafkaBasicAuthMessageProducer
/** (SASL) SCRAM SSL Auth */
class KafkaScramSslAuthMessageProducerProperties : KafkaSslAuthMessageProducerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -109,8 +112,8 @@ class KafkaScramSslAuthMessageProducerProperties : KafkaSslAuthMessageProducerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
@@ -122,6 +125,7 @@ abstract class MessageConsumerProperties : CommonProperties()
/** Basic Auth */
open class KafkaStreamsBasicAuthConsumerProperties : MessageConsumerProperties() {
+
lateinit var applicationId: String
var autoOffsetReset: String = "latest"
var processingGuarantee: String = StreamsConfig.EXACTLY_ONCE
@@ -137,6 +141,7 @@ open class KafkaStreamsBasicAuthConsumerProperties : MessageConsumerProperties()
/** SSL Auth */
open class KafkaStreamsSslAuthConsumerProperties : KafkaStreamsBasicAuthConsumerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -163,6 +168,7 @@ open class KafkaStreamsSslAuthConsumerProperties : KafkaStreamsBasicAuthConsumer
/** (SASL) SCRAM SSL Auth */
class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -172,8 +178,8 @@ class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
@@ -182,6 +188,7 @@ class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerPr
/** Message Consumer Properties **/
/** Basic Auth */
open class KafkaBasicAuthMessageConsumerProperties : MessageConsumerProperties() {
+
lateinit var groupId: String
lateinit var clientId: String
var autoCommit: Boolean = true
@@ -213,6 +220,7 @@ open class KafkaBasicAuthMessageConsumerProperties : MessageConsumerProperties()
/** SSL Auth */
open class KafkaSslAuthMessageConsumerProperties : KafkaBasicAuthMessageConsumerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -239,6 +247,7 @@ open class KafkaSslAuthMessageConsumerProperties : KafkaBasicAuthMessageConsumer
/** (SASL) SCRAM SSL Auth */
class KafkaScramSslAuthMessageConsumerProperties : KafkaSslAuthMessageConsumerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -248,8 +257,8 @@ class KafkaScramSslAuthMessageConsumerProperties : KafkaSslAuthMessageConsumerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
index e9bc5d8ad..8b31de9b9 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
@@ -102,15 +102,15 @@ class MessageProducerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaSslAuth(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaSslAuthMessageProducerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaSslAuthMessageProducerProperties(block)
)
}
fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block)
)
}
}
@@ -125,14 +125,14 @@ fun BluePrintTypes.kafkaBasicAuthMessageProducerProperties(block: KafkaBasicAuth
fun BluePrintTypes.kafkaSslAuthMessageProducerProperties(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaSslAuthMessageProducerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaScramSslAuthMessageProducerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -174,58 +174,60 @@ open class KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder : MessagePro
}
open class KafkaSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
+ property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
+ property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
+ property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaSslAuthMessageProducerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
+ property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
+ property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
+ property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
}
/** Relationships Templates DSL for Message Consumer */
@@ -255,15 +257,15 @@ class MessageConsumerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaSslAuth(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
)
}
fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
)
}
@@ -276,15 +278,15 @@ class MessageConsumerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaStreamsSslAuth(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
)
}
fun kafkaStreamsScramSslAuth(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
)
}
}
@@ -299,14 +301,14 @@ fun BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block: KafkaBasicAuth
fun BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaSslAuthMessageConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaScramSslAuthMessageConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -320,14 +322,14 @@ fun BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block: KafkaStreamsBa
fun BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaStreamsSslAuthConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaStreamsScramSslAuthConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -378,58 +380,60 @@ open class KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder : MessageCon
}
open class KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
+ property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
+ property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
+ property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
+ property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
+ property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
+ property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
}
/** KafkaStreamsConsumerProperties assignment builder */
@@ -462,56 +466,58 @@ open class KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder : MessageCon
}
open class KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
+ property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
+ property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
+ property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
+ property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
+ property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
+ property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
index 67fbef580..456bfbdd9 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
@@ -59,12 +59,12 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaSslAuthMessageProducerProperties::class.java
+ prefix, KafkaSslAuthMessageProducerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaScramSslAuthMessageProducerProperties::class.java
+ prefix, KafkaScramSslAuthMessageProducerProperties::class.java
)
}
else -> {
@@ -113,33 +113,33 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
/** Message Consumer */
MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaBasicAuthMessageConsumerProperties::class.java
+ prefix, KafkaBasicAuthMessageConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaSslAuthMessageConsumerProperties::class.java
+ prefix, KafkaSslAuthMessageConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaScramSslAuthMessageConsumerProperties::class.java
+ prefix, KafkaScramSslAuthMessageConsumerProperties::class.java
)
}
/** Stream Consumer */
MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsBasicAuthConsumerProperties::class.java
+ prefix, KafkaStreamsBasicAuthConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsSslAuthConsumerProperties::class.java
+ prefix, KafkaStreamsSslAuthConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsScramSslAuthConsumerProperties::class.java
+ prefix, KafkaStreamsScramSslAuthConsumerProperties::class.java
)
}
else -> {
@@ -178,44 +178,44 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
private fun blueprintMessageConsumerService(messageConsumerProperties: MessageConsumerProperties):
- BlueprintMessageConsumerService {
+ BlueprintMessageConsumerService {
- when (messageConsumerProperties.type) {
- /** Message Consumer */
- MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
- return KafkaMessageConsumerService(
+ when (messageConsumerProperties.type) {
+ /** Message Consumer */
+ MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaBasicAuthMessageConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
- return KafkaMessageConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaSslAuthMessageConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
- return KafkaMessageConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaScramSslAuthMessageConsumerProperties
- )
- }
- /** Stream Consumer */
- MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ /** Stream Consumer */
+ MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsBasicAuthConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsSslAuthConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsScramSslAuthConsumerProperties
- )
- }
- else -> {
- throw BluePrintProcessorException("couldn't get message client service for ${messageConsumerProperties.type}")
+ )
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get message client service for ${messageConsumerProperties.type}")
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
index 311d35c38..b39d89bfd 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
@@ -74,6 +74,7 @@ interface KafkaConsumerRecordsFunction : ConsumerFunction {
}
interface KafkaStreamConsumerFunction : ConsumerFunction {
+
suspend fun createTopology(
messageConsumerProperties: MessageConsumerProperties,
additionalConfig: Map<String, Any>?
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
index 66d3a5b73..36392cff3 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
@@ -25,11 +25,17 @@ interface BlueprintMessageProducerService {
sendMessageNB(key, message, headers)
}
- fun sendMessage(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean = runBlocking {
- sendMessageNB(key, topic, message, headers)
- }
+ fun sendMessage(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean =
+ runBlocking {
+ sendMessageNB(key, topic, message, headers)
+ }
suspend fun sendMessageNB(key: String = UUID.randomUUID().toString(), message: Any, headers: MutableMap<String, String>? = null): Boolean
- suspend fun sendMessageNB(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean
+ suspend fun sendMessageNB(
+ key: String = UUID.randomUUID().toString(),
+ topic: String,
+ message: Any,
+ headers: MutableMap<String, String>? = null
+ ): Boolean
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
index 59e9192bb..eccf75301 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
@@ -44,6 +44,7 @@ class KafkaMessageProducerService(
private val messageLoggerService = MessageLoggerService()
companion object {
+
const val MAX_ERR_MSG_LEN = 128
}
@@ -113,8 +114,8 @@ class KafkaMessageProducerService(
/** Truncation of error messages */
var truncErrMsg = executionServiceOutput.status.errorMessage
if (truncErrMsg != null && truncErrMsg.length > MAX_ERR_MSG_LEN) {
- truncErrMsg = "${truncErrMsg.substring(0,MAX_ERR_MSG_LEN)}" +
- " [...]. Check Blueprint Processor logs for more information."
+ truncErrMsg = "${truncErrMsg.substring(0, MAX_ERR_MSG_LEN)}" +
+ " [...]. Check Blueprint Processor logs for more information."
}
/** Truncation for Command Executor responses */
var truncPayload = executionServiceOutput.payload.deepCopy()
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
index 04b754b13..90b850017 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
@@ -61,7 +61,8 @@ class MessageLoggerService {
val headers = consumerRecord.headers().toMap()
val localhost = InetAddress.getLocalHost()
MDC.put(
- "InvokeTimestamp", ZonedDateTime
+ "InvokeTimestamp",
+ ZonedDateTime
.ofInstant(Instant.ofEpochMilli(consumerRecord.timestamp()), ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_INSTANT)
)
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
index b1af230b9..b68678baf 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
@@ -67,12 +67,12 @@ class MessagePropertiesDSLTest {
assertNotNull(relationshipTypes, "failed to get relationship types")
assertEquals(2, relationshipTypes.size, "relationshipTypes doesn't match")
assertNotNull(
- relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO],
- "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO}"
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO}"
)
assertNotNull(
- relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER],
- "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER}"
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER}"
)
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
index 77bdbe408..a69f9f51a 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
@@ -59,36 +59,39 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.messageconsumer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
- "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
- "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
- "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
- "blueprintsprocessor.messageconsumer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageconsumer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageconsumer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageconsumer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageconsumer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageconsumer.sample.scramPassword=secretpassword",
+ [
+ "blueprintsprocessor.messageconsumer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
+ "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
+ "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
+ "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
+ "blueprintsprocessor.messageconsumer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageconsumer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageconsumer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageconsumer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageconsumer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageconsumer.sample.scramPassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
- ]
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
+ ]
)
open class BlueprintMessageConsumerServiceTest {
@@ -206,46 +209,52 @@ open class BlueprintMessageConsumerServiceTest {
fun testKafkaScramSslAuthConfig() {
val expectedConfig = mapOf<String, Any>(
- ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
- ConsumerConfig.GROUP_ID_CONFIG to "sample-group",
- ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to true,
- ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "latest",
- ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java,
- ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to ByteArrayDeserializer::class.java,
- ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
- CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
- SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
- SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
- SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
- SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
- SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"sample-user\" " +
- "password=\"secretpassword\";"
- )
+ ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
+ ConsumerConfig.GROUP_ID_CONFIG to "sample-group",
+ ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to true,
+ ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "latest",
+ ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java,
+ ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to ByteArrayDeserializer::class.java,
+ ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
+ CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
+ SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
+ SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
+ SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
+ SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
+ SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
+ "username=\"sample-user\" " +
+ "password=\"secretpassword\";"
+ )
val messageConsumerProperties = bluePrintMessageLibPropertyService
- .messageConsumerProperties("${MessageLibConstants.PROPERTY_MESSAGE_CONSUMER_PREFIX}sample")
+ .messageConsumerProperties("${MessageLibConstants.PROPERTY_MESSAGE_CONSUMER_PREFIX}sample")
val configProps = messageConsumerProperties.getConfig()
- assertEquals(messageConsumerProperties.topic,
- "default-topic",
- "Topic doesn't match the expected value"
+ assertEquals(
+ messageConsumerProperties.topic,
+ "default-topic",
+ "Topic doesn't match the expected value"
+ )
+ assertEquals(
+ messageConsumerProperties.type,
+ "kafka-scram-ssl-auth",
+ "Authentication type doesn't match the expected value"
)
- assertEquals(messageConsumerProperties.type,
- "kafka-scram-ssl-auth",
- "Authentication type doesn't match the expected value")
expectedConfig.forEach {
- assertTrue(configProps.containsKey(it.key),
- "Missing expected kafka config key : ${it.key}")
- assertEquals(configProps[it.key],
- it.value,
- "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
+ assertTrue(
+ configProps.containsKey(it.key),
+ "Missing expected kafka config key : ${it.key}"
+ )
+ assertEquals(
+ configProps[it.key],
+ it.value,
+ "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
index 881f0b422..f88caa173 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
@@ -49,22 +49,25 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
- ]
+ [
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
+ ]
)
open class BlueprintMessageProducerServiceTest {
@@ -96,48 +99,53 @@ open class BlueprintMessageProducerServiceTest {
@Test
fun testKafkaScramSslAuthConfig() {
val expectedConfig = mapOf<String, Any>(
- ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
- ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to StringSerializer::class.java,
- ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to ByteArraySerializer::class.java,
- ProducerConfig.ACKS_CONFIG to "all",
- ProducerConfig.MAX_BLOCK_MS_CONFIG to 250,
- ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG to 60 * 60 * 1000,
- ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG to true,
- ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
- CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
- SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
- SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
- SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
- SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
- SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"sample-user\" " +
- "password=\"secretpassword\";"
+ ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
+ ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to StringSerializer::class.java,
+ ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to ByteArraySerializer::class.java,
+ ProducerConfig.ACKS_CONFIG to "all",
+ ProducerConfig.MAX_BLOCK_MS_CONFIG to 250,
+ ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG to 60 * 60 * 1000,
+ ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG to true,
+ ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
+ CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
+ SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
+ SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
+ SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
+ SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
+ SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
+ "username=\"sample-user\" " +
+ "password=\"secretpassword\";"
)
val messageProducerProperties = bluePrintMessageLibPropertyService
- .messageProducerProperties("${MessageLibConstants.PROPERTY_MESSAGE_PRODUCER_PREFIX}sample")
+ .messageProducerProperties("${MessageLibConstants.PROPERTY_MESSAGE_PRODUCER_PREFIX}sample")
val configProps = messageProducerProperties.getConfig()
- assertEquals(messageProducerProperties.topic,
- "default-topic",
- "Topic doesn't match the expected value"
+ assertEquals(
+ messageProducerProperties.topic,
+ "default-topic",
+ "Topic doesn't match the expected value"
+ )
+ assertEquals(
+ messageProducerProperties.type,
+ "kafka-scram-ssl-auth",
+ "Authentication type doesn't match the expected value"
)
- assertEquals(messageProducerProperties.type,
- "kafka-scram-ssl-auth",
- "Authentication type doesn't match the expected value")
expectedConfig.forEach {
- assertTrue(configProps.containsKey(it.key),
- "Missing expected kafka config key : ${it.key}"
+ assertTrue(
+ configProps.containsKey(it.key),
+ "Missing expected kafka config key : ${it.key}"
)
- assertEquals(configProps[it.key],
- it.value,
- "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
+ assertEquals(
+ configProps[it.key],
+ it.value,
+ "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
index 44990ae7f..f488a4c74 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
@@ -41,31 +41,33 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- [
- "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword",
+ [
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword",
- "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
- "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic",
- "blueprintsprocessor.messageproducer.stream-consumer.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.stream-consumer.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.stream-consumer.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.stream-consumer.scramPassword=secretpassword"
+ "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
+ "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic",
+ "blueprintsprocessor.messageproducer.stream-consumer.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.stream-consumer.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.stream-consumer.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.stream-consumer.scramPassword=secretpassword"
- ]
+ ]
)
class KafkaStreamsConsumerServiceTest {
@@ -92,7 +94,7 @@ class KafkaStreamsConsumerServiceTest {
): Topology {
val topology = Topology()
val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
- as KafkaStreamsBasicAuthConsumerProperties
+ as KafkaStreamsBasicAuthConsumerProperties
val topics = kafkaStreamsBasicAuthConsumerProperties.topic.split(",")
topology.addSource("Source", *topics.toTypedArray())
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
index 5d77c3746..aa38b6e5c 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
@@ -31,6 +31,7 @@ import java.nio.charset.Charset
import java.util.UUID
class PriorityMessage : Serializable {
+
lateinit var id: String
lateinit var requestMessage: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt
index 8d5d846d7..a47dd8918 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt
@@ -38,6 +38,7 @@ fun BluePrintDependencyService.controllerNatsService(): BluePrintNatsService {
class NatsLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_NATS_LIB_PROPERTY = "blueprint-nats-lib-property-service"
const val DEFULT_NATS_SELECTOR = "cds-controller"
const val PROPERTY_NATS_PREFIX = "blueprintsprocessor.nats."
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt
index 74897f322..a989dcf1e 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt
@@ -20,20 +20,25 @@ import org.onap.ccsdk.cds.blueprintsprocessor.nats.utils.NatsClusterUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ClusterUtils
open class NatsConnectionProperties {
+
lateinit var type: String
var clusterId: String = NatsClusterUtils.clusterId()
var clientId: String = ClusterUtils.clusterNodeId()
lateinit var host: String
+
/** Rest endpoint selector to access Monitoring API */
var monitoringSelector: String? = null
}
open class TokenAuthNatsConnectionProperties : NatsConnectionProperties() {
+
lateinit var token: String
}
open class TLSAuthNatsConnectionProperties : NatsConnectionProperties() {
+
var trustCertCollection: String? = null
+
/** Below Used only for Mutual TLS */
var clientCertChain: String? = null
var clientPrivateKey: String? = null
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
index 8ef476446..4c5471796 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
@@ -111,6 +111,7 @@ open class NatsConnectionPropertiesAssignmentBuilder : PropertiesAssignmentBuild
}
class NatsTokenAuthPropertiesAssignmentBuilder : NatsConnectionPropertiesAssignmentBuilder() {
+
fun token(selector: String) = token(selector.asJsonPrimitive())
fun token(selector: JsonNode) = property(TokenAuthNatsConnectionProperties::token, selector)
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
index 18d0639f1..1ac44bc94 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
@@ -80,16 +80,16 @@ open class BluePrintNatsLibPropertyService(private var bluePrintPropertiesServic
fun bluePrintNatsService(natsConnectionProperties: NatsConnectionProperties):
BluePrintNatsService {
- return when (natsConnectionProperties) {
- is TokenAuthNatsConnectionProperties -> {
- TokenAuthNatsService(natsConnectionProperties)
- }
- is TLSAuthNatsConnectionProperties -> {
- TLSAuthNatsService(natsConnectionProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get NATS service for properties $natsConnectionProperties")
+ return when (natsConnectionProperties) {
+ is TokenAuthNatsConnectionProperties -> {
+ TokenAuthNatsService(natsConnectionProperties)
+ }
+ is TLSAuthNatsConnectionProperties -> {
+ TLSAuthNatsService(natsConnectionProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get NATS service for properties $natsConnectionProperties")
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
index ba993d96a..9a332d589 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
@@ -30,15 +30,18 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintNatsLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintNatsLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.nats.cds-controller.type=token-auth",
- "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
- "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
- ]
+ [
+ "blueprintsprocessor.nats.cds-controller.type=token-auth",
+ "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
+ "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
+ ]
)
class BluePrintNatsLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
index a86dcc40f..2a4d05dcb 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service
open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: BluePrintPropertiesService) {
companion object {
+
const val PREFIX_BLUEPRINT_PROCESSOR = "blueprintsprocessor"
}
@@ -60,6 +61,7 @@ open class BluePrintPropertyConfiguration {
@Service
open class BluePrintPropertiesService(private var bluePrintPropertyConfig: BluePrintPropertyConfiguration) {
+
private val log = logger(BluePrintPropertiesService::class)
fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
index 58d0f13c2..61997061b 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
@@ -34,40 +34,51 @@ import java.util.UUID
*/
open class ExecutionServiceInput {
+
@get:ApiModelProperty(required = false, hidden = true)
var correlationUUID: String = UUID.randomUUID().toString()
+
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
+
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
+
@get:ApiModelProperty(
required = true,
value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
)
lateinit var payload: ObjectNode
+
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
var stepData: StepData? = null
}
open class ExecutionServiceOutput {
+
@get:ApiModelProperty(required = false, hidden = true)
var correlationUUID: String? = null
+
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
+
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
+
@get:ApiModelProperty(required = true, value = "Status of the request.")
lateinit var status: Status
+
@get:ApiModelProperty(
required = true,
value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
)
lateinit var payload: ObjectNode
+
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
var stepData: StepData? = null
@@ -77,12 +88,16 @@ const val ACTION_MODE_ASYNC = "async"
const val ACTION_MODE_SYNC = "sync"
open class ActionIdentifiers {
+
@get:ApiModelProperty(required = false, value = "Name of the CBA.")
lateinit var blueprintName: String
+
@get:ApiModelProperty(required = false, value = "Version of the CBA.")
lateinit var blueprintVersion: String
+
@get:ApiModelProperty(required = true, value = "Name of the workflow to execute.")
lateinit var actionName: String
+
@get:ApiModelProperty(
required = true,
value = "Async processing is only supported for gRPC client.",
@@ -92,31 +107,41 @@ open class ActionIdentifiers {
}
open class CommonHeader {
+
@get:ApiModelProperty(required = true, value = "Date of the execution", example = "2012-04-23T18:25:43.511Z")
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = Date()
+
@get:ApiModelProperty(required = true, value = "Identify the system/person triggering the request.")
lateinit var originatorId: String
+
@get:ApiModelProperty(required = true, value = "Uniquely identify a request.")
lateinit var requestId: String
+
@get:ApiModelProperty(required = true, value = "Allow for fine-grain request identifier")
lateinit var subRequestId: String
+
@get:ApiModelProperty(required = false, hidden = true)
var flags: Flags? = null
}
open class Flags {
+
@get:ApiModelProperty(value = "Whether or not to force the action.")
var isForce: Boolean = false
+
@get:ApiModelProperty(value = "3600")
var ttl: Int = 3600
}
open class Status {
+
@get:ApiModelProperty(required = true, value = "HTTP status code equivalent.")
var code: Int = 200
+
@get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.")
var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name
+
@get:ApiModelProperty(
required = true,
value = "Time when the execution ended.",
@@ -124,13 +149,16 @@ open class Status {
)
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = Date()
+
@get:ApiModelProperty(required = false, value = "Error message when system failed")
var errorMessage: String? = null
+
@get:ApiModelProperty(required = true, value = "Message providing request status")
var message: String = BluePrintConstants.STATUS_SUCCESS
}
open class StepData {
+
lateinit var name: String
var properties: MutableMap<String, JsonNode> = mutableMapOf()
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
index d3c88d732..5493bac1a 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
@@ -80,6 +80,7 @@ open class HazelcastClusterService : BluePrintClusterService {
)
val configFile = configuration.configFile
+
/** Check file exists */
val clusterConfigFile = normalizedFile(configuration.configFile)
check(clusterConfigFile.absolutePath.endsWith("yaml", true)) {
@@ -211,6 +212,7 @@ open class HazelcastClusterService : BluePrintClusterService {
open class BlueprintsClusterMembershipListener() :
MembershipListener {
+
private val log = logger(BlueprintsClusterMembershipListener::class)
override fun memberRemoved(membershipEvent: MembershipEvent) {
@@ -223,6 +225,7 @@ open class BlueprintsClusterMembershipListener() :
}
open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val name: String) : ClusterLock {
+
private val log = logger(ClusterLockImpl::class)
private val distributedLock: FencedLock = hazelcast.cpSubsystem.getLock(name)
@@ -238,8 +241,10 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val
override suspend fun tryLock(timeout: Long): Boolean {
return distributedLock.tryLock(timeout, TimeUnit.MILLISECONDS)
- .also { if (it) log.trace("Cluster lock acquired: $name")
- else log.trace("Failed to acquire Cluster lock $name within timeout $timeout") }
+ .also {
+ if (it) log.trace("Cluster lock acquired: $name")
+ else log.trace("Failed to acquire Cluster lock $name within timeout $timeout")
+ }
}
override suspend fun unLock() {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
index 2d957c289..8cb9f4f92 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
@@ -71,6 +71,7 @@ data class ClusterMember(
)
interface ClusterLock {
+
fun name(): String
suspend fun lock()
suspend fun fenceLock(): String
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
index 7ef4eb49b..95394e7a9 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
@@ -24,7 +24,6 @@ import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterLock
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import java.lang.RuntimeException
import kotlin.test.assertEquals
class BluePrintClusterExtensionsTest {
@@ -58,7 +57,8 @@ class BluePrintClusterExtensionsTest {
try {
clusterLockMock.executeWithLock(1_000) { throw RuntimeException("It crashed") }
- } catch (e: Exception) { }
+ } catch (e: Exception) {
+ }
verify { runBlocking { clusterLockMock.unLock() } }
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
index e214b6593..da5564235 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
@@ -45,6 +45,7 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
class HazelcastClusterServiceTest {
+
private val log = logger(HazelcastClusterServiceTest::class)
private val clusterSize = 3
@@ -229,6 +230,7 @@ class HazelcastClusterServiceTest {
}
open class SampleSchedulerTask : Runnable, Serializable {
+
private val log = logger(SampleSchedulerTask::class)
override fun run() {
log.info("I am scheduler action")
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
index 23125430a..6e9e4b554 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
@@ -47,6 +47,7 @@ fun BluePrintDependencyService.restClientService(jsonNode: JsonNode): BlueprintW
class RestLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service"
const val PROPERTY_REST_CLIENT_PREFIX = "blueprintsprocessor.restclient."
const val PROPERTY_TYPE = "type"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
index 4c18f81ab..a227cf24e 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
@@ -19,12 +19,14 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest
open class RestClientProperties {
+
lateinit var type: String
lateinit var url: String
var additionalHeaders: Map<String, String>? = null
}
open class SSLRestClientProperties : RestClientProperties() {
+
lateinit var keyStoreInstance: String // JKS, PKCS12
lateinit var sslTrust: String
lateinit var sslTrustPassword: String
@@ -46,15 +48,18 @@ open class SSLTokenAuthRestClientProperties : SSLRestClientProperties() {
}
open class BasicAuthRestClientProperties : RestClientProperties() {
+
lateinit var password: String
lateinit var username: String
}
open class TokenAuthRestClientProperties : RestClientProperties() {
+
var token: String? = null
}
open class PolicyManagerRestClientProperties : RestClientProperties() {
+
lateinit var env: String
lateinit var clientAuth: String
lateinit var authorisation: String
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
index 5d68e5d43..ca1046dde 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
@@ -112,6 +112,7 @@ open class RestClientPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
}
open class BasicAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun password(password: String) {
password(password.asJsonPrimitive())
}
@@ -130,6 +131,7 @@ open class BasicAuthRestClientPropertiesAssignmentBuilder : RestClientProperties
}
open class TokenAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun token(token: String) {
token(token.asJsonPrimitive())
}
@@ -140,6 +142,7 @@ open class TokenAuthRestClientPropertiesAssignmentBuilder : RestClientProperties
}
open class SslAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun keyStoreInstance(keyStoreInstance: String) {
keyStoreInstance(keyStoreInstance.asJsonPrimitive())
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
index 5b6691eff..4b5c2c4e8 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
@@ -25,6 +25,7 @@ import reactor.core.publisher.Mono
import reactor.util.context.Context
open class RestServerLoggingWebFilter : WebFilter {
+
override fun filter(serverWebExchange: ServerWebExchange, webFilterChain: WebFilterChain): Mono<Void> {
val loggingService = RestLoggerService()
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
index bfc0a5cd4..be9b849f6 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
@@ -26,7 +26,7 @@ import java.util.Base64
class BasicAuthRestClientService(
private val restClientProperties:
- BasicAuthRestClientProperties
+ BasicAuthRestClientProperties
) :
BlueprintWebClientService {
@@ -49,21 +49,21 @@ class BasicAuthRestClientService(
}
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- // inject additionalHeaders
- customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
+ Array<BasicHeader> {
+ val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+ // inject additionalHeaders
+ customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- val encodedCredentials = setBasicAuth(
- restClientProperties.username,
- restClientProperties.password
- )
- customHeaders[HttpHeaders.AUTHORIZATION] =
- "Basic $encodedCredentials"
+ if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
+ val encodedCredentials = setBasicAuth(
+ restClientProperties.username,
+ restClientProperties.password
+ )
+ customHeaders[HttpHeaders.AUTHORIZATION] =
+ "Basic $encodedCredentials"
+ }
+ return super.convertToBasicHeaders(customHeaders)
}
- return super.convertToBasicHeaders(customHeaders)
- }
private fun setBasicAuth(username: String, password: String): String {
val credentialsString = "$username:$password"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
index 8f528a2ef..a2c68ec68 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
@@ -90,7 +90,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
else -> {
throw BluePrintProcessorException(
"Rest adaptor($type) is" +
- " not supported"
+ " not supported"
)
}
}
@@ -128,91 +128,93 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
}
private fun blueprintWebClientService(restClientProperties: RestClientProperties):
- BlueprintWebClientService {
-
- when (restClientProperties) {
- is SSLRestClientProperties -> {
- return SSLRestClientService(restClientProperties)
- }
- is TokenAuthRestClientProperties -> {
- return TokenAuthRestClientService(restClientProperties)
- }
- is BasicAuthRestClientProperties -> {
- return BasicAuthRestClientService(restClientProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type} uri: ${restClientProperties.url}")
+ BlueprintWebClientService {
+
+ when (restClientProperties) {
+ is SSLRestClientProperties -> {
+ return SSLRestClientService(restClientProperties)
+ }
+ is TokenAuthRestClientProperties -> {
+ return TokenAuthRestClientService(restClientProperties)
+ }
+ is BasicAuthRestClientProperties -> {
+ return BasicAuthRestClientService(restClientProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type} uri: ${restClientProperties.url}")
+ }
}
}
- }
private fun tokenRestClientProperties(prefix: String):
- TokenAuthRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, TokenAuthRestClientProperties::class.java
- )
- }
+ TokenAuthRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, TokenAuthRestClientProperties::class.java
+ )
+ }
private fun basicAuthRestClientProperties(prefix: String):
- BasicAuthRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java
- )
- }
+ BasicAuthRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, BasicAuthRestClientProperties::class.java
+ )
+ }
private fun sslBasicAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
+ SSLRestClientProperties {
- val sslProps: SSLBasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, SSLBasicAuthRestClientProperties::class.java
- )
- val basicProps: BasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java
- )
- sslProps.basicAuth = basicProps
- return sslProps
- }
+ val sslProps: SSLBasicAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, SSLBasicAuthRestClientProperties::class.java
+ )
+ val basicProps: BasicAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, BasicAuthRestClientProperties::class.java
+ )
+ sslProps.basicAuth = basicProps
+ return sslProps
+ }
private fun sslTokenAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
+ SSLRestClientProperties {
- val sslProps: SSLTokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix,
- SSLTokenAuthRestClientProperties::class.java
- )
- val basicProps: TokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix,
- TokenAuthRestClientProperties::class.java
- )
- sslProps.tokenAuth = basicProps
- return sslProps
- }
+ val sslProps: SSLTokenAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ SSLTokenAuthRestClientProperties::class.java
+ )
+ val basicProps: TokenAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ TokenAuthRestClientProperties::class.java
+ )
+ sslProps.tokenAuth = basicProps
+ return sslProps
+ }
private fun sslNoAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, SSLRestClientProperties::class.java
- )
- }
+ SSLRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, SSLRestClientProperties::class.java
+ )
+ }
private fun policyManagerRestClientProperties(prefix: String):
- PolicyManagerRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, PolicyManagerRestClientProperties::class.java
- )
- }
+ PolicyManagerRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, PolicyManagerRestClientProperties::class.java
+ )
+ }
interface PreInterceptor {
+
fun getInstance(jsonNode: JsonNode): BlueprintWebClientService?
fun getInstance(selector: String): BlueprintWebClientService?
}
interface PostInterceptor {
+
fun getInstance(jsonNode: JsonNode, service: BlueprintWebClientService): BlueprintWebClientService
fun getInstance(selector: String, service: BlueprintWebClientService): BlueprintWebClientService
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
index 11f6dc7e3..9beacfcea 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
@@ -165,14 +165,14 @@ interface BlueprintWebClientService {
httpUriRequest: HttpUriRequest,
responseType: Class<T>
):
- WebClientResponse<T> {
- val httpResponse = httpClient().execute(httpUriRequest)
- val statusCode = httpResponse.statusLine.statusCode
- httpResponse.entity.content.use {
- val body = getResponse(it, responseType)
- return WebClientResponse(statusCode, body)
+ WebClientResponse<T> {
+ val httpResponse = httpClient().execute(httpUriRequest)
+ val statusCode = httpResponse.statusLine.statusCode
+ httpResponse.entity.content.use {
+ val body = getResponse(it, responseType)
+ return WebClientResponse(statusCode, body)
+ }
}
- }
suspend fun getNB(path: String): WebClientResponse<String> {
return getNB(path, null, String::class.java)
@@ -183,9 +183,9 @@ interface BlueprintWebClientService {
}
suspend fun <T> getNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- get(path, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ get(path, additionalHeaders!!, responseType)
+ }
suspend fun postNB(path: String, request: Any): WebClientResponse<String> {
return postNB(path, request, null, String::class.java)
@@ -230,19 +230,19 @@ interface BlueprintWebClientService {
}
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?):
- WebClientResponse<String> {
- return deleteNB(path, additionalHeaders, String::class.java)
- }
+ WebClientResponse<String> {
+ return deleteNB(path, additionalHeaders, String::class.java)
+ }
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- delete(path, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ delete(path, additionalHeaders!!, responseType)
+ }
suspend fun <T> patchNB(path: String, request: Any, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- patch(path, request, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ patch(path, request, additionalHeaders!!, responseType)
+ }
suspend fun exchangeNB(methodType: String, path: String, request: Any): WebClientResponse<String> {
return exchangeNB(
@@ -252,9 +252,9 @@ interface BlueprintWebClientService {
}
suspend fun exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?):
- WebClientResponse<String> {
- return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
- }
+ WebClientResponse<String> {
+ return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
+ }
suspend fun <T> exchangeNB(
methodType: String,
@@ -294,16 +294,16 @@ interface BlueprintWebClientService {
}
private fun basicHeaders(headers: Map<String, String>?):
- Array<BasicHeader> {
- val basicHeaders = mutableListOf<BasicHeader>()
- defaultHeaders().forEach { (name, value) ->
- basicHeaders.add(BasicHeader(name, value))
- }
- headers?.forEach { name, value ->
- basicHeaders.add(BasicHeader(name, value))
+ Array<BasicHeader> {
+ val basicHeaders = mutableListOf<BasicHeader>()
+ defaultHeaders().forEach { (name, value) ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ headers?.forEach { name, value ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ return basicHeaders.toTypedArray()
}
- return basicHeaders.toTypedArray()
- }
// Non Blocking Rest Implementation
suspend fun httpClientNB(): CloseableHttpClient {
@@ -323,8 +323,8 @@ interface BlueprintWebClientService {
restClientProperties.additionalHeaders?.let {
if (it.keys.map { k -> k.toLowerCase().trim() }.contains(HttpHeaders.AUTHORIZATION.toLowerCase())) {
val errMsg = "Error in definition of endpoint ${restClientProperties.url}." +
- " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
- " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
+ " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
+ " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
WebClientUtils.log.error(errMsg)
throw BluePrintProcessorException(errMsg)
} else {
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
index dc45e3545..611c0855d 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
@@ -54,9 +54,11 @@ import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
class RestLoggerService {
+
private val log = logger(RestLoggerService::class)
companion object {
+
/** Used before invoking any REST outbound request, Inbound Invocation ID is used as request Id
* for outbound Request, If invocation Id is missing then default Request Id will be generated.
*/
@@ -110,6 +112,7 @@ suspend fun <T> mdcWebCoroutineScope(
block: suspend CoroutineScope.() -> T
) = coroutineScope {
val reactorContext = this.coroutineContext[ReactorContext]
+
/** Populate MDC context only if present in Reactor Context */
val newContext = if (reactorContext != null &&
!reactorContext.context.isEmpty &&
@@ -138,8 +141,11 @@ fun <T> monoMdc(
block: suspend CoroutineScope.() -> T?
): Mono<T> = Mono.create { sink ->
- val reactorContext = (context[ReactorContext]?.context?.putAll(sink.currentContext())
- ?: sink.currentContext()).asCoroutineContext()
+ val reactorContext = (
+ context[ReactorContext]?.context?.putAll(sink.currentContext())
+ ?: sink.currentContext()
+ ).asCoroutineContext()
+
/** Populate MDC context only if present in Reactor Context */
val newContext = if (!reactorContext.context.isEmpty &&
reactorContext.context.hasKey(MDCContext)
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
index 57702f8ac..600eedf15 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
@@ -23,7 +23,7 @@ import org.springframework.http.MediaType
class TokenAuthRestClientService(
private val restClientProperties:
- TokenAuthRestClientProperties
+ TokenAuthRestClientProperties
) :
BlueprintWebClientService {
@@ -36,15 +36,15 @@ class TokenAuthRestClientService(
}
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- // inject additionalHeaders
- customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
+ Array<BasicHeader> {
+ val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+ // inject additionalHeaders
+ customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
+ if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
+ customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
+ }
+ return super.convertToBasicHeaders(customHeaders)
}
- return super.convertToBasicHeaders(customHeaders)
- }
override fun host(uri: String): String {
return restClientProperties.url + uri
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
index 53047d4a8..f45d1cd69 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
@@ -42,35 +42,38 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
- BluePrintPropertiesService::class]
+ classes = [
+ BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
+ BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
- "blueprintsprocessor.restclient.sample.userId=sampleuser",
- "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
- "blueprintsprocessor.restclient.sslbasic.username=admin",
- "blueprintsprocessor.restclient.sslbasic.password=cds",
- "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
- "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
- "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
- "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
- ]
+ [
+ "blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
+ "blueprintsprocessor.restclient.sample.userId=sampleuser",
+ "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.sslbasic.username=admin",
+ "blueprintsprocessor.restclient.sslbasic.password=cds",
+ "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
+ "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
+ "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
+ "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
+ ]
)
class BluePrintRestLibPropertyServiceTest {
@@ -84,8 +87,9 @@ class BluePrintRestLibPropertyServiceTest {
)
assertNotNull(properties, "failed to create property bean")
assertNotNull(
- properties.url, "failed to get url property in" +
- " property bean"
+ properties.url,
+ "failed to get url property in" +
+ " property bean"
)
}
@@ -424,6 +428,7 @@ class BluePrintRestLibPropertyServiceTest {
}
companion object BluePrintRestLibPropertyServiceTest {
+
val defaultMapper = ObjectMapper()
val expectedTokenAuthDefaultHeaders = mapOf<String, String>(
"Content-Type" to "application/json",
@@ -435,7 +440,8 @@ class BluePrintRestLibPropertyServiceTest {
""",
"additionalHeaders" : {
"authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
)
private fun sslTokenAuthEndpointWithHeadersField(headers: String = ""): String =
@@ -462,7 +468,8 @@ class BluePrintRestLibPropertyServiceTest {
"username" : "admin",
"password" : "cds"
}$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
private fun sslNoAuthEndpointWithHeadersField(headers: String = ""): String = """{
"type" : "ssl-no-auth",
@@ -472,7 +479,8 @@ class BluePrintRestLibPropertyServiceTest {
"sslTrustPassword" : "changeit",
"sslKey" : "src/test/resources/keystore.p12",
"sslKeyPassword" : "changeit"$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
// Don't forget to supply "," as the first char to make valid JSON
private fun basicAuthEndpointWithHeadersField(headers: String = ""): String =
@@ -481,37 +489,44 @@ class BluePrintRestLibPropertyServiceTest {
"url": "http://127.0.0.1:8000",
"username": "user",
"password": "pass"$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
private val emptyAdditionalHeaders = """,
"additionalHeaders" : {
- }""".trimIndent()
+ }
+ """.trimIndent()
private val oneAdditionalParameter = """,
"additionalHeaders" : {
"key1": "value1"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val threeAdditionalHeaders = """,
"additionalHeaders" : {
"key1": "value1",
"key2": "value2",
"key3": "value3"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val contentTypeAdditionalHeader = """,
"additionalHeaders" : {
"${HttpHeaders.CONTENT_TYPE}": "${MediaType.APPLICATION_XML}"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val additionalHeadersWithAuth = """,
"additionalHeaders" : {
"Authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
private val additionalHeadersWithAuthLowercased = """,
"additionalHeaders" : {
"authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
index ea202481e..74e3807f7 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
@@ -65,31 +65,33 @@ import kotlin.test.assertNotNull
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(
- classes = [BluePrintRestLibConfiguration::class, SampleController::class,
+ classes = [
+ BluePrintRestLibConfiguration::class, SampleController::class,
SecurityConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- [
- "server.port=8443",
- "server.ssl.enabled=true",
- "server.ssl.key-store=classpath:keystore.p12",
- "server.ssl.key-store-password=changeit",
- "server.ssl.keyStoreType=PKCS12",
- "server.ssl.keyAlias=tomcat",
- "blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:9081",
- "blueprintsprocessor.restclient.sample.username=admin",
- "blueprintsprocessor.restclient.sample.password=jans",
- "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.test.url=https://localhost:8443",
- "blueprintsprocessor.restclient.test.username=admin",
- "blueprintsprocessor.restclient.test.password=jans",
- "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
- ]
+ [
+ "server.port=8443",
+ "server.ssl.enabled=true",
+ "server.ssl.key-store=classpath:keystore.p12",
+ "server.ssl.key-store-password=changeit",
+ "server.ssl.keyStoreType=PKCS12",
+ "server.ssl.keyAlias=tomcat",
+ "blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:9081",
+ "blueprintsprocessor.restclient.sample.username=admin",
+ "blueprintsprocessor.restclient.sample.password=jans",
+ "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.test.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.test.username=admin",
+ "blueprintsprocessor.restclient.test.password=jans",
+ "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
+ ]
)
class RestClientServiceTest {
@@ -119,26 +121,26 @@ class RestClientServiceTest {
@Test
fun testGetQueryParam() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val response = restClientService.exchangeResource(
- HttpMethod.GET.name, "/sample/query?id=3", ""
+ HttpMethod.GET.name, "/sample/query?id=3", ""
)
assertEquals(
- "query with id:3", response.body,
- "failed to get query param response"
+ "query with id:3", response.body,
+ "failed to get query param response"
)
}
@Test
fun testGetPathParamWithWhitespace() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val response = restClientService.exchangeResource(
- HttpMethod.GET.name, "/sample/path/id 3/get", ""
+ HttpMethod.GET.name, "/sample/path/id 3/get", ""
)
assertEquals(
- "path param id:id 3", response.body,
- "failed to get query param response"
+ "path param id:id 3", response.body,
+ "failed to get query param response"
)
}
@@ -171,11 +173,11 @@ class RestClientServiceTest {
@Test
fun testSimpleBasicAuth() {
val json: String = "{\n" +
- " \"type\" : \"basic-auth\",\n" +
- " \"url\" : \"http://localhost:9081\",\n" +
- " \"username\" : \"admin\",\n" +
- " \"password\" : \"jans\"\n" +
- "}"
+ " \"type\" : \"basic-auth\",\n" +
+ " \"url\" : \"http://localhost:9081\",\n" +
+ " \"username\" : \"admin\",\n" +
+ " \"password\" : \"jans\"\n" +
+ "}"
val mapper = ObjectMapper()
val actualObj: JsonNode = mapper.readTree(json)
val restClientService = bluePrintRestLibPropertyService
@@ -203,13 +205,13 @@ class RestClientServiceTest {
headers["X-TransactionId"] = "9999"
headers["X-FromAppId"] = "AAI"
val post1 = "{\n" +
- " \"customer\": {\n" +
- " \"global-customer-id\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"subscriber-name\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"subscriber-type\": \"CUST\",\n" +
- " \"resource-version\": \"1552985011163\"\n" +
- " }\n" +
- "}"
+ " \"customer\": {\n" +
+ " \"global-customer-id\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"subscriber-name\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"subscriber-type\": \"CUST\",\n" +
+ " \"resource-version\": \"1552985011163\"\n" +
+ " }\n" +
+ "}"
lateinit var res1: Customer
lateinit var res2: Customer
lateinit var res3: String
@@ -307,11 +309,11 @@ open class SampleController {
@GetMapping("/query")
fun getQuery(@RequestParam("id") id: String): String =
- "query with id:$id"
+ "query with id:$id"
@GetMapping("/path/{id}/get")
fun getPathParam(@PathVariable("id") id: String): String =
- "path param id:$id"
+ "path param id:$id"
@PatchMapping("/name")
fun patchName(): String = "Patch request successful"
@@ -330,11 +332,11 @@ open class SampleController {
return ""
}
return "{\n" +
- " \"id\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"name\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"type\": \"CUST\",\n" +
- " \"resource\": \"1552985011163\"\n" +
- "}"
+ " \"id\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"name\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"type\": \"CUST\",\n" +
+ " \"resource\": \"1552985011163\"\n" +
+ "}"
}
@PostMapping("/aai/v14/business/customers")
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
index 382c9b7d7..dc10722cc 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
@@ -43,6 +43,7 @@ fun BluePrintDependencyService.sshClientService(jsonNode: JsonNode): BlueprintSs
class SshLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_SSH_LIB_PROPERTY = "blueprint-ssh-lib-property-service"
const val PROPERTY_SSH_CLIENT_PREFIX = "blueprintsprocessor.sshclient."
const val TYPE_BASIC_AUTH = "basic-auth"
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
index cc323adb3..295021f21 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
@@ -19,6 +19,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.ssh
open class SshClientProperties {
+
lateinit var type: String
lateinit var host: String
var port: Int = 22
@@ -27,6 +28,7 @@ open class SshClientProperties {
}
open class BasicAuthSshClientProperties : SshClientProperties() {
+
lateinit var password: String
lateinit var username: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
index a3c730039..6ee73c238 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
@@ -31,13 +31,13 @@ import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.PipedInputStream
import java.io.PipedOutputStream
+import java.util.ArrayList
import java.util.Collections
import java.util.EnumSet
import java.util.Scanner
-import java.util.ArrayList
open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties) :
- BlueprintSshClientService {
+ BlueprintSshClientService {
private val log = LoggerFactory.getLogger(BasicAuthSshClientService::class.java)!!
private val newLine = "\n".toByteArray()
@@ -54,8 +54,9 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
log.debug("SSH Client Service started successfully")
clientSession = sshClient.connect(
- basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
- basicAuthSshClientProperties.port).verify(basicAuthSshClientProperties.connectionTimeOut).session
+ basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
+ basicAuthSshClientProperties.port
+ ).verify(basicAuthSshClientProperties.connectionTimeOut).session
clientSession.addPasswordIdentity(basicAuthSshClientProperties.password)
clientSession.auth().verify(basicAuthSshClientProperties.connectionTimeOut)
@@ -79,7 +80,7 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
}
}
- override suspend fun executeCommandsNB(commands: List <String>, timeOut: Long): List<CommandResult> {
+ override suspend fun executeCommandsNB(commands: List<String>, timeOut: Long): List<CommandResult> {
val response = ArrayList<CommandResult>()
try {
var stopLoop = false
@@ -126,7 +127,8 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
private fun waitForPrompt(timeOut: Long): String {
val waitMask = channel!!.waitFor(
- Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED)), timeOut)
+ Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED)), timeOut
+ )
if (channel!!.out.toString().indexOfAny(arrayListOf("$", ">", "#")) <= 0 && waitMask.contains(ClientChannelEvent.TIMEOUT)) {
throw BluePrintProcessorException("Timeout: Failed to retrieve commands result in $timeOut ms")
}
@@ -157,8 +159,11 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
Scanner(output).use { scanner ->
while (scanner.hasNextLine()) {
val temp = scanner.nextLine()
- if (temp.isNotBlank() && (temp.trim { it <= ' ' }.startsWith("%") ||
- temp.trim { it <= ' ' }.startsWith("syntax error"))) {
+ if (temp.isNotBlank() && (
+ temp.trim { it <= ' ' }.startsWith("%") ||
+ temp.trim { it <= ' ' }.startsWith("syntax error")
+ )
+ ) {
return true
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
index f4c39c936..43a997ae9 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
@@ -31,17 +31,20 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
- "blueprintsprocessor.sshclient.sample.port=22",
- "blueprintsprocessor.sshclient.sample.password=1234",
- "blueprintsprocessor.sshclient.sample.username=dummy"
- ]
+ [
+ "blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
+ "blueprintsprocessor.sshclient.sample.port=22",
+ "blueprintsprocessor.sshclient.sample.password=1234",
+ "blueprintsprocessor.sshclient.sample.username=dummy"
+ ]
)
class BluePrintSshLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
index 3785a21b2..1cf0de52b 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
@@ -27,6 +27,7 @@ import org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
import org.apache.sshd.server.session.ServerSession
import org.apache.sshd.server.shell.ProcessShellCommandFactory
+import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
@@ -36,27 +37,29 @@ import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import java.nio.file.Paths
-import org.junit.runner.RunWith
-import kotlin.test.BeforeTest
import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
import kotlin.test.Test
-import kotlin.test.assertTrue
-import kotlin.test.assertNotNull
import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=localhost",
- "blueprintsprocessor.sshclient.sample.port=52815",
- "blueprintsprocessor.sshclient.sample.username=root",
- "blueprintsprocessor.sshclient.sample.password=dummyps"
- ]
+ [
+ "blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=localhost",
+ "blueprintsprocessor.sshclient.sample.port=52815",
+ "blueprintsprocessor.sshclient.sample.username=root",
+ "blueprintsprocessor.sshclient.sample.password=dummyps"
+ ]
)
class BlueprintSshClientServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
index 9d308202f..6e9d1968f 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
@@ -18,14 +18,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.echoShell
import org.apache.sshd.common.Factory
import org.apache.sshd.server.Environment
-import org.apache.sshd.server.command.Command
import org.apache.sshd.server.ExitCallback
-import java.io.InputStream
-import java.io.OutputStream
-import java.io.IOException
+import org.apache.sshd.server.command.Command
import java.io.BufferedReader
+import java.io.IOException
+import java.io.InputStream
import java.io.InputStreamReader
import java.io.InterruptedIOException
+import java.io.OutputStream
class EchoShellFactory : Factory<Command> {
@@ -34,6 +34,7 @@ class EchoShellFactory : Factory<Command> {
}
companion object {
+
val INSTANCE = EchoShellFactory()
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorHandling.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorHandling.kt
index e742e6375..1103a1b5b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.configs.api
object ConfigsApiDomains {
+
// ConfigsApi Domains Constants
const val CONFIGS_API = "org.onap.ccsdk.cds.blueprintsprocessor.configs.api"
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
index 05f43c151..d285fe52d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
@@ -74,7 +74,7 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
@ApiOperation(
value = "Retrieve a resource configuration snapshot.",
notes = "Retrieve a config snapshot, identified by its Resource Id and Type. " +
- "An extra 'format' parameter can be passed to tell what content-type is expected."
+ "An extra 'format' parameter can be passed to tell what content-type is expected."
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
@@ -95,38 +95,44 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
@RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String
):
- ResponseEntity<String> = runBlocking {
+ ResponseEntity<String> = runBlocking {
- var configSnapshot = ""
+ var configSnapshot = ""
- if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
- try {
- configSnapshot = resourceConfigSnapshotService.findByResourceIdAndResourceTypeAndStatus(
- resourceId,
- resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
- )
- } catch (ex: NoSuchElementException) {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
+ if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
+ try {
+ configSnapshot = resourceConfigSnapshotService.findByResourceIdAndResourceTypeAndStatus(
+ resourceId,
+ resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
+ )
+ } catch (ex: NoSuchElementException) {
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
"Could not find configuration snapshot entry for type $resourceType and Id $resourceId",
- ex.errorCauseOrDefault())
- } catch (ex: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
+ ex.errorCauseOrDefault()
+ )
+ } catch (ex: Exception) {
+ throw httpProcessorException(
+ ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
"Could not find configuration snapshot entry for type $resourceType and Id $resourceId",
- ex.errorCauseOrDefault())
+ ex.errorCauseOrDefault()
+ )
+ }
+ } else {
+ throw httpProcessorException(
+ ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
+ "Missing param. You must specify resource-id and resource-type."
+ )
}
- } else {
- throw httpProcessorException(ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
- "Missing param. You must specify resource-id and resource-type.")
- }
- var expectedContentType = format
- if (expectedContentType.indexOf('/') < 0) {
- expectedContentType = "application/$expectedContentType"
- }
- val expectedMediaType: MediaType = MediaType.valueOf(expectedContentType)
+ var expectedContentType = format
+ if (expectedContentType.indexOf('/') < 0) {
+ expectedContentType = "application/$expectedContentType"
+ }
+ val expectedMediaType: MediaType = MediaType.valueOf(expectedContentType)
- ResponseEntity.ok().contentType(expectedMediaType).body(configSnapshot)
- }
+ ResponseEntity.ok().contentType(expectedMediaType).body(configSnapshot)
+ }
@PostMapping(
"/{resourceType}/{resourceId}/{status}",
@@ -135,7 +141,7 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
@ApiOperation(
value = "Store a resource configuration snapshot identified by resourceId, resourceType, status.",
notes = "Store a resource configuration snapshot, identified by its resourceId and resourceType, " +
- "and optionally its status, either RUNNING or CANDIDATE.",
+ "and optionally its status, either RUNNING or CANDIDATE.",
response = ResourceConfigSnapshot::class, produces = MediaType.APPLICATION_JSON_VALUE
)
@ResponseBody
@@ -161,13 +167,13 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
}
@RequestMapping(
- path = ["/allByID"],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE]
+ path = ["/allByID"],
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE]
)
@ApiOperation(
- value = "Retrieve all resource configuration snapshots identified by a given resource_id",
- notes = "Retrieve all config snapshots, identified by its Resource Id, ordered by most recently created/modified date. "
+ value = "Retrieve all resource configuration snapshots identified by a given resource_id",
+ notes = "Retrieve all config snapshots, identified by its Resource Id, ordered by most recently created/modified date. "
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
@@ -184,16 +190,21 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
configSnapshots = resourceConfigSnapshotService.findAllByResourceId(resourceId)
} else {
configSnapshots = resourceConfigSnapshotService.findAllByResourceIdForStatus(
- resourceId, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase()))
+ resourceId, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
+ )
}
} catch (ex: NoSuchElementException) {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
- "Could not find configuration snapshot entry for ID $resourceId",
- ex.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
+ "Could not find configuration snapshot entry for ID $resourceId",
+ ex.errorCauseOrDefault()
+ )
} catch (ex: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
- "Unexpected error while finding configuration snapshot entries for ID $resourceId",
- ex.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
+ "Unexpected error while finding configuration snapshot entries for ID $resourceId",
+ ex.errorCauseOrDefault()
+ )
}
val expectedMediaType: MediaType = MediaType.valueOf(JSON_MIME_TYPE)
@@ -201,13 +212,13 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
}
@RequestMapping(
- path = ["allByType"],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE]
+ path = ["allByType"],
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE]
)
@ApiOperation(
- value = "Retrieve all resource configuration snapshots for a given resource type.",
- notes = "Retrieve all config snapshots matching a specified Resource Type, ordered by most recently created/modified date. "
+ value = "Retrieve all resource configuration snapshots for a given resource type.",
+ notes = "Retrieve all config snapshots matching a specified Resource Type, ordered by most recently created/modified date. "
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
@@ -224,16 +235,21 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
configSnapshots = resourceConfigSnapshotService.findAllByResourceType(resourceType)
} else {
configSnapshots = resourceConfigSnapshotService.findAllByResourceTypeForStatus(
- resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase()))
+ resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
+ )
}
} catch (ex: NoSuchElementException) {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
- "Could not find configuration snapshot entry for ID $resourceType",
- ex.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, ConfigsApiDomains.CONFIGS_API,
+ "Could not find configuration snapshot entry for ID $resourceType",
+ ex.errorCauseOrDefault()
+ )
} catch (ex: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
- "Unexpected error while finding configuration snapshot entries for type $resourceType",
- ex.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.INVALID_REQUEST_FORMAT, ConfigsApiDomains.CONFIGS_API,
+ "Unexpected error while finding configuration snapshot entries for type $resourceType",
+ ex.errorCauseOrDefault()
+ )
}
val expectedMediaType: MediaType = MediaType.valueOf(JSON_MIME_TYPE)
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
index 2b9bb31f6..8cd8dbd9a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
@@ -28,4 +28,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
*/
@RestControllerAdvice("org.onap.ccsdk.cds.blueprintsprocessor.configs.api")
open class ResourceConfigSnapshotExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorCatalogTestConfiguration.kt
index 66fc3b2ed..5a000d157 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
index e2fa5ca44..634c3368b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
@@ -148,13 +148,13 @@ class ResourceConfigSnapshotControllerTest {
post(resourceType, resourceId, "RUNNING")
webTestClient
- .get()
- .uri("/api/v1/configs/allByID?resourceId=$resourceId")
- .exchange()
- .expectStatus().is2xxSuccessful
- .expectBody()
- .jsonPath("$.length()")
- .isEqualTo(1)
+ .get()
+ .uri("/api/v1/configs/allByID?resourceId=$resourceId")
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ .expectBody()
+ .jsonPath("$.length()")
+ .isEqualTo(1)
}
}
@@ -166,13 +166,13 @@ class ResourceConfigSnapshotControllerTest {
post(resourceType, resourceId, "CANDIDATE")
webTestClient
- .get()
- .uri("/api/v1/configs/allByID?resourceId=$resourceId&status=CANDIDATE")
- .exchange()
- .expectStatus().is2xxSuccessful
- .expectBody()
- .jsonPath("$.length()")
- .isEqualTo(1)
+ .get()
+ .uri("/api/v1/configs/allByID?resourceId=$resourceId&status=CANDIDATE")
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ .expectBody()
+ .jsonPath("$.length()")
+ .isEqualTo(1)
}
}
@@ -181,11 +181,11 @@ class ResourceConfigSnapshotControllerTest {
runBlocking {
webTestClient
- .get()
- .uri("/api/v1/configs/allByID")
- .exchange()
- .expectStatus().is4xxClientError
- .expectBody()
+ .get()
+ .uri("/api/v1/configs/allByID")
+ .exchange()
+ .expectStatus().is4xxClientError
+ .expectBody()
}
}
@@ -194,11 +194,11 @@ class ResourceConfigSnapshotControllerTest {
runBlocking {
webTestClient
- .get()
- .uri("/api/v1/configs/allByID?resourceId=$resourceId&status=NOTGOOD")
- .exchange()
- .expectStatus().is4xxClientError
- .expectBody()
+ .get()
+ .uri("/api/v1/configs/allByID?resourceId=$resourceId&status=NOTGOOD")
+ .exchange()
+ .expectStatus().is4xxClientError
+ .expectBody()
}
}
@@ -210,13 +210,13 @@ class ResourceConfigSnapshotControllerTest {
post(resourceType, "1", "RUNNING")
webTestClient
- .get()
- .uri("/api/v1/configs/allByType?resourceType=$resourceType")
- .exchange()
- .expectStatus().is2xxSuccessful
- .expectBody()
- .jsonPath("$.length()")
- .isEqualTo(3)
+ .get()
+ .uri("/api/v1/configs/allByType?resourceType=$resourceType")
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ .expectBody()
+ .jsonPath("$.length()")
+ .isEqualTo(3)
}
}
@@ -225,11 +225,11 @@ class ResourceConfigSnapshotControllerTest {
runBlocking {
webTestClient
- .get()
- .uri("/api/v1/configs/allByType")
- .exchange()
- .expectStatus().is4xxClientError
- .expectBody()
+ .get()
+ .uri("/api/v1/configs/allByType")
+ .exchange()
+ .expectStatus().is4xxClientError
+ .expectBody()
}
}
@@ -238,11 +238,11 @@ class ResourceConfigSnapshotControllerTest {
runBlocking {
webTestClient
- .get()
- .uri("/api/v1/configs/allByType?resourceType=$resourceType&status=NOTGOOD")
- .exchange()
- .expectStatus().is4xxClientError
- .expectBody()
+ .get()
+ .uri("/api/v1/configs/allByType?resourceType=$resourceType&status=NOTGOOD")
+ .exchange()
+ .expectStatus().is4xxClientError
+ .expectBody()
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
index 661e28def..ee4c0a544 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
@@ -31,9 +31,11 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
"org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
index 714cf3a46..54f8dbc9d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -71,6 +71,7 @@ open class BluePrintManagementGRPCHandler(
try {
/** Get the file byte array */
val byteArray = request.fileChunk.chunk.toByteArray()
+
/** Get the Upload Action */
val uploadAction = request.actionIdentifiers?.actionName.emptyTONull()
?: UploadAction.DRAFT.toString()
@@ -169,7 +170,7 @@ open class BluePrintManagementGRPCHandler(
override fun removeBlueprint(
request: BluePrintRemoveInput,
responseObserver:
- StreamObserver<BluePrintManagementOutput>
+ StreamObserver<BluePrintManagementOutput>
) {
runBlocking {
@@ -282,38 +283,38 @@ open class BluePrintManagementGRPCHandler(
private fun onError(header: CommonHeader, message: String, error: Exception): BluePrintManagementOutput {
val code = GrpcErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE)
return BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setStatus(
- Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_FAILURE)
- .setEventType(EventType.EVENT_COMPONENT_FAILURE)
- .setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
- .setCode(code)
- .build()
- )
- .build()
+ .setCommonHeader(header)
+ .setStatus(
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
+ .setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
+ .setCode(code)
+ .build()
+ )
+ .build()
}
private fun onErrorCatalog(header: CommonHeader, message: String, error: BluePrintProcessorException):
- BluePrintManagementOutput {
- val err = if (error.protocol == "") {
- error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
- } else {
- error.convertToGrpc()
- }
- val errorPayload = errorCatalogService.errorPayload(err.addErrorPayloadMessage(message))
- return BluePrintManagementOutput.newBuilder()
+ BluePrintManagementOutput {
+ val err = if (error.protocol == "") {
+ error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
+ } else {
+ error.convertToGrpc()
+ }
+ val errorPayload = errorCatalogService.errorPayload(err.addErrorPayloadMessage(message))
+ return BluePrintManagementOutput.newBuilder()
.setCommonHeader(header)
.setStatus(
- Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_FAILURE)
- .setEventType(EventType.EVENT_COMPONENT_FAILURE)
- .setErrorMessage("Error : ${errorPayload.message}")
- .setCode(errorPayload.code)
- .build()
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
+ .setErrorMessage("Error : ${errorPayload.message}")
+ .setCode(errorPayload.code)
+ .build()
)
.build()
- }
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index bb7a4b15c..0de298c62 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -92,8 +92,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
@RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit,
- Sort.Direction.fromString(sortType), sort.columnName)
+ val pageRequest = PageRequest.of(
+ offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName
+ )
return this.bluePrintModelHandler.allBlueprintModel(pageRequest)
}
@@ -115,8 +117,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
@RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit,
- Sort.Direction.fromString(sortType), sort.columnName)
+ val pageRequest = PageRequest.of(
+ offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName
+ )
return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord, pageRequest)
}
@@ -172,8 +176,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- "/enrich", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE]
+ "/enrich", produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [
+ MediaType
+ .MULTIPART_FORM_DATA_VALUE
+ ]
)
@ResponseBody
@Throws(BluePrintException::class)
@@ -183,8 +190,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- "/enrichandpublish", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE]
+ "/enrichandpublish", produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [
+ MediaType
+ .MULTIPART_FORM_DATA_VALUE
+ ]
)
@ResponseBody
@Throws(BluePrintException::class)
@@ -226,7 +236,8 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- path = arrayOf("/workflow-spec"), produces = arrayOf(
+ path = arrayOf("/workflow-spec"),
+ produces = arrayOf(
MediaType
.APPLICATION_JSON_VALUE
),
@@ -237,10 +248,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@PreAuthorize("hasRole('USER')")
suspend fun workflowSpec(@RequestBody workFlowSpecReq: WorkFlowSpecRequest):
ResponseEntity<String> = mdcWebCoroutineScope {
- var json = bluePrintModelHandler.prepareWorkFlowSpec(workFlowSpecReq)
- .asJsonString()
- ResponseEntity(json, HttpStatus.OK)
- }
+ var json = bluePrintModelHandler.prepareWorkFlowSpec(workFlowSpecReq)
+ .asJsonString()
+ ResponseEntity(json, HttpStatus.OK)
+ }
@GetMapping(
path = arrayOf(
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
index 1d61c7f0c..1d32b9493 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
@@ -26,18 +26,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
class BootstrapRequest {
+
var loadModelType: Boolean = false
var loadResourceDictionary: Boolean = false
var loadCBA: Boolean = false
}
class WorkFlowsResponse {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
var workflows: MutableSet<String> = mutableSetOf()
}
class WorkFlowSpecRequest {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
var returnContent: String = DATA_TYPE_JSON
@@ -46,6 +49,7 @@ class WorkFlowSpecRequest {
}
class WorkFlowSpecResponse {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
lateinit var workFlowData: WorkFlowData
@@ -53,6 +57,7 @@ class WorkFlowSpecResponse {
}
class WorkFlowData {
+
lateinit var workFlowName: String
var inputs: MutableMap<String, PropertyDefinition>? = null
var outputs: MutableMap<String, PropertyDefinition>? = null
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
index a083d7a8b..ffb383e6c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
@@ -28,4 +28,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
@RestControllerAdvice("org.onap.ccsdk.cds.blueprintsprocessor.designer.api")
open class DesignerBlueprintExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
index ae91246fe..ef1c3b103 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
object DesignerApiDomains {
+
// Designer Api Domains Constants
const val DESIGNER_API = "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
const val DESIGNER_API_ENHANCER = "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer"
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
index 6e277e5c8..b00e5a0a6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
@@ -89,17 +89,18 @@ class ModelType : Serializable {
override fun toString(): String {
return "[" + "modelName = " + modelName +
- ", derivedFrom = " + derivedFrom +
- ", definitionType = " + definitionType +
- ", description = " + description +
- ", creationDate = " + creationDate +
- ", version = " + version +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- "]"
+ ", derivedFrom = " + derivedFrom +
+ ", definitionType = " + definitionType +
+ ", description = " + description +
+ ", creationDate = " + creationDate +
+ ", version = " + version +
+ ", updatedBy = " + updatedBy +
+ ", tags = " + tags +
+ "]"
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
index e91d9e136..eaa63ddee 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
@@ -88,18 +88,19 @@ class ResourceDictionary : Serializable {
override fun toString(): String {
return "[" + ", name = " + name +
- ", dataType = " + dataType +
- ", entrySchema = " + entrySchema +
- ", resourceDictionaryGroup = " + resourceDictionaryGroup +
- ", definition =" + definition +
- ", description = " + description +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- ", creationDate = " + creationDate +
- "]"
+ ", dataType = " + dataType +
+ ", entrySchema = " + entrySchema +
+ ", resourceDictionaryGroup = " + resourceDictionaryGroup +
+ ", definition =" + definition +
+ ", description = " + description +
+ ", updatedBy = " + updatedBy +
+ ", tags = " + tags +
+ ", creationDate = " + creationDate +
+ "]"
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
index f954df7ac..c63c7260d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
@@ -40,6 +40,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(
BluePrintArtifactDefinitionEnhancer {
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
}
@@ -79,7 +80,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(
if (!alreadyEnhanced) {
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(artifactFilePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
+ as? MutableList<ResourceAssignment>
?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($artifactFilePath)")
// Call Resource Assignment Enhancer
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
index 1d534bb73..c163cc0d4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
@@ -20,12 +20,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
@@ -83,15 +83,21 @@ open class BluePrintEnhancerServiceImpl(
}
} catch (e: BluePrintProcessorException) {
val errorMsg = "Error while enriching the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong blueprint definitions or resource definitions.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong blueprint definitions or resource definitions."
+ )
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "IO Error: CBA file failed enrichment - ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "IO Error: CBA file failed enrichment - ${e.message}", e.errorCauseOrDefault()
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Enriching CBA: ${e.message}", e.errorCauseOrDefault())
- }
- return blueprintRuntimeService.bluePrintContext()
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Enriching CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
+ return blueprintRuntimeService.bluePrintContext()
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
index d28084e40..bb178b1e6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
@@ -101,7 +101,7 @@ open class BluePrintNodeTypeEnhancerImpl(
val relationShipTypeName = requirementDefinition.relationship
?: throw BluePrintException(
"couldn't get relationship name for the NodeType($nodeTypeName) " +
- "Requirement($requirementName)"
+ "Requirement($requirementName)"
)
enrichRelationShipType(relationShipTypeName)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
index 88127e3ca..dd60acac1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
@@ -48,6 +48,7 @@ open class BluePrintWorkflowEnhancerImpl(
private val log = logger(BluePrintWorkflowEnhancerImpl::class)
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
const val PROPERTY_DEPENDENCY_NODE_TEMPLATES = "dependency-node-templates"
}
@@ -109,7 +110,7 @@ open class BluePrintWorkflowEnhancerImpl(
else -> {
throw BluePrintProcessorException(
"couldn't execute workflow($name) step mapped " +
- "to node template($firstNodeTemplateName) derived from($derivedFrom)"
+ "to node template($firstNodeTemplateName) derived from($derivedFrom)"
)
}
}
@@ -139,11 +140,11 @@ open class BluePrintWorkflowEnhancerImpl(
val resourceAssignmentArtifacts = bluePrintContext.nodeTemplateByName(componentNodeTemplateName)
.artifacts?.filter {
- it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
- }?.map {
- log.info("resource assignment artifacts(${it.key}) for NodeType($componentNodeTemplateName)")
- it.value.file
- }
+ it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
+ }?.map {
+ log.info("resource assignment artifacts(${it.key}) for NodeType($componentNodeTemplateName)")
+ it.value.file
+ }
resourceAssignmentArtifacts
}?.flatten()
@@ -173,7 +174,7 @@ open class BluePrintWorkflowEnhancerImpl(
val resourceAssignmentProperties: MutableMap<String, PropertyDefinition> = hashMapOf()
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
+ as? MutableList<ResourceAssignment>
?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
val alreadyEnhancedKey = "enhanced-$fileName"
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
index 94e183405..621b046e6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
@@ -105,9 +105,13 @@ open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionR
}
private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {
- return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT) ||
- resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT)) &&
- BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))
+ return !(
+ (
+ resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT) ||
+ resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT)
+ ) &&
+ BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!)
+ )
}
private fun getResourceDefinition(name: String): ResourceDefinition {
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
index 042c76805..bbec8e685 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
@@ -48,6 +48,7 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
private val log = logger(ResourceDefinitionEnhancerService::class)
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
}
@@ -112,15 +113,15 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
// Read the Resource Definitions from the Database and write to type file.
private fun generateResourceDictionary(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>):
- List<ResourceDefinition> {
- val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
- log.info("distinct resource keys ($resourceKeys)")
+ List<ResourceDefinition> {
+ val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
+ log.info("distinct resource keys ($resourceKeys)")
- // TODO("Optimise DB single Query to multiple Query")
- return resourceKeys.map { resourceKey ->
- getResourceDefinition(resourceKey)
+ // TODO("Optimise DB single Query to multiple Query")
+ return resourceKeys.map { resourceKey ->
+ getResourceDefinition(resourceKey)
+ }
}
- }
private fun enrichResourceDefinitionSources(
bluePrintContext: BluePrintContext,
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index 3140abfb3..7bbaa8c59 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -24,29 +24,29 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSe
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelContentRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelSearchRepository
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BootstrapRequest
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowData
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowSpecRequest
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowSpecResponse
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowData
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowsResponse
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.BluePrintDatabaseLoadService
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
+import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -92,8 +92,8 @@ open class BluePrintModelHandler(
open suspend fun bootstrapBlueprint(bootstrapRequest: BootstrapRequest) {
log.info(
"Bootstrap request with type load(${bootstrapRequest.loadModelType}), " +
- "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
- "cba load(${bootstrapRequest.loadCBA})"
+ "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
+ "cba load(${bootstrapRequest.loadCBA})"
)
if (bootstrapRequest.loadModelType) {
bluePrintDatabaseLoadService.initModelTypes()
@@ -108,38 +108,41 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open suspend fun prepareWorkFlowSpec(req: WorkFlowSpecRequest):
- WorkFlowSpecResponse {
- val basePath = blueprintsProcessorCatalogService.getFromDatabase(req
- .blueprintName, req.version)
- log.info("blueprint base path $basePath")
-
- val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(basePath.toString())
- val workFlow = blueprintContext.workflowByName(req.workflowName)
-
- val wfRes = WorkFlowSpecResponse()
- wfRes.blueprintName = req.blueprintName
- wfRes.version = req.version
-
- val workFlowData = WorkFlowData()
- workFlowData.workFlowName = req.workflowName
- workFlowData.inputs = workFlow.inputs
- workFlowData.outputs = workFlow.outputs
- wfRes.workFlowData = workFlowData
-
- if (workFlow.inputs != null) {
- for ((k, v) in workFlow.inputs!!) {
- addPropertyInfo(k, v, blueprintContext, wfRes)
+ WorkFlowSpecResponse {
+ val basePath = blueprintsProcessorCatalogService.getFromDatabase(
+ req
+ .blueprintName,
+ req.version
+ )
+ log.info("blueprint base path $basePath")
+
+ val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(basePath.toString())
+ val workFlow = blueprintContext.workflowByName(req.workflowName)
+
+ val wfRes = WorkFlowSpecResponse()
+ wfRes.blueprintName = req.blueprintName
+ wfRes.version = req.version
+
+ val workFlowData = WorkFlowData()
+ workFlowData.workFlowName = req.workflowName
+ workFlowData.inputs = workFlow.inputs
+ workFlowData.outputs = workFlow.outputs
+ wfRes.workFlowData = workFlowData
+
+ if (workFlow.inputs != null) {
+ for ((k, v) in workFlow.inputs!!) {
+ addPropertyInfo(k, v, blueprintContext, wfRes)
+ }
}
- }
- if (workFlow.outputs != null) {
- for ((k, v) in workFlow.outputs!!) {
- addPropertyInfo(k, v, blueprintContext, wfRes)
+ if (workFlow.outputs != null) {
+ for ((k, v) in workFlow.outputs!!) {
+ addPropertyInfo(k, v, blueprintContext, wfRes)
+ }
}
- }
- return wfRes
- }
+ return wfRes
+ }
private fun addPropertyInfo(propName: String, prop: PropertyDefinition, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
updatePropertyInfo(propName, prop, ctx, res)
@@ -172,6 +175,7 @@ open class BluePrintModelHandler(
}
}
}
+
private fun addDataType(name: String, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
var data = ctx.dataTypeByName(name)
if (data != null) {
@@ -191,7 +195,8 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open suspend fun getWorkflowNames(name: String, version: String): WorkFlowsResponse {
val basePath = blueprintsProcessorCatalogService.getFromDatabase(
- name, version)
+ name, version
+ )
log.info("blueprint base path $basePath")
var res = WorkFlowsResponse()
@@ -199,7 +204,8 @@ open class BluePrintModelHandler(
res.version = version
val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(
- basePath.toString())
+ basePath.toString()
+ )
if (blueprintContext.workflows() != null) {
res.workflows = blueprintContext.workflows()!!.keys
}
@@ -210,7 +216,7 @@ open class BluePrintModelHandler(
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
*
* @return List<BlueprintModelSearch> list of the controller blueprint archives
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun allBlueprintModel(): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findAll()
}
@@ -219,7 +225,7 @@ open class BluePrintModelHandler(
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
*
* @return List<BlueprintModelSearch> list of the controller blueprint archives
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun allBlueprintModel(pageRequest: Pageable): Page<BlueprintModelSearch> {
return blueprintModelSearchRepository.findAll(pageRequest)
}
@@ -230,14 +236,16 @@ open class BluePrintModelHandler(
* @param filePart filePart
* @return Mono<BlueprintModelSearch>
* @throws BluePrintException BluePrintException
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
@Throws(BluePrintException::class)
open suspend fun saveBlueprintModel(filePart: FilePart): BlueprintModelSearch {
try {
return upload(filePart, false)
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Save CBA: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Save CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -246,7 +254,7 @@ open class BluePrintModelHandler(
*
* @param tags tags
* @return List<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBlueprintModels(tags: String): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags)
}
@@ -262,10 +270,10 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch? {
return blueprintModelSearchRepository.findByArtifactNameAndArtifactVersion(name, version)
- /*?: throw BluePrintException(
- ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
- )*/
+ /*?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
+ )*/
}
/**
@@ -275,7 +283,7 @@ open class BluePrintModelHandler(
* @param version version
* @return ResponseEntity<Resource>
* @throws BluePrintException BluePrintException
- </Resource> */
+ </Resource> */
@Throws(BluePrintException::class)
open fun downloadBlueprintModelFileByNameAndVersion(
name: String,
@@ -288,8 +296,10 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.RESOURCE_NOT_FOUND)
val errorMsg = "Error while downloading the CBA file by Blueprint Name ($name) and Version ($version)."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong resource definition or resolution failed.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong resource definition or resolution failed."
+ )
}
}
@@ -298,28 +308,32 @@ open class BluePrintModelHandler(
*
* @return ResponseEntity<Resource>
* @throws BluePrintException BluePrintException
- </Resource> */
+ </Resource> */
@Throws(BluePrintException::class)
open fun downloadBlueprintModelFile(id: String): ResponseEntity<Resource> {
val blueprintModel: BlueprintModel
try {
blueprintModel = getBlueprintModel(id)
} catch (e: BluePrintException) {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get blueprint modelby ID ($id)",
- e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get blueprint modelby ID ($id)",
+ e.errorCauseOrDefault()
+ )
}
val fileName = "${blueprintModel.artifactName}_${blueprintModel.artifactVersion}.zip"
val file = blueprintModel.blueprintModelContent?.content
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get model content")
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get model content"
+ )
return prepareResourceEntity(fileName, file)
}
/**
* @return ResponseEntity<Resource>
- </Resource> */
+ </Resource> */
private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("text/plain"))
@@ -377,8 +391,10 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
return blueprintModelSearchRepository.findById(id)
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id))
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ )
}
/**
@@ -388,7 +404,7 @@ open class BluePrintModelHandler(
* @param keyWord
*
* @return List<BlueprintModelSearch> list of the controller blueprint
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWord(keyWord: String): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
keyWord, keyWord, keyWord, keyWord, keyWord
@@ -402,7 +418,7 @@ open class BluePrintModelHandler(
* @param keyWord
*
* @return List<BlueprintModelSearch> list of the controller blueprint
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWordPaged(keyWord: String, pageRequest: PageRequest): Page<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByUpdatedByContainingIgnoreCaseOrTagsContainingIgnoreCaseOrArtifactNameContainingIgnoreCaseOrArtifactVersionContainingIgnoreCaseOrArtifactTypeContainingIgnoreCase(
keyWord,
@@ -457,11 +473,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error while enhancing the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA file provided, please verify and enrich Again.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA file provided, please verify and enrich Again."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -480,11 +500,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error in Publishing CBA."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA provided, please verify and enrich your CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA provided, please verify and enrich your CBA."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Publishing CBA: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Publishing CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -505,11 +529,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error while enhancing and uploading the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA file provided, please verify the source CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA file provided, please verify the source CBA."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -529,16 +557,22 @@ open class BluePrintModelHandler(
val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, validate)
return blueprintModelSearchRepository.findById(blueprintId)
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId))
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId)
+ )
} catch (e: BluePrintException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error in Upload CBA."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong enriched CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong enriched CBA."
+ )
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Upload CBA: ${e.errorMessageOrDefault()}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Upload CBA: ${e.errorMessageOrDefault()}", e.errorCauseOrDefault()
+ )
} finally {
// Clean blueprint script cache
val cacheKey = BluePrintFileUtils
@@ -555,13 +589,17 @@ open class BluePrintModelHandler(
try {
val blueprintModel = getBlueprintModelByNameAndVersion(name, version)
return blueprintModel.blueprintModelContent?.content
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get model content")
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get model content"
+ )
} catch (e: BluePrintException) {
e.http(ErrorCatalogCodes.RESOURCE_NOT_FOUND)
val errorMsg = "Fail to get Blueprint Model content."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong name and version was provide.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong name and version was provide."
+ )
}
}
@@ -573,10 +611,12 @@ open class BluePrintModelHandler(
val blueprintWorkingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, enhanceId)
try {
when (fileSource) {
- is FilePart -> BluePrintEnhancerUtils
- .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
- is ByteArray -> BluePrintEnhancerUtils
- .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ is FilePart ->
+ BluePrintEnhancerUtils
+ .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ is ByteArray ->
+ BluePrintEnhancerUtils
+ .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
} // Enhance the Blue Prints
bluePrintEnhancerService.enhance(blueprintWorkingDir)
@@ -586,8 +626,10 @@ open class BluePrintModelHandler(
val errorMsg = "Fail Enriching the CBA."
throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg)
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error while Enriching the CBA file.", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error while Enriching the CBA file.", e.errorCauseOrDefault()
+ )
} finally {
BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintWorkingDir)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
index d11c128f0..0d94aab27 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
@@ -45,8 +45,10 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
return if (modelType != null) {
modelType
} else {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "couldn't get modelType($modelTypeName)")
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "couldn't get modelType($modelTypeName)"
+ )
}
}
@@ -55,7 +57,7 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
*
* @param tags tags
* @return List<ModelType>
- </ModelType> */
+ </ModelType> */
suspend fun searchModelTypes(tags: String): List<ModelType> {
check(tags.isNotBlank()) { "No Search Information provide" }
return modelTypeRepository.findByTagsContainingIgnoreCase(tags)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
index 20895efce..3f06a4a98 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
@@ -49,8 +49,10 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
return if (resourceDictionaryDb != null) {
resourceDictionaryDb
} else {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format("couldn't get resource dictionary for name (%s)", name))
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format("couldn't get resource dictionary for name (%s)", name)
+ )
}
}
@@ -59,7 +61,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
*
* @param names names
* @return List<ResourceDictionary>
- </ResourceDictionary> */
+ </ResourceDictionary> */
suspend fun searchResourceDictionaryByNames(names: List<String>): List<ResourceDictionary> {
Preconditions.checkArgument(CollectionUtils.isNotEmpty(names), "No Search Information provide")
return resourceDictionaryRepository.findByNameIn(names)
@@ -70,7 +72,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
*
* @param tags tags
* @return List<ResourceDictionary>
- </ResourceDictionary> */
+ </ResourceDictionary> */
suspend fun searchResourceDictionaryByTags(tags: String): List<ResourceDictionary> {
Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No search tag information provide")
return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags)
@@ -139,8 +141,10 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
resourceDictionary.resourceDictionaryGroup = resourceDefinition.group
resourceDictionary.entrySchema = resourceDefinition.property.entrySchema?.type
if (StringUtils.isBlank(resourceDefinition.tags)) {
- resourceDictionary.tags = (resourceDefinition.name + ", " + resourceDefinition.updatedBy +
- ", " + resourceDefinition.updatedBy)
+ resourceDictionary.tags = (
+ resourceDefinition.name + ", " + resourceDefinition.updatedBy +
+ ", " + resourceDefinition.updatedBy
+ )
} else {
resourceDictionary.tags = resourceDefinition.tags!!
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
index fea01992b..703542f60 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
@@ -35,7 +35,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param name name
* @return Optional<ResourceMapping>
- </ResourceMapping> */
+ </ResourceMapping> */
fun findByName(name: String): ResourceDictionary?
/**
@@ -43,7 +43,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param names names
* @return Optional<ResourceMapping>
- </ResourceMapping> */
+ </ResourceMapping> */
fun findByNameIn(names: List<String>): List<ResourceDictionary>
/**
@@ -51,7 +51,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param tags tags
* @return Optional<ModelType>
- </ModelType> */
+ </ModelType> */
fun findByTagsContainingIgnoreCase(tags: String): List<ResourceDictionary>
/**
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
index edf4c8cf6..db2e06eb5 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
@@ -49,6 +49,7 @@ class ApplicationRegistrationService {
}
companion object {
+
private val log = LoggerFactory.getLogger(ApplicationRegistrationService::class.java)
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
index 4affd3b3f..6d72c2741 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
@@ -44,6 +44,7 @@ import java.nio.file.Paths
class BluePrintEnhancerUtils {
companion object {
+
val log = logger(BluePrintEnhancerUtils)
fun populateDataTypes(
@@ -164,10 +165,10 @@ class BluePrintEnhancerUtils {
outputFileName: String = "enhanced-cba.zip"
):
ResponseEntity<Resource> {
- val compressedFile = normalizedFile(archiveDir, outputFileName)
- BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
- return prepareResourceEntity(compressedFile)
- }
+ val compressedFile = normalizedFile(archiveDir, outputFileName)
+ BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
+ return prepareResourceEntity(compressedFile)
+ }
/** convert [file] to ResourceEntity */
suspend fun prepareResourceEntity(file: File): ResponseEntity<Resource> {
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
index 6b9ea28f0..08de136d8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
@@ -30,6 +30,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
class ModelTypeValidator {
companion object {
+
/**
* This is a validateModelTypeDefinition
*
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
index 9489f2882..a42ac05e7 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -72,6 +72,7 @@ class BlueprintModelControllerTest {
private val log = logger(BlueprintModelControllerTest::class)
companion object {
+
private var bp: BlueprintModelSearch? = null
}
@@ -115,11 +116,14 @@ class BlueprintModelControllerTest {
fun test01_saveBluePrint() {
bp = runBlocking {
val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
- override fun getFilename(): String {
- return "test.zip"
+ part(
+ "file",
+ object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
}
- })
+ )
}.build()
val saveBP = webTestClient
@@ -184,11 +188,14 @@ class BlueprintModelControllerTest {
fun test07_publishBlueprintModel() {
bp = runBlocking {
val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
- override fun getFilename(): String {
- return "test.zip"
+ part(
+ "file",
+ object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
}
- })
+ )
}.build()
val publishBP = webTestClient
@@ -239,7 +246,8 @@ class BlueprintModelControllerTest {
webTestClient.delete().uri("/api/v1/blueprint-model/name/${bp!!.artifactName}/version/${bp!!.artifactVersion}")
.header(
- "Authorization", "Basic " + Base64Utils
+ "Authorization",
+ "Basic " + Base64Utils
.encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
)
.exchange()
@@ -259,7 +267,8 @@ class BlueprintModelControllerTest {
webTestClient.method(requestMethod).uri(uri)
.header(
- "Authorization", "Basic " + Base64Utils
+ "Authorization",
+ "Basic " + Base64Utils
.encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
)
.body(body)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
index 33a2bd778..5b4463d36 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
@@ -22,9 +22,11 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ basePackages = [
+ "org.onap.ccsdk.cds.controllerblueprints",
"org.onap.ccsdk.cds.blueprintsprocessor.designer.api",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"]
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ]
)
@EnableAutoConfiguration
open class DesignerApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
index d081dc5ab..9520f0e8c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
index c5bcd467b..8226aaad0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
@@ -62,8 +62,10 @@ class ModelTypeControllerTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeController.saveModelType(modelType)
log.info("Saved Mode {}", modelType.toString())
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
index be012bbc0..6808a2717 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
- "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
index c4a77e565..8ee2eb3a2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
@@ -63,8 +63,10 @@ class ModelTypeServiceTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeHandler!!.saveModel(modelType)
log.info("Saved Mode {}", modelType.toString())
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
index db25b6c35..7b752266d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
@@ -39,10 +39,10 @@ class ResourceDictionaryHandlerTest {
@Test
fun testSaveResourceDictionary() {
val resourceDefinition: ResourceDefinition = JacksonUtils
- .readValueFromFile(
- "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
- ResourceDefinition::class.java
- )!!
+ .readValueFromFile(
+ "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
+ ResourceDefinition::class.java
+ )!!
val expectedResourceDictionary = ResourceDictionary()
expectedResourceDictionary.name = resourceDefinition.name
@@ -57,7 +57,7 @@ class ResourceDictionaryHandlerTest {
val mockReturnValue = ResourceDictionary()
mockReturnValue.definition = ResourceDefinition()
Mockito.`when`(mockRepository.save(any(ResourceDictionary::class.java)))
- .thenReturn(mockReturnValue)
+ .thenReturn(mockReturnValue)
runBlocking {
resourceDictionaryHandler.saveResourceDefinition(resourceDefinition)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
index 27949901c..a7d166f5e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
@@ -28,6 +28,7 @@ import java.io.File
import java.nio.file.Path
class MockFilePart(private val fileName: String) : FilePart {
+
val log = LoggerFactory.getLogger(MockFilePart::class.java)!!
override fun content(): Flux<DataBuffer> {
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
index 4c05f6009..ca85ed22f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
@@ -65,8 +65,10 @@ class ModelTypeReactRepositoryTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
val dbModelType = modelTypeReactRepository!!.save(modelType).block()
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorHandling.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorHandling.kt
index b37cd0eda..76e0346f4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.resource.api
object ResourceApiDomains {
+
// Resource Api Domains Constants
const val RESOURCE_API = "org.onap.ccsdk.cds.blueprintsprocessor.resource.api"
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
index 1aae8aa1c..e7c11e306 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
@@ -61,7 +61,7 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
@ApiOperation(
value = "Get all resolved resources using the resolution key. ",
notes = "Retrieve all stored resolved resources using the blueprint name, blueprint version, " +
- "artifact name and the resolution-key.",
+ "artifact name and the resolution-key.",
response = ResourceResolution::class,
responseContainer = "List",
produces = MediaType.APPLICATION_JSON_VALUE
@@ -82,37 +82,43 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
@ApiParam(value = "Resource Id associated with the resolution.", required = false)
@RequestParam(value = "resourceId", required = false, defaultValue = "") resourceId: String
):
- ResponseEntity<List<ResourceResolution>> = runBlocking {
+ ResponseEntity<List<ResourceResolution>> = runBlocking {
- if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
- throw httpProcessorException(ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
- "Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.")
- } else if (resolutionKey.isNotEmpty() && artifactName.isNotEmpty()) {
- ResponseEntity.ok()
- .body(resourceResolutionDBService.readWithResolutionKey(bpName, bpVersion, artifactName, resolutionKey))
- } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
- ResponseEntity.ok()
- .body(
- resourceResolutionDBService.readWithResourceIdAndResourceType(
- bpName,
- bpVersion,
- resourceId,
- resourceType
+ if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
+ throw httpProcessorException(
+ ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
+ "Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type."
+ )
+ } else if (resolutionKey.isNotEmpty() && artifactName.isNotEmpty()) {
+ ResponseEntity.ok()
+ .body(resourceResolutionDBService.readWithResolutionKey(bpName, bpVersion, artifactName, resolutionKey))
+ } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
+ ResponseEntity.ok()
+ .body(
+ resourceResolutionDBService.readWithResourceIdAndResourceType(
+ bpName,
+ bpVersion,
+ resourceId,
+ resourceType
+ )
)
+ } else {
+ throw httpProcessorException(
+ ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
+ "Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type."
)
- } else {
- throw httpProcessorException(ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
- "Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.")
+ }
}
- }
@RequestMapping(
- path = [""],
- method = [RequestMethod.DELETE], produces = [MediaType.APPLICATION_JSON_VALUE]
+ path = [""],
+ method = [RequestMethod.DELETE], produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
+ @ApiOperation(
+ value = "Delete resources using resolution key",
+ notes = "Delete all the resources associated to a resolution-key using blueprint metadata, artifact name and the resolution-key.",
+ produces = MediaType.APPLICATION_JSON_VALUE
)
- @ApiOperation(value = "Delete resources using resolution key",
- notes = "Delete all the resources associated to a resolution-key using blueprint metadata, artifact name and the resolution-key.",
- produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('USER')")
fun deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
@ApiParam(value = "Name of the CBA.", required = true)
@@ -125,7 +131,14 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
@RequestParam(value = "resolutionKey", required = true) resolutionKey: String
) = runBlocking {
ResponseEntity.ok()
- .body(resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(bpName, bpVersion, artifactName, resolutionKey))
+ .body(
+ resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
+ bpName,
+ bpVersion,
+ artifactName,
+ resolutionKey
+ )
+ )
}
@RequestMapping(
@@ -152,9 +165,9 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
@ApiParam(value = "Name of the resource to retrieve.", required = true)
@RequestParam(value = "name", required = true) name: String
):
- ResponseEntity<ResourceResolution> = runBlocking {
+ ResponseEntity<ResourceResolution> = runBlocking {
- ResponseEntity.ok()
- .body(resourceResolutionDBService.readValue(bpName, bpVersion, artifactName, resolutionKey, name))
- }
+ ResponseEntity.ok()
+ .body(resourceResolutionDBService.readValue(bpName, bpVersion, artifactName, resolutionKey, name))
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
index 9c09bd819..baaa858d1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
@@ -27,4 +27,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
*/
@RestControllerAdvice("org.onap.ccsdk.cds.blueprintsprocessor.resource.api")
open class ResourceExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
index bd52bfee6..b56a63b17 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
@@ -71,8 +71,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiOperation(
value = "Retrieve a resolved template.",
notes = "Retrieve a config template for a given CBA's action, identified by its blueprint name, blueprint version, " +
- "artifact name and resolution key. An extra 'format' parameter can be passed to tell what content-type" +
- " to expect in return"
+ "artifact name and resolution key. An extra 'format' parameter can be passed to tell what content-type" +
+ " to expect in return"
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
@@ -98,50 +98,54 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiParam(value = "Occurrence of the template resolution (1-n).", required = false)
@RequestParam(value = "occurrence", required = false, defaultValue = "1") occurrence: Int = 1
):
- ResponseEntity<String> = runBlocking {
+ ResponseEntity<String> = runBlocking {
- var result = ""
+ var result = ""
- if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
- throw httpProcessorException(ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
- "Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type.")
- } else if (resolutionKey.isNotEmpty() && artifactName.isNotEmpty()) {
- result = templateResolutionService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- bpName,
- bpVersion,
- artifactName,
- resolutionKey,
- occurrence
- )
- } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
- result =
- templateResolutionService.findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
+ throw httpProcessorException(
+ ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
+ "Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type."
+ )
+ } else if (resolutionKey.isNotEmpty() && artifactName.isNotEmpty()) {
+ result = templateResolutionService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
bpName,
bpVersion,
artifactName,
- resourceId,
- resourceType,
+ resolutionKey,
occurrence
)
- } else {
- throw httpProcessorException(ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
- "Missing param. Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type.")
- }
+ } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
+ result =
+ templateResolutionService.findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ bpName,
+ bpVersion,
+ artifactName,
+ resourceId,
+ resourceType,
+ occurrence
+ )
+ } else {
+ throw httpProcessorException(
+ ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
+ "Missing param. Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type."
+ )
+ }
- var expectedContentType = format
- if (expectedContentType.indexOf('/') < 0) {
- expectedContentType = "application/$expectedContentType"
- }
- val expectedMediaType: MediaType = MediaType.valueOf(expectedContentType)
+ var expectedContentType = format
+ if (expectedContentType.indexOf('/') < 0) {
+ expectedContentType = "application/$expectedContentType"
+ }
+ val expectedMediaType: MediaType = MediaType.valueOf(expectedContentType)
- ResponseEntity.ok().contentType(expectedMediaType).body(result)
- }
+ ResponseEntity.ok().contentType(expectedMediaType).body(result)
+ }
@PostMapping("/{bpName}/{bpVersion}/{artifactName}/{resolutionKey}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ApiOperation(
value = "Store a resolved template w/ resolution-key",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
- "artifact name and resolution key.",
+ "artifact name and resolution key.",
response = TemplateResolution::class,
produces = MediaType.APPLICATION_JSON_VALUE
)
@@ -173,7 +177,7 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiOperation(
value = "Store a resolved template w/ resourceId and resourceType",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
- "artifact name, resourceId and resourceType.",
+ "artifact name, resourceId and resourceType.",
response = TemplateResolution::class,
produces = MediaType.APPLICATION_JSON_VALUE
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorCatalogTestConfiguration.kt
index 5b0d1980b..8a52884ac 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
index c5e002f08..40d6f56cb 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
@@ -40,13 +40,17 @@ import org.springframework.test.web.reactive.server.WebTestClient
@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(
- classes = [TestDatabaseConfiguration::class, ErrorCatalogTestConfiguration::class,
- ResourceController::class, ResourceResolutionDBService::class]
+ classes = [
+ TestDatabaseConfiguration::class, ErrorCatalogTestConfiguration::class,
+ ResourceController::class, ResourceResolutionDBService::class
+ ]
)
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.controllerblueprints.core.service",
+ basePackages = [
+ "org.onap.ccsdk.cds.controllerblueprints.core.service",
"org.onap.ccsdk.cds.blueprintsprocessor.resource.api",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"]
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ResourceControllerTest {
@@ -55,6 +59,7 @@ class ResourceControllerTest {
@Autowired
lateinit var resourceResolutionDBService: ResourceResolutionDBService
+
@Autowired
lateinit var webTestClient: WebTestClient
@@ -150,9 +155,9 @@ class ResourceControllerTest {
.consumeWith {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorPayload::class.java)
Assert.assertEquals(
- "Cause: Missing param. Either retrieve resolved value using artifact name and " +
- "resolution-key OR using resource-id and resource-type. \n" +
- " Action : Please verify your request.",
+ "Cause: Missing param. Either retrieve resolved value using artifact name and " +
+ "resolution-key OR using resource-id and resource-type. \n" +
+ " Action : Please verify your request.",
r.message
)
}
@@ -172,7 +177,7 @@ class ResourceControllerTest {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorPayload::class.java)
Assert.assertEquals(
"Cause: Either retrieve resolved value using artifact name and resolution-key OR using " +
- "resource-id and resource-type. \n Action : Please verify your request.",
+ "resource-id and resource-type. \n Action : Please verify your request.",
r.message
)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
index 098423540..945a30c64 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
@@ -37,8 +37,10 @@ import kotlin.test.AfterTest
@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(
- classes = [TestDatabaseConfiguration::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, ErrorCatalogTestConfiguration::class]
+ classes = [
+ TestDatabaseConfiguration::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, ErrorCatalogTestConfiguration::class
+ ]
)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
index 0ab3b5b21..6d87d2735 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
index 46d91e57c..79106c24a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
@@ -74,10 +74,10 @@ open class BluePrintProcessingGRPCHandler(
fun onError(error: Exception) {
responseObserver.onError(
- Status.INTERNAL
- .withDescription(error.errorMessageOrDefault())
- .withCause(error.errorCauseOrDefault())
- .asException()
+ Status.INTERNAL
+ .withDescription(error.errorMessageOrDefault())
+ .withCause(error.errorCauseOrDefault())
+ .asException()
)
}
@@ -88,10 +88,10 @@ open class BluePrintProcessingGRPCHandler(
val errorPayload = errorCatalogService.errorPayload(error)
val grpcCode = Status.fromCodeValue(errorPayload.code)
responseObserver.onError(
- grpcCode
- .withDescription(errorPayload.message)
- .withCause(error.errorCauseOrDefault())
- .asException()
+ grpcCode
+ .withDescription(errorPayload.message)
+ .withCause(error.errorCauseOrDefault())
+ .asException()
)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
index 1ccf230d7..c4de90755 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
@@ -53,6 +53,7 @@ open class BluePrintProcessingKafkaConsumer(
private lateinit var blueprintMessageConsumerService: BlueprintMessageConsumerService
companion object {
+
const val CONSUMER_SELECTOR = "self-service-api"
const val PRODUCER_SELECTOR = "self-service-api"
}
@@ -62,7 +63,7 @@ open class BluePrintProcessingKafkaConsumer(
try {
log.info(
"Setting up message consumer($CONSUMER_SELECTOR)" +
- "message producer($PRODUCER_SELECTOR)..."
+ "message producer($PRODUCER_SELECTOR)..."
)
/** Get the Message Consumer Service **/
@@ -71,8 +72,10 @@ open class BluePrintProcessingKafkaConsumer(
.blueprintMessageConsumerService(CONSUMER_SELECTOR)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed creating Kafka consumer message service."
- throw e.updateErrorMessage(SelfServiceApiDomains.SELF_SERVICE_API, errorMsg,
- "Wrong Kafka selector provided or internal error in Kafka service.")
+ throw e.updateErrorMessage(
+ SelfServiceApiDomains.SELF_SERVICE_API, errorMsg,
+ "Wrong Kafka selector provided or internal error in Kafka service."
+ )
} catch (e: Exception) {
throw BluePrintProcessorException("failed to create consumer service ${e.message}")
}
@@ -80,11 +83,13 @@ open class BluePrintProcessingKafkaConsumer(
/** Get the Message Producer Service **/
val blueprintMessageProducerService = try {
bluePrintMessageLibPropertyService
- .blueprintMessageProducerService(PRODUCER_SELECTOR)
+ .blueprintMessageProducerService(PRODUCER_SELECTOR)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed creating Kafka producer message service."
- throw e.updateErrorMessage(SelfServiceApiDomains.SELF_SERVICE_API, errorMsg,
- "Wrong Kafka selector provided or internal error in Kafka service.")
+ throw e.updateErrorMessage(
+ SelfServiceApiDomains.SELF_SERVICE_API, errorMsg,
+ "Wrong Kafka selector provided or internal error in Kafka service."
+ )
} catch (e: Exception) {
throw BluePrintProcessorException("failed to create producer service ${e.message}")
}
@@ -114,7 +119,8 @@ open class BluePrintProcessingKafkaConsumer(
} catch (e: Exception) {
log.error(
"failed to start message consumer($CONSUMER_SELECTOR) " +
- "message producer($PRODUCER_SELECTOR) ", e
+ "message producer($PRODUCER_SELECTOR) ",
+ e
)
}
}
@@ -124,7 +130,7 @@ open class BluePrintProcessingKafkaConsumer(
try {
log.info(
"Shutting down message consumer($CONSUMER_SELECTOR)" +
- "message producer($PRODUCER_SELECTOR)..."
+ "message producer($PRODUCER_SELECTOR)..."
)
blueprintMessageConsumerService.shutDown()
ph.arriveAndAwaitAdvance()
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorHandling.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorHandling.kt
index c4baa854c..94b107e9d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
object SelfServiceApiDomains {
+
// SelfServiceApi Domains Constants
const val BLUEPRINT_PROCESSOR = "org.onap.ccsdk.cds.blueprintsprocessor"
const val SELF_SERVICE_API = "org.onap.ccsdk.cds.blueprintsprocessor.resource.api"
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
index e5daecede..7628da214 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -83,9 +83,11 @@ open class ExecutionServiceController {
): ResponseEntity<ExecutionServiceOutput> = mdcWebCoroutineScope {
if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) {
- throw httpProcessorException(ErrorCatalogCodes.GENERIC_FAILURE,
- SelfServiceApiDomains.BLUEPRINT_PROCESSOR,
- "Can't process async request through the REST endpoint. Use gRPC for async processing.")
+ throw httpProcessorException(
+ ErrorCatalogCodes.GENERIC_FAILURE,
+ SelfServiceApiDomains.BLUEPRINT_PROCESSOR,
+ "Can't process async request through the REST endpoint. Use gRPC for async processing."
+ )
}
ph.register()
val processResult = executionServiceHandler.doProcess(executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceExceptionHandler.kt
index 57c02fe6a..0c0466f3c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceExceptionHandler.kt
@@ -29,4 +29,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
*/
@RestControllerAdvice("org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api")
class ExecutionServiceExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index 6c62aae88..4a7171ceb 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -44,7 +44,7 @@ class ExecutionServiceHandler(
private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
private val blueprintsProcessorCatalogService: BluePrintCatalogService,
private val bluePrintWorkflowExecutionService:
- BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>,
+ BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>,
private val publishAuditService: PublishAuditService
) {
@@ -71,13 +71,13 @@ class ExecutionServiceHandler(
else -> {
publishAuditService.publishExecutionInput(executionServiceInput)
val executionServiceOutput = response(
- executionServiceInput,
- "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
- true
+ executionServiceInput,
+ "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
+ true
)
publishAuditService.publishExecutionOutput(executionServiceInput.correlationUUID, executionServiceOutput)
responseObserver.onNext(
- executionServiceOutput.toProto()
+ executionServiceOutput.toProto()
)
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
index 145c37b01..bd1b9ad48 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
@@ -52,19 +52,21 @@ import javax.annotation.PostConstruct
* @property log Audit Service logger
*/
@ConditionalOnProperty(
- name = ["blueprintsprocessor.messageproducer.self-service-api.audit.kafkaEnable"],
- havingValue = "true"
+ name = ["blueprintsprocessor.messageproducer.self-service-api.audit.kafkaEnable"],
+ havingValue = "true"
)
@Service
class KafkaPublishAuditService(
private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService,
private val blueprintsProcessorCatalogService: BluePrintCatalogService
) : PublishAuditService {
+
private var inputInstance: BlueprintMessageProducerService? = null
private var outputInstance: BlueprintMessageProducerService? = null
private val log = LoggerFactory.getLogger(KafkaPublishAuditService::class.toString())
companion object {
+
const val INPUT_SELECTOR = "self-service-api.audit.request"
const val OUTPUT_SELECTOR = "self-service-api.audit.response"
}
@@ -88,8 +90,8 @@ class KafkaPublishAuditService(
this.inputInstance!!.sendMessage(key, secureExecutionServiceInput)
} catch (e: Exception) {
var errMsg =
- if (e.message != null) "ERROR : ${e.message}"
- else "ERROR : Failed to send execution request to Kafka."
+ if (e.message != null) "ERROR : ${e.message}"
+ else "ERROR : Failed to send execution request to Kafka."
log.error(errMsg)
}
}
@@ -109,8 +111,8 @@ class KafkaPublishAuditService(
this.outputInstance!!.sendMessage(key, executionServiceOutput)
} catch (e: Exception) {
var errMsg =
- if (e.message != null) "ERROR : $e"
- else "ERROR : Failed to send execution request to Kafka."
+ if (e.message != null) "ERROR : $e"
+ else "ERROR : Failed to send execution request to Kafka."
log.error(errMsg)
}
}
@@ -161,7 +163,8 @@ class KafkaPublishAuditService(
try {
if (clonedExecutionServiceInput.payload
- .path("$workflowName-request").has("$workflowName-properties")) {
+ .path("$workflowName-request").has("$workflowName-properties")
+ ) {
/** Retrieving sensitive input parameters */
val requestId = clonedExecutionServiceInput.commonHeader.requestId
@@ -181,23 +184,24 @@ class KafkaPublishAuditService(
/** We need to check in his Node Template Dependencies is case of a Node Template DG */
if (nodeTemplate.type == BluePrintConstants.NODE_TEMPLATE_TYPE_DG) {
- val dependencyNodeTemplate = nodeTemplate.properties?.get(BluePrintConstants.PROPERTY_DG_DEPENDENCY_NODE_TEMPLATE) as ArrayNode
+ val dependencyNodeTemplate =
+ nodeTemplate.properties?.get(BluePrintConstants.PROPERTY_DG_DEPENDENCY_NODE_TEMPLATE) as ArrayNode
dependencyNodeTemplate.forEach { dependencyNodeTemplateName ->
clonedExecutionServiceInput = hideSensitiveDataFromResourceResolution(
- blueprintRuntimeService,
- blueprintContext,
- clonedExecutionServiceInput,
- workflowName,
- dependencyNodeTemplateName.asText()
- )
- }
- } else {
- clonedExecutionServiceInput = hideSensitiveDataFromResourceResolution(
blueprintRuntimeService,
blueprintContext,
clonedExecutionServiceInput,
workflowName,
- nodeTemplateName
+ dependencyNodeTemplateName.asText()
+ )
+ }
+ } else {
+ clonedExecutionServiceInput = hideSensitiveDataFromResourceResolution(
+ blueprintRuntimeService,
+ blueprintContext,
+ clonedExecutionServiceInput,
+ workflowName,
+ nodeTemplateName
)
}
}
@@ -206,8 +210,9 @@ class KafkaPublishAuditService(
val errMsg = "ERROR : Couldn't hide sensitive data in the execution request."
log.error(errMsg, e)
clonedExecutionServiceInput.payload.replace(
- "$workflowName-request",
- "$errMsg $e".asJsonPrimitive())
+ "$workflowName-request",
+ "$errMsg $e".asJsonPrimitive()
+ )
}
return clonedExecutionServiceInput
}
@@ -236,8 +241,8 @@ class KafkaPublishAuditService(
val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName)
val propertyAssignments: MutableMap<String, JsonNode> =
- blueprintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
+ blueprintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ ?: hashMapOf()
/** Getting values define in artifact-prefix-names */
val input = executionServiceInput.payload.get("$workflowName-request")
@@ -245,25 +250,26 @@ class KafkaPublishAuditService(
val artifactPrefixNamesNode = propertyAssignments[ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES]
val propertyAssignmentService = PropertyAssignmentService(blueprintRuntimeService)
val artifactPrefixNamesNodeValue = propertyAssignmentService.resolveAssignmentExpression(
- BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
- nodeTemplateName,
- ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES,
- artifactPrefixNamesNode!!)
+ BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
+ nodeTemplateName,
+ ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES,
+ artifactPrefixNamesNode!!
+ )
val artifactPrefixNames = JacksonUtils.getListFromJsonNode(artifactPrefixNamesNodeValue!!, String::class.java)
/** Storing mapping entries with metadata log-protect set to true */
val sensitiveParameters: List<String> = artifactPrefixNames
- .map { "$it-mapping" }
- .map { blueprintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, it) }
- .flatMap { JacksonUtils.getListFromJson(it, ResourceAssignment::class.java) }
- .filter { PropertyDefinitionUtils.hasLogProtect(it.property) }
- .map { it.name }
+ .map { "$it-mapping" }
+ .map { blueprintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, it) }
+ .flatMap { JacksonUtils.getListFromJson(it, ResourceAssignment::class.java) }
+ .filter { PropertyDefinitionUtils.hasLogProtect(it.property) }
+ .map { it.name }
/** Hiding sensitive input parameters from the request */
var workflowProperties: ObjectNode = executionServiceInput.payload
- .path("$workflowName-request")
- .path("$workflowName-properties") as ObjectNode
+ .path("$workflowName-request")
+ .path("$workflowName-properties") as ObjectNode
sensitiveParameters.forEach { sensitiveParameter ->
if (workflowProperties.has(sensitiveParameter)) {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/NoPublishAuditService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/NoPublishAuditService.kt
index 6ad73d88a..aea9b7bc2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/NoPublishAuditService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/NoPublishAuditService.kt
@@ -26,8 +26,8 @@ import javax.annotation.PostConstruct
* Default audit service when no audit publisher is defined, message aren't sent
*/
@ConditionalOnProperty(
- name = ["blueprintsprocessor.messageproducer.self-service-api.audit.kafkaEnable"],
- havingValue = "false"
+ name = ["blueprintsprocessor.messageproducer.self-service-api.audit.kafkaEnable"],
+ havingValue = "false"
)
@Service
class NoPublishAuditService : PublishAuditService {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/PublishAuditService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/PublishAuditService.kt
index 67473c807..0b392e215 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/PublishAuditService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/PublishAuditService.kt
@@ -20,6 +20,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
interface PublishAuditService {
+
suspend fun publishExecutionInput(executionServiceInput: ExecutionServiceInput)
suspend fun publishExecutionOutput(correlationUUID: String, executionServiceOutput: ExecutionServiceOutput)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index f33f1149f..8cfd562d1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -42,8 +42,10 @@ import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [SelfServiceApiTestConfiguration::class, TestDatabaseConfiguration::class,
- ErrorCatalogTestConfiguration::class]
+ classes = [
+ SelfServiceApiTestConfiguration::class, TestDatabaseConfiguration::class,
+ ErrorCatalogTestConfiguration::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
index 825b0c82a..80e953822 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
@@ -33,7 +33,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu
import org.springframework.test.context.ContextConfiguration
@ContextConfiguration(
- classes = [SelfServiceApiTestConfiguration::class, ErrorCatalogTestConfiguration::class]
+ classes = [SelfServiceApiTestConfiguration::class, ErrorCatalogTestConfiguration::class]
)
class BluePrintProcessingIntegrationTest {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
index ed573d72f..4a11aeebd 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
@@ -35,8 +35,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class, SelfServiceApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, ErrorCatalogTestConfiguration::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class, SelfServiceApiTestConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, ErrorCatalogTestConfiguration::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingKafkaConsumerTest {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorCatalogTestConfiguration.kt
index a773b4cc5..8fd5e6ba0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
index f2c77d6f8..ce78aab0e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
@@ -43,14 +43,17 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(
- classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SelfServiceApiTestConfiguration::class, ErrorCatalogTestConfiguration::class]
+ classes = [
+ ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SelfServiceApiTestConfiguration::class, ErrorCatalogTestConfiguration::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceControllerTest {
@Autowired
lateinit var blueprintsProcessorCatalogService: BluePrintCatalogService
+
@Autowired
lateinit var webTestClient: WebTestClient
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
index 70e1ed0fd..86ed0eab6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -16,9 +16,9 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
-import io.mockk.coVerify
import io.mockk.Runs
import io.mockk.coEvery
+import io.mockk.coVerify
import io.mockk.just
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
@@ -42,8 +42,12 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [MockServiceAction::class, SelfServiceApiTestConfiguration::class,
- ErrorCatalogTestConfiguration::class])
+@ContextConfiguration(
+ classes = [
+ MockServiceAction::class, SelfServiceApiTestConfiguration::class,
+ ErrorCatalogTestConfiguration::class
+ ]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceHandlerTest {
@@ -95,10 +99,10 @@ class ExecutionServiceHandlerTest {
val publishAuditService = mockk<KafkaPublishAuditService>(relaxed = true)
val executionServiceHandler = ExecutionServiceHandler(
- mockk(),
- mockk(),
- mockk(),
- publishAuditService
+ mockk(),
+ mockk(),
+ mockk(),
+ publishAuditService
)
coEvery { publishAuditService.publishExecutionInput(ExecutionServiceInput()) } just Runs
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
index 98b882934..7bcf55f82 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
@@ -22,8 +22,10 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
- "org.onap.ccsdk.cds.blueprintsprocessor"]
+ basePackages = [
+ "org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"
+ ]
)
@EnableAutoConfiguration
open class SelfServiceApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
index 94da0f574..bca05f68b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
index 9f5cc6097..0deb9c91b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
@@ -53,12 +53,14 @@ class MockComponentFunction : AbstractComponentFunction() {
}
open class MockResourceSource {
+
@Bean(
name = [
"rr-processor-source-input",
"rr-processor-source-default",
"rr-processor-source-db",
- "rr-processor-source-rest"]
+ "rr-processor-source-rest"
+ ]
)
open fun sourceInstance(): ResourceAssignmentProcessor {
return mockk<ResourceAssignmentProcessor>()
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
index a367c8d36..84d057f55 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
@@ -28,8 +28,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintRuntimeValidatorService::class,
- BluePrintValidationConfiguration::class, MockResourceSource::class]
+ classes = [
+ BluePrintRuntimeValidatorService::class,
+ BluePrintValidationConfiguration::class, MockResourceSource::class
+ ]
)
class BluePrintRuntimeValidatorServiceTest {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 4cd809778..94920235b 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -105,9 +105,10 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
/** Resolve and validate lock properties */
implementation.lock?.apply {
val resolvedValues = bluePrintRuntimeService.resolvePropertyAssignments(
- BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
- interfaceName,
- mutableMapOf("key" to this.key, "acquireTimeout" to this.acquireTimeout))
+ BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
+ interfaceName,
+ mutableMapOf("key" to this.key, "acquireTimeout" to this.acquireTimeout)
+ )
this.key = resolvedValues["key"] ?: "".asJsonType()
this.acquireTimeout = resolvedValues["acquireTimeout"] ?: "".asJsonType()
@@ -157,9 +158,9 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
prepareRequestNB(executionServiceInput)
implementation.lock?.let {
bluePrintClusterService.clusterLock("${it.key.textValue()}@$CDS_LOCK_GROUP")
- .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
- applyNBWithTimeout(executionServiceInput)
- }
+ .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
+ applyNBWithTimeout(executionServiceInput)
+ }
} ?: applyNBWithTimeout(executionServiceInput)
} catch (runtimeException: RuntimeException) {
log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
@@ -169,11 +170,13 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
private suspend fun applyNBWithTimeout(executionServiceInput: ExecutionServiceInput) =
- withTimeout((implementation.timeout * 1000).toLong()) {
- log.debug("DEBUG::: AbstractComponentFunction.withTimeout " +
- "section ${implementation.timeout} seconds")
- processNB(executionServiceInput)
- }
+ withTimeout((implementation.timeout * 1000).toLong()) {
+ log.debug(
+ "DEBUG::: AbstractComponentFunction.withTimeout " +
+ "section ${implementation.timeout} seconds"
+ )
+ processNB(executionServiceInput)
+ }
fun getOperationInput(key: String): JsonNode {
return operationInputs[key]
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
index 041588616..8b46ae693 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
@@ -25,9 +25,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
abstract class AbstractScriptComponentFunction : AbstractComponentFunction() {
+
private val log = LoggerFactory.getLogger(AbstractScriptComponentFunction::class.java)!!
companion object {
+
const val DYNAMIC_PROPERTIES = "dynamic-properties"
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
index 34b18091f..d107f01e5 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
@@ -44,7 +44,7 @@ class ComponentFunctionScriptingService(
log.info(
"creating component function of script type($scriptType), reference name($scriptClassReference) and " +
- "instanceDependencies($instanceDependencies)"
+ "instanceDependencies($instanceDependencies)"
)
val scriptComponent: T = scriptInstance(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
index dbc734019..43ad183c0 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
@@ -43,6 +43,7 @@ open class ComponentRemoteScriptExecutor(
) : AbstractComponentFunction() {
companion object {
+
const val INPUT_SELECTOR = "selector"
const val INPUT_BLUEPRINT_NAME = "blueprint-name"
const val INPUT_BLUEPRINT_VERSION = "blueprint-version"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 382c26cc6..34eaf6226 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -32,6 +32,7 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
AbstractComponentFunction() {
companion object {
+
const val INPUT_SCRIPT_TYPE = "script-type"
const val INPUT_SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
index fd7cde4d0..0b12e14b1 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
object ExecutionServiceDomains {
+
// ExecutionService Domains Constants
const val BLUEPRINT_PROCESSOR = "org.onap.ccsdk.cds.blueprintsprocessor"
const val NETCONF_EXECUTOR = "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
index 3ff54076d..b006b8f47 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
@@ -24,5 +24,6 @@ import org.springframework.context.annotation.Configuration
open class ExecutionServiceConfiguration
object ExecutionServiceConstant {
+
const val SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION = "grpc-remote-script-execution-service"
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index 35f156707..a0cd7fce6 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -45,6 +45,7 @@ import org.springframework.stereotype.Service
import java.util.concurrent.TimeUnit
interface RemoteScriptExecutionService {
+
suspend fun init(selector: Any)
suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput
suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
index 239ff00c5..fc37b488f 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
@@ -66,7 +66,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
private val grpcChannels: MutableMap<String, ManagedChannel> = hashMapOf()
private val commChannels: MutableMap<String,
- ClientBidiCallChannel<ExecutionServiceInput, ExecutionServiceOutput>> = hashMapOf()
+ ClientBidiCallChannel<ExecutionServiceInput, ExecutionServiceOutput>> = hashMapOf()
/**
* Open new channel to send and receive for grpc properties [selector] for [txId],
@@ -120,28 +120,28 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
*/
@ExperimentalCoroutinesApi
override suspend fun sendNonInteractive(selector: Any, txId: String, input: ExecutionServiceInput, timeOutMill: Long):
- ExecutionServiceOutput {
-
- var output: ExecutionServiceOutput? = null
- val flow = openSubscription(selector, txId)
-
- /** Send the request */
- val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
- sendChannel.send(input)
-
- /** Receive the response with timeout */
- withTimeout(timeOutMill) {
- flow.collect {
- log.trace("Received non-interactive transactionId($txId) response : ${it.status.eventType}")
- if (it.status.eventType == EventType.EVENT_COMPONENT_EXECUTED) {
- output = it
- cancelSubscription(txId)
+ ExecutionServiceOutput {
+
+ var output: ExecutionServiceOutput? = null
+ val flow = openSubscription(selector, txId)
+
+ /** Send the request */
+ val sendChannel = commChannels[txId]?.requestChannel
+ ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ sendChannel.send(input)
+
+ /** Receive the response with timeout */
+ withTimeout(timeOutMill) {
+ flow.collect {
+ log.trace("Received non-interactive transactionId($txId) response : ${it.status.eventType}")
+ if (it.status.eventType == EventType.EVENT_COMPONENT_EXECUTED) {
+ output = it
+ cancelSubscription(txId)
+ }
}
}
+ return output!!
}
- return output!!
- }
/** Cancel the Subscription for the [txId], This closes communication channel **/
@ExperimentalCoroutinesApi
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
index 3b8c296e6..2f1ae2fc5 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
@@ -35,6 +35,6 @@ open class DeprecatedBlueprintJythonService : BlueprintJythonService {
override fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String):
BlueprintFunctionNode<*, *> {
- throw BluePrintProcessorException("Include python-executor module for Jython support")
- }
+ throw BluePrintProcessorException("Include python-executor module for Jython support")
+ }
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
index 0125cd8d9..b3a0a5892 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
@@ -110,8 +110,8 @@ class ComponentRemoteScriptExecutorTest {
val mockExecutionServiceInput = mockExecutionServiceInput(bluePrintRuntime)
val mockStreamingRemoteExecutionService = mockk<StreamingRemoteExecutionService<
- org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
- ExecutionServiceOutput>>()
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
+ ExecutionServiceOutput>>()
coEvery {
mockStreamingRemoteExecutionService.sendNonInteractive(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
index a0eaeca5f..8edea46f6 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
@@ -39,7 +39,7 @@ class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintPr
override fun onNext(executionServiceInput: ExecutionServiceInput) {
log.info(
"Received requestId(${executionServiceInput.commonHeader.requestId}) " +
- "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
+ "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
)
runBlocking {
launch(MDCContext()) {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index 0f9dfd157..377b95010 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -54,7 +54,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
-import java.lang.RuntimeException
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -64,8 +63,10 @@ import kotlin.test.assertNotNull
*/
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [ComponentFunctionScriptingService::class,
- BluePrintScriptsServiceImpl::class, DeprecatedBlueprintJythonService::class]
+ classes = [
+ ComponentFunctionScriptingService::class,
+ BluePrintScriptsServiceImpl::class, DeprecatedBlueprintJythonService::class
+ ]
)
class AbstractComponentFunctionTest {
@@ -166,8 +167,8 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
} returns mutableMapOf(
- "key" to "abc-123-def-456".asJsonType(),
- "acquireTimeout" to implementation.lock!!.acquireTimeout
+ "key" to "abc-123-def-456".asJsonType(),
+ "acquireTimeout" to implementation.lock!!.acquireTimeout
)
val component: AbstractComponentFunction = SampleComponent()
@@ -193,8 +194,10 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
- } returns mutableMapOf("key" to "".asJsonType(),
- "acquireTimeout" to Integer(360).asJsonType())
+ } returns mutableMapOf(
+ "key" to "".asJsonType(),
+ "acquireTimeout" to Integer(360).asJsonType()
+ )
val component: AbstractComponentFunction = SampleComponent()
component.bluePrintRuntimeService = bluePrintRuntimeService
@@ -239,8 +242,10 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
- } returns mutableMapOf("key" to lockName.asJsonType(),
- "acquireTimeout" to Integer(180).asJsonType())
+ } returns mutableMapOf(
+ "key" to lockName.asJsonType(),
+ "acquireTimeout" to Integer(180).asJsonType()
+ )
val clusterLock: ClusterLock = mockk()
@@ -272,49 +277,49 @@ class AbstractComponentFunctionTest {
private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
- val mapper = ObjectMapper()
- val rootNode = mapper.createObjectNode()
- rootNode.put("ip-address", "0.0.0.0")
- rootNode.put("type", "rest")
-
- val operationInputs = hashMapOf<String, JsonNode>()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
- "activate-restconf".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
- "interfaceName".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
- "operationName".asJsonPrimitive()
- operationInputs["dynamic-properties"] = rootNode
-
- val stepInputData = StepData().apply {
- name = "activate-restconf"
- properties = operationInputs
- }
- val executionServiceInput = ExecutionServiceInput().apply {
- commonHeader = CommonHeader().apply {
- requestId = "1234"
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationInputs = hashMapOf<String, JsonNode>()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
+ "activate-restconf".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
+ "interfaceName".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
+ "operationName".asJsonPrimitive()
+ operationInputs["dynamic-properties"] = rootNode
+
+ val stepInputData = StepData().apply {
+ name = "activate-restconf"
+ properties = operationInputs
}
- actionIdentifiers = ActionIdentifiers().apply {
- actionName = "activate"
+ val executionServiceInput = ExecutionServiceInput().apply {
+ commonHeader = CommonHeader().apply {
+ requestId = "1234"
+ }
+ actionIdentifiers = ActionIdentifiers().apply {
+ actionName = "activate"
+ }
+ payload = JacksonUtils.jsonNode("{}") as ObjectNode
}
- payload = JacksonUtils.jsonNode("{}") as ObjectNode
+ executionServiceInput.stepData = stepInputData
+
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
+ "activate-restconf", "interfaceName", "operationName"
+ )
+ } returns operationInputs
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
+ "activate-restconf", "interfaceName", "operationName"
+ )
+ } returns operationOutputs
+ every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+
+ return executionServiceInput
}
- executionServiceInput.stepData = stepInputData
-
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
- "activate-restconf", "interfaceName", "operationName"
- )
- } returns operationInputs
-
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
- "activate-restconf", "interfaceName", "operationName"
- )
- } returns operationOutputs
- every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
-
- return executionServiceInput
- }
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
index 31b1a59c8..66bcf52c8 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
@@ -49,7 +49,7 @@ open class SampleRestconfComponent(private var componentFunctionScriptingService
this,
"internal",
"org.onap.ccsdk.cds.blueprintsprocessor.services" +
- ".execution.scripts.SampleTest",
+ ".execution.scripts.SampleTest",
mutableListOf()
)
scriptComponent.executeScript(executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
index 240348081..c35e86cc6 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
@@ -83,7 +83,7 @@ open class BluePrintWorkflowExecutionServiceImpl(
else -> {
throw BluePrintProcessorException(
"couldn't execute workflow($workflowName) step mapped " +
- "to node template($nodeTemplateName) derived from($derivedFrom)"
+ "to node template($nodeTemplateName) derived from($derivedFrom)"
)
}
}
@@ -103,8 +103,8 @@ open class BluePrintWorkflowExecutionServiceImpl(
// Set the Response Payload
executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode()
executionServiceOutput.payload.set<JsonNode>(
- "$workflowName-response",
- workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode()
+ "$workflowName-response",
+ workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode()
)
return executionServiceOutput
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
index 2aa408527..0146358a8 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
@@ -55,7 +55,7 @@ class ImperativeWorkflowExecutionService(
val graph = bluePrintContext.workflowByName(workflowName).asGraph()
return ImperativeBluePrintWorkflowService(nodeTemplateExecutionService)
- .executeWorkflow(graph, bluePrintRuntimeService, executionServiceInput)
+ .executeWorkflow(graph, bluePrintRuntimeService, executionServiceInput)
}
}
@@ -115,22 +115,22 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
}
override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
- NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
- val nodeOutput = ExecutionServiceOutput().apply {
- commonHeader = executionServiceInput.commonHeader
- actionIdentifiers = executionServiceInput.actionIdentifiers
+ NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ val nodeOutput = ExecutionServiceOutput().apply {
+ commonHeader = executionServiceInput.commonHeader
+ actionIdentifiers = executionServiceInput.actionIdentifiers
+ }
+ return NodeExecuteMessage(node, executionServiceInput, nodeOutput)
}
- return NodeExecuteMessage(node, executionServiceInput, nodeOutput)
- }
override suspend fun prepareNodeSkipMessage(node: Graph.Node):
- NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
- val nodeOutput = ExecutionServiceOutput().apply {
- commonHeader = executionServiceInput.commonHeader
- actionIdentifiers = executionServiceInput.actionIdentifiers
+ NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ val nodeOutput = ExecutionServiceOutput().apply {
+ commonHeader = executionServiceInput.commonHeader
+ actionIdentifiers = executionServiceInput.actionIdentifiers
+ }
+ return NodeSkipMessage(node, executionServiceInput, nodeOutput)
}
- return NodeSkipMessage(node, executionServiceInput, nodeOutput)
- }
override suspend fun executeNode(
node: Graph.Node,
@@ -141,6 +141,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
val step = bluePrintRuntimeService.bluePrintContext().workflowStepByName(this.workflowName, node.id)
checkNotEmpty(step.target) { "couldn't get step target for workflow(${this.workflowName})'s step(${node.id})" }
val nodeTemplateName = step.target!!
+
/** execute node template */
val executionServiceOutput = nodeTemplateExecutionService
.executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
index c1bcc649f..0634d11be 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
@@ -25,6 +25,7 @@ open class WorkflowServiceConfiguration
class WorkflowServiceConstants {
companion object {
+
const val ARTIFACT_TYPE_DIRECTED_GRAPH = "artifact-directed-graph"
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index 8c4e2d215..2ff06061a 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -38,32 +38,32 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
@Throws(SvcLogicException::class)
override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext):
- SvcLogicNode = runBlocking {
+ SvcLogicNode = runBlocking {
- var outValue: String
+ var outValue: String
- val ctx = svcLogicContext as BlueprintSvcLogicContext
+ val ctx = svcLogicContext as BlueprintSvcLogicContext
- val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
+ val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
- val executionInput = ctx.getRequest() as ExecutionServiceInput
+ val executionInput = ctx.getRequest() as ExecutionServiceInput
- try { // Get the Request from the Context and Set to the Function Input and Invoke the function
- val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
- ctx.getBluePrintService(),
- nodeTemplateName, executionInput
- )
+ try { // Get the Request from the Context and Set to the Function Input and Invoke the function
+ val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
+ ctx.getBluePrintService(),
+ nodeTemplateName, executionInput
+ )
- ctx.setResponse(executionOutput)
+ ctx.setResponse(executionOutput)
- outValue = executionOutput.status.message
- ctx.status = executionOutput.status.message
- } catch (e: Exception) {
- log.error("Could not execute plugin($nodeTemplateName) : ", e)
- outValue = "failure"
- ctx.status = "failure"
- }
+ outValue = executionOutput.status.message
+ ctx.status = executionOutput.status.message
+ } catch (e: Exception) {
+ log.error("Could not execute plugin($nodeTemplateName) : ", e)
+ outValue = "failure"
+ ctx.status = "failure"
+ }
- getNextNode(node, outValue)
- }
+ getNextNode(node, outValue)
+ }
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
index 47fbe1021..b661e73a5 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
@@ -49,7 +49,6 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
-import java.lang.RuntimeException
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
@@ -148,7 +147,8 @@ class BluePrintWorkflowExecutionServiceImplTest {
fun `Should handle errors from resolve workflow output`() {
val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk()
val bluePrintWorkflowExecutionServiceImpl = BluePrintWorkflowExecutionServiceImpl(
- mockk(), mockk(), imperativeWorkflowExecutionService)
+ mockk(), mockk(), imperativeWorkflowExecutionService
+ )
val bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>> = mockk()
val bluePrintContext: BluePrintContext = mockk()
val executionServiceInput = ExecutionServiceInput().apply {
@@ -176,7 +176,8 @@ class BluePrintWorkflowExecutionServiceImplTest {
runBlocking {
val output = bluePrintWorkflowExecutionServiceImpl.executeBluePrintWorkflow(
- bluePrintRuntimeService, executionServiceInput, mutableMapOf())
+ bluePrintRuntimeService, executionServiceInput, mutableMapOf()
+ )
assertEquals("failed to resolve property...", blueprintError.errors[0])
assertEquals("""{"config-assign-response":{}}""".asJsonType(), output.payload)
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
index c200f4ae2..2367422a7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
@@ -43,6 +43,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertNotNull
class ImperativeWorkflowExecutionServiceTest {
+
val log = logger(ImperativeWorkflowExecutionServiceTest::class)
@Before
diff --git a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCatalogException.kt b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCatalogException.kt
index 348b60ceb..f07f26227 100644
--- a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCatalogException.kt
+++ b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCatalogException.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.error.catalog.core
interface ErrorCatalogExceptionFluent<T> {
+
fun code(code: Int): T
fun domain(domain: String): T
fun action(action: String): T
@@ -31,6 +32,7 @@ interface ErrorCatalogExceptionFluent<T> {
}
open class ErrorCatalogException : RuntimeException {
+
var code: Int = -1
var domain: String = ""
var name: String = ErrorCatalogCodes.GENERIC_FAILURE
@@ -60,8 +62,8 @@ open class ErrorCatalogException : RuntimeException {
constructor(code: Int, cause: Throwable, message: String, vararg args: Any?) :
super(String.format(message, *args), cause) {
- this.code = code
- }
+ this.code = code
+ }
open fun <T : ErrorCatalogException> updateCode(code: Int): T {
this.code = code
diff --git a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCodes.kt b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCodes.kt
index 8023d97c8..895cd914a 100644
--- a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCodes.kt
+++ b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorCodes.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.error.catalog.core
object ErrorCatalogCodes {
+
const val GENERIC_FAILURE = "GENERIC_FAILURE"
const val GENERIC_PROCESS_FAILURE = "GENERIC_PROCESS_FAILURE"
const val INVALID_FILE_EXTENSION = "INVALID_FILE_EXTENSION"
@@ -32,6 +33,7 @@ object ErrorCatalogCodes {
}
object HttpErrorCodes {
+
private val store: MutableMap<String, Int> = mutableMapOf()
init {
@@ -59,6 +61,7 @@ object HttpErrorCodes {
}
object GrpcErrorCodes {
+
private val store: MutableMap<String, Int> = mutableMapOf()
init {
diff --git a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorLibData.kt b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorLibData.kt
index 4158cfaf8..69209012d 100644
--- a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorLibData.kt
+++ b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorLibData.kt
@@ -17,16 +17,17 @@
package org.onap.ccsdk.cds.error.catalog.core
import com.fasterxml.jackson.annotation.JsonFormat
-import org.slf4j.event.Level
import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants.ERROR_CATALOG_DEFAULT_ERROR_CODE
+import org.slf4j.event.Level
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.Date
-import kotlin.collections.ArrayList
open class ErrorPayload {
+
var code: Int = ERROR_CATALOG_DEFAULT_ERROR_CODE
var status: String = ""
+
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = controllerDate()
var message: String = ""
@@ -67,9 +68,11 @@ open class ErrorPayload {
}
fun isEqualTo(errorPayload: ErrorPayload): Boolean {
- return (this.code == errorPayload.code && this.status == errorPayload.status && this.message == errorPayload.message &&
- this.logLevel == errorPayload.logLevel && this.debugMessage == errorPayload.debugMessage &&
- this.subErrors == errorPayload.subErrors)
+ return (
+ this.code == errorPayload.code && this.status == errorPayload.status && this.message == errorPayload.message &&
+ this.logLevel == errorPayload.logLevel && this.debugMessage == errorPayload.debugMessage &&
+ this.subErrors == errorPayload.subErrors
+ )
}
private fun controllerDate(): Date {
@@ -96,6 +99,7 @@ data class ErrorCatalog(
val action: String,
val cause: String
) {
+
fun getMessage(): String {
return "Cause: $cause ${System.lineSeparator()} Action : $action"
}
diff --git a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorMessageLibConstants.kt b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorMessageLibConstants.kt
index 6570e3e66..b6f334a7c 100644
--- a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorMessageLibConstants.kt
+++ b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/ErrorMessageLibConstants.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.error.catalog.core
object ErrorMessageLibConstants {
+
const val ERROR_CATALOG_DOMAIN = "org.onap.ccsdk.cds.error.catalog"
const val ERROR_CATALOG_TYPE = "error.catalog.type"
const val ERROR_CATALOG_TYPE_PROPERTIES = "properties"
diff --git a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/utils/ErrorCatalogUtils.kt b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/utils/ErrorCatalogUtils.kt
index f13a3604f..8fe1c5016 100644
--- a/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/utils/ErrorCatalogUtils.kt
+++ b/ms/error-catalog/core/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/core/utils/ErrorCatalogUtils.kt
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.error.catalog.core.utils
import org.apache.commons.lang3.exception.ExceptionUtils
object ErrorCatalogUtils {
+
private const val REGEX_PATTERN = "^cause=(.*),action=(.*)"
private val regex = REGEX_PATTERN.toRegex()
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
index f0a75e087..8fc5edf37 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
@@ -28,6 +28,7 @@ open class ErrorCatalogConfiguration
@Component
@ConfigurationProperties(prefix = "error.catalog")
open class ErrorCatalogProperties {
+
lateinit var type: String
lateinit var applicationId: String
var errorDefinitionDir: String? = null
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
index 95b44e683..4bb042e95 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
@@ -41,7 +41,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomains method to retrieve all the Domain in Error Catalog Database by pages
*
* @return Page<Domain> list of the domains by page
- </Domain> */
+ </Domain> */
open fun getAllDomains(pageRequest: Pageable): Page<Domain> {
return domainRepository.findAll(pageRequest)
}
@@ -50,7 +50,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomains method to retrieve all the Domain in Error Catalog Database
*
* @return List<Domain> list of the domains
- </Domain> */
+ </Domain> */
open fun getAllDomains(): List<Domain> {
return domainRepository.findAll()
}
@@ -59,7 +59,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomainsByApplication method to retrieve all the Domain that belong to an application in Error Catalog Database
*
* @return List<Domain> list of the domains
- </Domain> */
+ </Domain> */
open fun getAllDomainsByApplication(applicationId: String): List<Domain> {
return domainRepository.findAllByApplicationId(applicationId)
}
@@ -68,7 +68,7 @@ open class ErrorCatalogDBService(
* This is a getAllErrorMessagesByApplication method to retrieve all the Messages that belong to an application in Error Catalog Database
*
* @return MutableMap<String, ErrorCode> list of the abstractErrorModel
- </Domain> */
+ </Domain> */
open fun getAllErrorMessagesByApplication(applicationId: String): MutableMap<String, ErrorMessageModel> {
val domains = domainRepository.findAllByApplicationId(applicationId)
val errorMessages = mutableMapOf<String, ErrorMessageModel>()
@@ -93,6 +93,7 @@ open class ErrorCatalogDBService(
}
companion object {
+
private const val MESSAGE_KEY_SEPARATOR = "."
}
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
index 258209f71..161b6b8e4 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
@@ -39,40 +39,50 @@ abstract class ErrorCatalogExceptionHandler(private val errorCatalogService: Err
@ExceptionHandler
fun errorCatalogException(e: ServerWebInputException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.REQUEST_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.REQUEST_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: IncorrectResultSizeDataAccessException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.DUPLICATE_DATA),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.DUPLICATE_DATA),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: EmptyResultDataAccessException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: JpaObjectRetrievalFailureException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: Exception): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
index df13724c6..bcde35029 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
@@ -100,7 +100,7 @@ open class ErrorCatalogLoadDBService(
havingValue = ErrorMessageLibConstants.ERROR_CATALOG_TYPE_PROPERTIES
)
open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: ErrorCatalogProperties) :
- ErrorCatalogLoadService {
+ ErrorCatalogLoadService {
private val propertyFileName = ErrorMessageLibConstants.ERROR_CATALOG_PROPERTIES_FILENAME
private lateinit var propertyFile: File
@@ -134,11 +134,15 @@ open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: E
inputStream = propertyFile.inputStream()
props.load(inputStream)
} catch (e: FileNotFoundException) {
- log.error("Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName' " +
- "not found in the application directory.")
+ log.error(
+ "Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName' " +
+ "not found in the application directory."
+ )
} catch (e: IOException) {
- log.error("Application ID: ${errorCatalogProperties.applicationId} > Fail to load property file " +
- "'$propertyFileName' for message errors.")
+ log.error(
+ "Application ID: ${errorCatalogProperties.applicationId} > Fail to load property file " +
+ "'$propertyFileName' for message errors."
+ )
} finally {
inputStream?.close()
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
index 21fd51b2f..298daa6fc 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.error.catalog.services
import kotlinx.coroutines.runBlocking
+import org.apache.commons.lang3.exception.ExceptionUtils
import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalog
import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalogException
import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants
@@ -25,7 +26,6 @@ import org.onap.ccsdk.cds.error.catalog.core.ErrorPayload
import org.onap.ccsdk.cds.error.catalog.core.GrpcErrorCodes
import org.onap.ccsdk.cds.error.catalog.core.HttpErrorCodes
import org.onap.ccsdk.cds.error.catalog.core.utils.ErrorCatalogUtils
-import org.apache.commons.lang3.exception.ExceptionUtils
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.stereotype.Service
import javax.annotation.PostConstruct
@@ -78,11 +78,11 @@ open class ErrorCatalogService(private var errorCatalogLoadService: ErrorCatalog
}
return ErrorCatalog(
- errorCatalogException.name,
- errorCatalogException.domain,
- errorCode,
- action,
- errorCause
+ errorCatalogException.name,
+ errorCatalogException.domain,
+ errorCode,
+ action,
+ errorCause
)
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
index 7ade1c2a2..7216c0585 100755
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
@@ -17,18 +17,18 @@
package org.onap.ccsdk.cds.error.catalog.services.domain
import java.io.Serializable
+import java.util.UUID
import javax.persistence.CascadeType
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.Id
+import javax.persistence.JoinColumn
+import javax.persistence.JoinTable
import javax.persistence.Lob
import javax.persistence.ManyToMany
import javax.persistence.Table
import javax.persistence.UniqueConstraint
-import java.util.UUID
-import javax.persistence.JoinTable
-import javax.persistence.JoinColumn
/**
* Provide ErrorCode Entity
@@ -40,6 +40,7 @@ import javax.persistence.JoinColumn
@Entity
@Table(name = "ERROR_DOMAINS", uniqueConstraints = [UniqueConstraint(columnNames = ["name", "application_id"])])
class Domain : Serializable {
+
@Id
var id: String = UUID.randomUUID().toString()
@@ -71,6 +72,7 @@ class Domain : Serializable {
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
index a4e92af48..f2556e6c1 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
@@ -56,6 +56,7 @@ class ErrorMessageModel : Serializable {
val domains: MutableSet<Domain> = mutableSetOf()
companion object {
+
private const val serialVersionUID = 1L
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
index 04cbebe7a..6795e8b31 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
@@ -23,7 +23,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableConfigurationProperties(SdcListenerConfiguration.class)
-@ComponentScan(basePackages = {"org.onap.ccsdk.cds.blueprintsprocessor.healthapi","org.onap.ccsdk.cds.sdclistener"})
+@ComponentScan(basePackages = {"org.onap.ccsdk.cds.blueprintsprocessor.healthapi", "org.onap.ccsdk.cds.sdclistener"})
public class SdcListenerApplication {
public static void main(String[] args) {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
index 686f0aa10..5caac6a5a 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
@@ -23,8 +23,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
/**
- * In order to initiate a SDC distribution client we need to supply some pre-configuration values that
- * distribution client needs.
+ * In order to initiate a SDC distribution client we need to supply some pre-configuration values that distribution
+ * client needs.
*/
@ConfigurationProperties("listenerservice")
public class SdcListenerConfiguration implements IConfiguration {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
index f379e60a6..b8868325a 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
@@ -79,7 +79,7 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
/**
* Download the TOSCA CSAR artifact and process it.
*
- * @param info - Artifact information
+ * @param info - Artifact information
* @param distributionClient - SDC distribution client
*/
private void downloadCsarArtifacts(IArtifactInfo info, IDistributionClient distributionClient) {
@@ -97,9 +97,8 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
final String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
result.getDistributionActionResult());
- listenerStatus
- .sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR, errorMessage,
- url, NotificationType.DOWNLOAD);
+ listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR,
+ errorMessage, url, NotificationType.DOWNLOAD);
LOGGER.error(errorMessage);
} else {
listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_OK, null, url,
@@ -122,7 +121,7 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
if (!csarFiles.isEmpty()) {
final String archivePath = cbaArchivePath.toString();
- //Extract CBA archive from CSAR package and store it into local disk
+ // Extract CBA archive from CSAR package and store it into local disk
csarFiles.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath));
csarFiles.forEach(file -> FileUtil.deleteFile(file, csarArchivePath.toString()));
} else {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
index 5389dccc0..5748eda18 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
@@ -40,7 +40,7 @@ public class SdcListenerAuthClientInterceptor implements ClientInterceptor {
@Override
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> methodDescriptor,
- CallOptions callOptions, Channel channel) {
+ CallOptions callOptions, Channel channel) {
Key<String> authHeader = Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER);
return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
channel.newCall(methodDescriptor, callOptions)) {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
index 030200924..2d8c1fe04 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
@@ -81,8 +81,8 @@ public class SdcListenerClient {
result = this.distributionClient.start();
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- throw new SdcListenerException(
- "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult());
+ throw new SdcListenerException("Startup of the SDC distribution client failed with reason: "
+ + result.getDistributionMessageResult());
}
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
index 39d03c5bd..b0f8a12e4 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
@@ -28,8 +28,7 @@ import reactor.core.publisher.Mono;
public class HealthCheck {
@RequestMapping(path = "/healthcheck", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- Mono<String> ping() {
+ public @ResponseBody Mono<String> ping() {
return Mono.just("{\"status\":\"UP\"}");
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
index 19e700153..3ce826ce6 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
@@ -61,10 +61,8 @@ public class SdcListenerDto {
}
public void setManagedChannelForGrpc() {
- managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
- .usePlaintext()
- .intercept(sdcListenerAuthClientInterceptor)
- .build();
+ managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort).usePlaintext()
+ .intercept(sdcListenerAuthClientInterceptor).build();
}
public ManagedChannel getManagedChannelForGrpc() {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
index 458d667f3..bc7b57193 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
@@ -27,7 +27,7 @@ public class SdcListenerException extends Exception {
/**
* @param message The message to dump
- * @param cause The Throwable cause object
+ * @param cause The Throwable cause object
*/
public SdcListenerException(final String message, final Throwable cause) {
super(message, cause);
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
index 584713a50..b80dd260d 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
@@ -38,7 +38,7 @@ public class BluePrintProcesssorHandler implements AutoCloseable {
/**
* Sending CBA archive to CDS backend to store into its Database.
*
- * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints.
+ * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints.
* @param managedChannel - ManagedChannel object helps to access the server or application end point.
*
* @return A response object
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
index 9f0acd544..5fa3fb327 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
@@ -27,14 +27,14 @@ public interface ListenerService {
* Get the controller blueprint archive from CSAR package.
*
* @param csarArchivePath The path where CSAR archive is stored.
- * @param cbaArchivePath The destination path where CBA will be stored.
+ * @param cbaArchivePath The destination path where CBA will be stored.
*/
void extractBluePrint(String csarArchivePath, String cbaArchivePath);
/**
* Store the Zip file into CDS database.
*
- * @param path path where zip file exists.
+ * @param path path where zip file exists.
* @param managedChannel To access the blueprint processor application end point
*/
void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel);
@@ -42,7 +42,7 @@ public interface ListenerService {
/**
* Extract and store the csar package to local disk.
*
- * @param result - IDistributionClientDownloadResult contains payload.
+ * @param result - IDistributionClientDownloadResult contains payload.
* @param csarArchivePath The destination path where CSAR will be stored.
*/
void extractCsarAndStore(IDistributionClientDownloadResult result, Path csarArchivePath);
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
index 19a62fb1d..ee27a9475 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
@@ -81,7 +81,8 @@ public class ListenerServiceImpl implements ListenerService {
@Value("${listenerservice.config.grpcPort}")
private int grpcPort;
- private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
+ private static final String CBA_ZIP_PATH =
+ "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
private static final int SUCCESS_CODE = 200;
private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class);
@@ -105,17 +106,17 @@ public class ListenerServiceImpl implements ListenerService {
}
if (validPathCount == 0) {
- LOGGER
- .info("CBA archive doesn't exist in the CSAR Package or it doesn't exist as per the given path {}",
- CBA_ZIP_PATH);
- listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null,
- artifactUrl, SDC_LISTENER_COMPONENT);
+ LOGGER.info(
+ "CBA archive doesn't exist in the CSAR Package or it doesn't exist as per the given path {}",
+ CBA_ZIP_PATH);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null, artifactUrl,
+ SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
final String errorMessage = format("Failed to extract blueprint %s", e.getMessage());
- listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage,
- artifactUrl, SDC_LISTENER_COMPONENT);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
}
}
@@ -133,8 +134,8 @@ public class ListenerServiceImpl implements ListenerService {
LOGGER.error("Could not able to create file {}", targetZipFile, e);
}
- try (InputStream inputStream = zipFile.getInputStream(entry); OutputStream out = new FileOutputStream(
- targetZipFile)) {
+ try (InputStream inputStream = zipFile.getInputStream(entry);
+ OutputStream out = new FileOutputStream(targetZipFile)) {
IOUtils.copy(inputStream, out);
LOGGER.info("Successfully store the CBA archive {} at this location", targetZipFile);
} catch (Exception e) {
@@ -200,8 +201,8 @@ public class ListenerServiceImpl implements ListenerService {
if (responseStatus.getCode() != SUCCESS_CODE) {
final String errorMessage = format("Failed to store the CBA archive into CDS DB due to %s",
responseStatus.getErrorMessage());
- listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage,
+ artifactUrl, SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
} else {
LOGGER.info(responseStatus.getMessage());
@@ -223,15 +224,11 @@ public class ListenerServiceImpl implements ListenerService {
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
FileUtil.deleteFile(file, path);
return BluePrintUploadInput.newBuilder()
- .setCommonHeader(CommonHeader.newBuilder()
- .setRequestId(UUID.randomUUID().toString())
- .setSubRequestId(UUID.randomUUID().toString())
- .setOriginatorId("SDC-LISTENER")
- .build())
- .setActionIdentifiers(ActionIdentifiers.newBuilder()
- .setActionName(UploadAction.PUBLISH.toString()).build())
- .setFileChunk(fileChunk)
- .build();
+ .setCommonHeader(CommonHeader.newBuilder().setRequestId(UUID.randomUUID().toString())
+ .setSubRequestId(UUID.randomUUID().toString()).setOriginatorId("SDC-LISTENER").build())
+ .setActionIdentifiers(
+ ActionIdentifiers.newBuilder().setActionName(UploadAction.PUBLISH.toString()).build())
+ .setFileChunk(fileChunk).build();
}
private String getDistributionId() {
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
index a24c0ddad..16cc2f32d 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
@@ -51,27 +51,26 @@ public class SdcListenerStatus {
public enum NotificationType {
- DOWNLOAD,
- SDC_LISTENER_COMPONENT;
+ DOWNLOAD, SDC_LISTENER_COMPONENT;
}
/**
* Send the component status back to SDC.
*
* @param distributionID SDC Distribution ID
- * @param status Distribution status
- * @param errorReason Reason of failure if present
- * @param url Artifact URL
- * @param type - NotificationType(Download or Component)
+ * @param status Distribution status
+ * @param errorReason Reason of failure if present
+ * @param url Artifact URL
+ * @param type - NotificationType(Download or Component)
*/
public void sendResponseBackToSdc(String distributionID, DistributionStatusEnum status, String errorReason,
- String url, NotificationType type) {
+ String url, NotificationType type) {
final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient();
switch (type) {
case SDC_LISTENER_COMPONENT:
- IComponentDoneStatusMessage componentStatusMessage = buildStatusMessage(distributionID, status, url,
- COMPONENT_NAME);
+ IComponentDoneStatusMessage componentStatusMessage =
+ buildStatusMessage(distributionID, status, url, COMPONENT_NAME);
if (errorReason == null) {
checkResponseStatusFromSdc(distributionClient.sendComponentDoneStatus(componentStatusMessage));
@@ -82,8 +81,8 @@ public class SdcListenerStatus {
break;
case DOWNLOAD:
- IDistributionStatusMessage downloadStatusMessage = buildStatusMessage(distributionID, status, url,
- null);
+ IDistributionStatusMessage downloadStatusMessage =
+ buildStatusMessage(distributionID, status, url, null);
if (errorReason == null) {
checkResponseStatusFromSdc(distributionClient.sendDownloadStatus(downloadStatusMessage));
@@ -97,7 +96,7 @@ public class SdcListenerStatus {
}
private ComponentStatusMessage buildStatusMessage(String distributionId, DistributionStatusEnum status, String url,
- String componentName) {
+ String componentName) {
return new BuilderUtil<>(new ComponentStatusMessage()).build(builder -> {
builder.setDistributionID(distributionId);
builder.setStatus(status);
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
index f1c1c735d..d8e75e260 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
@@ -62,9 +62,7 @@ public final class FileUtil {
try (Stream<Path> fileTree = walk(path)) {
// Get the list of files from the path
- return fileTree.filter(Files :: isRegularFile)
- .map(Path :: toFile)
- .collect(Collectors.toList());
+ return fileTree.filter(Files::isRegularFile).map(Path::toFile).collect(Collectors.toList());
} catch (IOException e) {
LOGGER.error("Failed to find the file due to", e);
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
index d27d1c491..9f0840987 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
@@ -39,11 +39,11 @@ public class SdcListenerClientTest {
@Test
public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient,
- @Injectable SdcListenerConfiguration configuration,
- @Injectable SdcListenerNotificationCallback notification,
- @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException {
+ @Injectable SdcListenerConfiguration configuration,
+ @Injectable SdcListenerNotificationCallback notification, @Injectable SdcListenerDto sdcListenerDto)
+ throws SdcListenerException {
- //Arrange
+ // Arrange
new MockUp<DistributionClientFactory>() {
@Mock
public IDistributionClient createDistributionClient() {
@@ -51,24 +51,30 @@ public class SdcListenerClientTest {
}
};
- new Expectations() {{
- distributionClient.init(configuration, notification);
- result = getResult();
- }};
+ new Expectations() {
+ {
+ distributionClient.init(configuration, notification);
+ result = getResult();
+ }
+ };
- new Expectations() {{
- distributionClient.start();
- result = getResult();
- }};
+ new Expectations() {
+ {
+ distributionClient.start();
+ result = getResult();
+ }
+ };
// Act
sdcListenerClient.initSdcClient();
// Verify
- new VerificationsInOrder() {{
- distributionClient.init(configuration, notification);
- distributionClient.start();
- }};
+ new VerificationsInOrder() {
+ {
+ distributionClient.init(configuration, notification);
+ distributionClient.start();
+ }
+ };
}
public IDistributionClientResult getResult() {
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java
index 1f4ba81f7..f27b22ce6 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java
@@ -35,6 +35,7 @@
*
*
*/
+
package org.onap.ccsdk.cds.sdclistener.dto;
import org.junit.Test;
@@ -49,7 +50,7 @@ import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
-@EnableConfigurationProperties({SdcListenerDto.class,SdcListenerAuthClientInterceptor.class})
+@EnableConfigurationProperties({SdcListenerDto.class, SdcListenerAuthClientInterceptor.class})
@SpringBootTest(classes = {SdcListenerDtoTest.class})
public class SdcListenerDtoTest {
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java
index 72f0ef289..6f08f0b90 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java
@@ -35,16 +35,18 @@
*
*
*/
+
package org.onap.ccsdk.cds.sdclistener.exceptions;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+
public class SdcListenerExceptionTest {
@Test
public void testConstructor() {
- final String s1="Exception occured";
- SdcListenerException sle=new SdcListenerException(s1);
- assertEquals(sle.getMessage(),"Exception occured");
+ final String s1 = "Exception occured";
+ SdcListenerException sle = new SdcListenerException(s1);
+ assertEquals(sle.getMessage(), "Exception occured");
}
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
index 8a4bb2224..7cde45d9e 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
@@ -73,7 +73,7 @@ public class BluePrintProcessorHandlerTest {
final BluePrintManagementServiceImplBase serviceImplBase = new BluePrintManagementServiceImplBase() {
@Override
public void uploadBlueprint(BluePrintUploadInput request,
- StreamObserver<BluePrintManagementOutput> responseObserver) {
+ StreamObserver<BluePrintManagementOutput> responseObserver) {
responseObserver.onNext(getBluePrintManagementOutput());
responseObserver.onCompleted();
}
@@ -83,8 +83,8 @@ public class BluePrintProcessorHandlerTest {
String serverName = InProcessServerBuilder.generateName();
// Create a server, add service, start, and register.
- grpcCleanup.register(
- InProcessServerBuilder.forName(serverName).addService(serviceImplBase).directExecutor().build().start());
+ grpcCleanup.register(InProcessServerBuilder.forName(serverName).addService(serviceImplBase).directExecutor()
+ .build().start());
// Create a client channel.
channel = grpcCleanup.register(InProcessChannelBuilder.forName(serverName).directExecutor().build());
@@ -109,20 +109,16 @@ public class BluePrintProcessorHandlerTest {
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
return BluePrintUploadInput.newBuilder()
- .setCommonHeader(CommonHeader.newBuilder()
- .setRequestId(UUID.randomUUID().toString())
- .setSubRequestId(UUID.randomUUID().toString())
- .setOriginatorId("SDC-LISTENER")
- .build())
- .setActionIdentifiers(ActionIdentifiers.newBuilder()
- .setActionName(UploadAction.PUBLISH.toString()).build())
+ .setCommonHeader(CommonHeader.newBuilder().setRequestId(UUID.randomUUID().toString())
+ .setSubRequestId(UUID.randomUUID().toString()).setOriginatorId("SDC-LISTENER").build())
+ .setActionIdentifiers(
+ ActionIdentifiers.newBuilder().setActionName(UploadAction.PUBLISH.toString()).build())
.setFileChunk(fileChunk).build();
}
private BluePrintManagementOutput getBluePrintManagementOutput() {
return BluePrintManagementOutput.newBuilder()
- .setStatus(Status.newBuilder().setMessage(SUCCESS_MSG).setCode(200).build())
- .build();
+ .setStatus(Status.newBuilder().setMessage(SUCCESS_MSG).setCode(200).build()).build();
}
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
index 5d25ac2bf..4179ccab0 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
@@ -50,15 +50,15 @@ import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.Notificati
import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
@RunWith(SpringRunner.class)
-@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class,
- BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class,
- SdcListenerConfiguration.class})
+@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, BluePrintProcesssorHandler.class,
+ SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, SdcListenerConfiguration.class})
@SpringBootTest(classes = {ListenerServiceImplTest.class})
public class ListenerServiceImplTest {
private static final String CSAR_SAMPLE = "src/test/resources/service-ServicePnfTest-csar.csar";
private static final String WRONG_CSAR_SAMPLE = "src/test/resources/wrong_csar_pattern.csar";
- private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
+ private static final String CBA_ZIP_PATH =
+ "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
private static final String ZIP_FILE = ".zip";
private static final String CSAR_FILE = ".csar";
private static final String DISTRIBUTION_ID = "1";
@@ -104,15 +104,15 @@ public class ListenerServiceImplTest {
// Arrange
Mockito.when(listenerDto.getDistributionId()).thenReturn(DISTRIBUTION_ID);
Mockito.when(listenerDto.getArtifactUrl()).thenReturn(URL);
- Mockito.doCallRealMethod().when(status)
- .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
+ Mockito.doCallRealMethod().when(status).sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL,
+ SDC_LISTENER_COMPONENT);
// Act
listenerService.extractBluePrint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString());
// Verify
- Mockito.verify(status)
- .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
+ Mockito.verify(status).sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL,
+ SDC_LISTENER_COMPONENT);
}
@Test
@@ -129,12 +129,7 @@ public class ListenerServiceImplTest {
}
private String checkFileExists(Path path) throws IOException {
- return Files.walk(path)
- .filter(Files :: isRegularFile)
- .map(Path :: toFile)
- .findAny()
- .get()
- .getName();
+ return Files.walk(path).filter(Files::isRegularFile).map(Path::toFile).findAny().get().getName();
}
public byte[] convertFileToByteArray(File file) {
@@ -146,11 +141,10 @@ public class ListenerServiceImplTest {
return null;
}
- public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl implements
- IDistributionClientDownloadResult {
+ public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl
+ implements IDistributionClientDownloadResult {
- public DistributionClientDownloadResultStubImpl() {
- }
+ public DistributionClientDownloadResultStubImpl() {}
public byte[] getArtifactPayload() {
File file = Paths.get(CSAR_SAMPLE).toFile();
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessageTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessageTest.java
index 898596dfa..c9abfe622 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessageTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessageTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2020 AT&T.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onap.ccsdk.cds.sdclistener.status;
import org.junit.Test;
@@ -11,7 +27,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ComponentStatusMessageTest.class})
public class ComponentStatusMessageTest {
- ComponentStatusMessage componentStatusMsg= new ComponentStatusMessage();
+ ComponentStatusMessage componentStatusMsg = new ComponentStatusMessage();
@Test
public void testComponentStatusMessage() {
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java
index a43e8c072..c368329e4 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java
@@ -35,6 +35,7 @@
*
*
*/
+
package org.onap.ccsdk.cds.sdclistener.util;
import org.junit.Test;
@@ -58,25 +59,25 @@ import static org.junit.Assert.*;
@SpringBootTest(classes = {FileUtilTest.class})
public class FileUtilTest {
- FileUtil fs;
+ FileUtil fs;
@Test
public void testDeleteFile() throws IOException {
File tempFile = File.createTempFile("tempFile", ".txt");
-// System.out.println(tempFile.getRoot());
- fs.deleteFile(tempFile,tempFile.getAbsolutePath());
+ // System.out.println(tempFile.getRoot());
+ fs.deleteFile(tempFile, tempFile.getAbsolutePath());
assertFalse(tempFile.exists());
}
@Test
- public void testGetFilesFromDisk() throws IOException{
+ public void testGetFilesFromDisk() throws IOException {
- Path resourceDirectory = Paths.get("src","test","resources");
- int totalfile=resourceDirectory.getNameCount();
- List fileList=fs.getFilesFromDisk(resourceDirectory);
+ Path resourceDirectory = Paths.get("src", "test", "resources");
+ int totalfile = resourceDirectory.getNameCount();
+ List fileList = fs.getFilesFromDisk(resourceDirectory);
assertNotNull(fileList);
- assertEquals(fileList.size(),totalfile);
+ assertEquals(fileList.size(), totalfile);
}
diff --git a/pom.xml b/pom.xml
index c2aecb3dd..6ffd34a88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,6 @@ limitations under the License.
<plugins>
<!--TODO: This plugin is broken. Find replacement-->
<!-- Plugin to Format/Validate POM Files -->
- <!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tidy-maven-plugin</artifactId>
@@ -109,13 +108,12 @@ limitations under the License.
</execution>
</executions>
</plugin>
- -->
<!-- Plugin to Format/Validate Kotlin Files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
+ <version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<id>validate-kotlin</id>
@@ -124,6 +122,7 @@ limitations under the License.
<target name="ktlint">
<java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
<arg value="src/**/*.kt"/>
+ <arg value="Scripts/**/*.kt"/>
</java>
</target>
<skip>${format.skipValidate}</skip>
@@ -133,7 +132,6 @@ limitations under the License.
</goals>
</execution>
<execution>
- <!-- Built-in formatter So that you wouldn't have to fix all style violations by hand.-->
<id>format-kotlin</id>
<phase>process-sources</phase>
<configuration>
@@ -141,6 +139,7 @@ limitations under the License.
<java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
<arg value="-F"/>
<arg value="src/**/*.kt"/>
+ <arg value="Scripts/**/*.kt"/>
</java>
</target>
<skip>${format.skipExecute}</skip>
@@ -154,10 +153,78 @@ limitations under the License.
<dependency>
<groupId>com.pinterest</groupId>
<artifactId>ktlint</artifactId>
- <version>0.35.0</version>
+ <version>0.39.0</version>
</dependency>
</dependencies>
</plugin>
+
+ <!-- Plugin to identify root path of the project -->
+ <plugin>
+ <groupId>org.commonjava.maven.plugins</groupId>
+ <artifactId>directory-maven-plugin</artifactId>
+ <version>0.3</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <id>directories</id>
+ <goals>
+ <goal>highest-basedir</goal>
+ </goals>
+ <configuration>
+ <property>baseDirPath</property>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Plugin to Format/Validate Java Classes -->
+ <plugin>
+ <groupId>net.revelc.code.formatter</groupId>
+ <artifactId>formatter-maven-plugin</artifactId>
+ <version>2.12.0</version>
+ <executions>
+ <execution>
+ <id>format-java</id>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <lineEnding>LF</lineEnding>
+ <skip>${format.skipExecute}</skip>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <configFile>${baseDirPath}/ONAP-Java-Code-Style.xml</configFile>
+ <includes>
+ <include>src/**/*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>validate-java</id>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <lineEnding>LF</lineEnding>
+ <skip>${format.skipValidate}</skip>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <configFile>${baseDirPath}/ONAP-Java-Code-Style.xml</configFile>
+ <includes>
+ <include>src/**/*.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson-bom.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -218,10 +285,22 @@ limitations under the License.
<version>${jacoco.version}</version>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tidy-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.commonjava.maven.plugins</groupId>
+ <artifactId>directory-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>net.revelc.code.formatter</groupId>
+ <artifactId>formatter-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>