Merge "Readonly screen for limits"
authorVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Wed, 1 Nov 2017 15:08:57 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 1 Nov 2017 15:08:57 +0000 (15:08 +0000)
112 files changed:
.gitignore
catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java
catalog-be/src/main/resources/config/error-configuration.yaml
catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.zip [new file with mode: 0644]
catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverter.java
catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/DataTypePropertyConverterTest.java
common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ConfigSourceLocationTest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/DynamicConfigurationTest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NodeSpecificCLITest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationForNodeConfigTest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/NotificationOnPropValTest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/UnregisterNotificationTest.java
common/openecomp-common-configuration-management/openecomp-configuration-management-test/src/test/java/org/openecomp/config/test/ValidateNodeConfigTest.java
common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-core/src/test/java/org/openecomp/sdc/generator/ArtifactGenerationServiceTest.java
common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp-heat/data.yml
docs/configuration.rst
docs/consumedapis.rst
docs/logging.rst
docs/offeredapis.rst
onboarding/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/impl/UploadValidationManagerImpl.java
openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/util/ValidationManagerUtil.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java
openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java
openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java [new file with mode: 0644]
openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java
openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationService.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java [new file with mode: 0644]
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/TranslatorErrorCodes.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/HeatFileAnalyzerRowDataImpl.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/OrchestrationTemplateFileExtensionErrorBuilder.java [new file with mode: 0644]
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java
openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
openecomp-ui/src/nfvo-components/modal/GlobalModal.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/processes/SoftwareProductComponentProcessesList.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js
pom.xml
sdc-os-chef/environments/Template.json
sdc-os-chef/pom.xml
sdc-os-chef/scripts/docker_run.sh
sdc-os-chef/sdc-backend/Dockerfile
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb [moved from sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb with 100% similarity]
sdc-os-chef/sdc-backend/chef-solo/roles/catalog-be.json
sdc-os-chef/sdc-backend/startup.sh
sdc-os-chef/sdc-frontend/Dockerfile
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vHSS.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vMME.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vSPGW.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/cscf_si_fixed.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ntas.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_aligned.csar
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_v3.0.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vSBC_aligned.csar [new file with mode: 0644]
sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb
sdc-os-chef/sdc-sanity/startup.sh
test-apis-ci/pom.xml
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java [new file with mode: 0644]
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
test-apis-ci/src/main/resources/ci/testSuites/onap.xml
ui-ci-dev/pom.xml
utils/webseal-simulator/sdc-simulator/Dockerfile

index 0174487..a8e24a1 100644 (file)
@@ -1,55 +1,74 @@
-# Eclipse
-.classpath
-.project
-.settings/
 
+!catalog-fe/src/main/webapp/META-INF/
+!catalog-fe/src/main/webapp/WEB-INF/
+# Eclipse
 # Maven
-log/
-target/
-
 # Package Files #
-*.jar
-*.war
+## sdc-os-chef
+*.class
 *.ear
-
-# Other
+*.iml
+*.jar
 *.kpf
-*.class
 *.orig
+*.war
+.classpath
+.delivery
+.idea/*
+.metadata/
+.metadata/*
+.project
+.settings/
+Vagrantfile
+a4c/
+asdc-chef/cookbooks/Deploy-SDandC/attributes/version.rb
+asdc-tests/ExtentReport/ASDC_CI_Extent_Report.html
+asdc-tests/test-output/**
+asdctool/tosca/*
+bin/
+catalog-be/.pydevproject
+catalog-be/.checkstyle
+catalog-be/.pydevproject
+catalog-be/bin/
+catalog-be/data/*
+catalog-be/src/main/java/META-INF/MANIFEST.MF
+catalog-be/test-output/*
+catalog-builders/bin/
+catalog-dao/bin/
+catalog-fe/bin
+catalog-fe/src/main/webapp/*
+catalog-ui/*.tmp.txt
 catalog-ui/.*
-catalog-ui/app/scripts/tsconfig.json
-catalog-ui/app/scripts/references.ts
-catalog-ui/app/scripts/**/*.js
-catalog-ui/app/scripts/**/*.js.map
-
-# catalog-ui
-catalog-ui/app/**/*.css
 catalog-ui/.editorconfig
 catalog-ui/.jshintrc
 catalog-ui/.yo-rc.json
+catalog-ui/Chrome*
+catalog-ui/PhantomJS_1.9.8_(Windows_7_0.0.0)/*
+catalog-ui/app/**/*.css
+catalog-ui/app/dist/*
 catalog-ui/app/robots.txt
-catalog-ui/node_modules/
-catalog-ui/bower_components/
+catalog-ui/app/scripts/**/*.js
+catalog-ui/app/scripts/**/*.js.map
+catalog-ui/app/scripts/references.ts
+catalog-ui/app/scripts/tsconfig.json
 catalog-ui/app/tsconfig.json
-
-
-catalog-be/.checkstyle
-catalog-be/bin/
-catalog-be/src/main/java/META-INF/MANIFEST.MF
-a4c/
-catalog-ui/*.tmp.txt
-catalog-dao/bin/
+catalog-ui/bower_components/
 catalog-ui/dist
-catalog-builders/bin/
+catalog-ui/node/*
+catalog-ui/node_modules/
+catalog-ui/npm-debug.log
+catalog-ui/tests/Coverage/*
 common-app-api/bin/
+common/openecomp-common-configuration-management/openecomp-configuration-management-cli/dependency-reduced-pom.xml
+common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-core/logs/*
 data/compute.png
 data/loadbalancer.png
 data/mysql.png
 data/network.png
+data/normative-types-DBMS.yml
 data/normative-types-blockStorage.yml
 data/normative-types-compute.yml
 data/normative-types-database.yml
-data/normative-types-DBMS.yml
 data/normative-types-network.yml
 data/normative-types-objectStorage.yml
 data/normative-types-root.yml
@@ -62,19 +81,6 @@ data/root.png
 data/router.png
 data/software.png
 data/volume.png
-catalog-ui/app/dist/*
-catalog-fe/src/main/webapp/*
-catalog-fe/bin
-!catalog-fe/src/main/webapp/WEB-INF/
-!catalog-fe/src/main/webapp/META-INF/
-ui-ci/.tern-project
-catalog-be/data/*
-.metadata/*
-.metadata/*
-.idea/*
-*.iml
-catalog-ui/npm-debug.log
-sdnc-tests/logs/wordnik.log
 distribution-ci/logs/wordnik.log
 distribution-ci/logs/wordnik.log.1
 distribution-ci/logs/wordnik.log.10
@@ -86,16 +92,45 @@ distribution-ci/logs/wordnik.log.6
 distribution-ci/logs/wordnik.log.7
 distribution-ci/logs/wordnik.log.8
 distribution-ci/logs/wordnik.log.9
-vagrant-asdc-all-in-one/
-catalog-ui/tests/Coverage/*
-catalog-ui/Chrome*
-catalog-ui/PhantomJS_1.9.8_(Windows_7_0.0.0)/*
-
-.metadata/
-bin/
-Vagrantfile
-sdnc-tests/test-output/*
+dox-sequence-diagram-ui/node/*
+log.home_IS_UNDEFINED/ASDC/ASDC-BE/Error.log
+log.home_IS_UNDEFINED/ASDC/ASDC-BE/audit.log
+log.home_IS_UNDEFINED/ASDC/ASDC-BE/debug.log
+log.home_IS_UNDEFINED/ASDC/ASDC-BE/debug_by_package.log
+log.home_IS_UNDEFINED/ASDC/ASDC-BE/transaction.log
+log/
+node/*
+openecomp-be/tools/swagger-ui/api-docs/api.html
+openecomp-be/tools/swagger-ui/api-docs/api.json
+openecomp-ui/node/*
+sdc-os-chef/.idea/*
+sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/Artifact-Generator.properties
+sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/ecomp-error-configuration.yaml
+sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
+sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/logback.xml
+sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/normatives.tar.gz
+sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb
+sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default
+sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/SDC-*.zip
+sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/sdctool.tar
+sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/tools/*
+sdc-os-chef/sdc-normatives/chef-repo/cookbooks/sdc-normatives/files/default/normatives.tar.gz
+sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/*
 sdnc-tests-new-frame-work/test-output/*
+sdnc-tests-new-frame-work/test-output/**
+sdnc-tests/logs/wordnik.log
+sdnc-tests/test-output/*
+target/
+test-apis-ci/ExtentReport/*
+test-apis-ci/ExtentReport/ASDC_CI_Extent_Report.html
+test-apis-ci/extent.html
+test-apis-ci/logfile.log*
+test-apis-ci/test-output/*
+ui-ci/.tern-project
+ui-ci/ExtentReport/*
+ui-ci/logfile.log*
+ui-ci/src/main/resources/Files/output/*
+ui-ci/src/main/resources/Files/outputMainServiceTemplate/*
 ui-ci/test-output/*
 ui-ci/test-output/Default suite/Default test.html
 ui-ci/test-output/Default suite/Default test.xml
@@ -103,71 +138,12 @@ ui-ci/test-output/Default suite/testng-failed.xml
 ui-ci/test-output/emailable-report.html
 ui-ci/test-output/index.html
 ui-ci/test-output/old/Default suite/classes.html
-ui-ci/test-output/old/Default suite/methods.html
 ui-ci/test-output/old/Default suite/methods-alphabetical.html
+ui-ci/test-output/old/Default suite/methods.html
 ui-ci/test-output/old/Default suite/testng.xml.html
 ui-ci/test-output/old/Default suite/toc.html
 ui-ci/test-output/old/index.html
 ui-ci/test-output/testng-failed.xml
 ui-ci/test-output/testng-results.xml
-ui-ci/src/main/resources/Files/outputMainServiceTemplate/*
-ui-ci/src/main/resources/Files/output/*
-
-sdnc-tests-new-frame-work/test-output/**
-asdc-tests/test-output/**
-
-asdc-chef/cookbooks/Deploy-SDandC/attributes/version.rb
-asdc-tests/ExtentReport/ASDC_CI_Extent_Report.html
-*.orig
-test-apis-ci/ExtentReport/*
-test-apis-ci/test-output/*
-test-apis-ci/test-output/*
-test-apis-ci/ExtentReport/*
-ui-ci/ExtentReport/*
-test-apis-ci/test-output/*
-test-apis-ci/ExtentReport/ASDC_CI_Extent_Report.html
-test-apis-ci/extent.html
-sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/normatives.tar.gz
-sdc-os-chef/sdc-normatives/chef-repo/cookbooks/sdc-normatives/files/default/normatives.tar.gz
-catalog-be/test-output/*
-test-apis-ci/logfile.log*
-ui-ci/logfile.log*
-catalog-ui/node/*
-log.home_IS_UNDEFINED/ASDC/ASDC-BE/audit.log
-log.home_IS_UNDEFINED/ASDC/ASDC-BE/debug.log
-log.home_IS_UNDEFINED/ASDC/ASDC-BE/debug_by_package.log
-log.home_IS_UNDEFINED/ASDC/ASDC-BE/Error.log
-log.home_IS_UNDEFINED/ASDC/ASDC-BE/transaction.log
-openecomp-be/tools/swagger-ui/api-docs/api.html
-openecomp-be/tools/swagger-ui/api-docs/api.json
-dox-sequence-diagram-ui/node/*
-openecomp-ui/node/*
-sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/SDC-*.zip
-sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/sdctool.tar
-sdc-os-chef/.idea/*
-node/*
-
-# chef
-.delivery
-
-common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-core/logs/*
-
-/asdctool/tosca/*
-
-/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/Artifact-Generator.properties
-/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/ecomp-error-configuration.yaml
-/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
-/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/logback.xml
-
-/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/logback.xml
-sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/*
-
-/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb
-
-
-/common/openecomp-common-configuration-management/openecomp-configuration-management-cli/dependency-reduced-pom.xml
-
-/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/tools/*
-/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb
-
-/catalog-be/.pydevproject
+utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/logback.xml
+vagrant-asdc-all-in-one/
index 6e971f2..b995606 100644 (file)
@@ -243,8 +243,13 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
                ComponentTypeEnum componentType = ComponentTypeEnum.findByParamName(assetType);
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, instanceIdHeader);
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, requestURI);
-               additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, componentType.getValue());
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, uuid);
+               if (componentType == null) {
+                       log.debug("getMetaData: assetType parameter {} is not valid", assetType);
+                       responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT);
+                       return buildErrorResponse(responseFormat);
+               }
+               additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, componentType.getValue());
 
                // Mandatory
                if (instanceIdHeader == null || instanceIdHeader.isEmpty()) {
@@ -331,8 +336,15 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
                EnumMap<AuditingFieldsKeysEnum, Object> additionalParam = new EnumMap<AuditingFieldsKeysEnum, Object>(AuditingFieldsKeysEnum.class);
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, instanceIdHeader);
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, url);
-               additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, componentType.getValue());
                additionalParam.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID, uuid);
+               
+               if (componentType == null) {
+                       log.debug("getToscaModel: assetType parameter {} is not valid", assetType);
+                       responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT);
+                       return buildErrorResponse(responseFormat);
+               }
+               additionalParam.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, componentType.getValue());
+
 
                if (instanceIdHeader == null || instanceIdHeader.isEmpty()) {
                        log.debug("getToscaModel: Missing X-ECOMP-InstanceID header");
index 646a7ec..22f6730 100644 (file)
 
 package org.openecomp.sdc.be.tosca;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-import com.google.gson.stream.JsonReader;
-import fj.data.Either;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.lang3.StringUtils;
 import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
 import org.openecomp.sdc.be.model.Component;
@@ -41,10 +41,12 @@ import org.openecomp.sdc.be.tosca.model.ToscaProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+import com.google.gson.stream.JsonReader;
+
+import fj.data.Either;
 
 public class PropertyConvertor {
        private static PropertyConvertor instance;
@@ -72,10 +74,8 @@ public class PropertyConvertor {
 
                                // take only the properties of this resource
                                props.stream().filter(p -> p.getOwnerId() == null || p.getOwnerId().equals(component.getUniqueId())).forEach(property -> {
-                                       ToscaProperty prop = convertProperty(dataTypes, property, false);
-
-                                       properties.put(property.getName(), prop);
-                               });
+                    properties.put(property.getName(), convertProperty(dataTypes, property, false));
+                               });
                                if (!properties.isEmpty()) {
                                        toscaNodeType.setProperties(properties);
                                }
@@ -97,14 +97,18 @@ public class PropertyConvertor {
                        prop.setEntry_schema(eschema);
                }
                log.trace("try to convert property {} from type {} with default value [{}]", property.getName(), property.getType(), property.getDefaultValue());
-               prop.setDefaultp(convertToToscaObject(property.getType(), property.getDefaultValue(), innerType, dataTypes));
+        Object convertedObj = convertToToscaObject(property.getType(), property.getDefaultValue(), innerType, dataTypes);
+        if (convertedObj != null) {
+            prop.setDefaultp(convertedObj);
+        }
                prop.setType(property.getType());
-               prop.setDescription(property.getDescription());
-               if (isCapabiltyProperty) {
-                       prop.setStatus(property.getStatus());
-                       prop.setRequired(property.isRequired());
-               }
-               return prop;
+        prop.setDescription(property.getDescription());
+        if (isCapabiltyProperty) {
+            prop.setStatus(property.getStatus());
+            prop.setRequired(property.isRequired());
+        }
+        return prop;
+
        }
 
        public Object convertToToscaObject(String propertyType, String value, String innerType, Map<String, DataTypeDefinition> dataTypes) {
@@ -114,7 +118,6 @@ public class PropertyConvertor {
                        if(StringUtils.isEmpty(value)){
                                return null;
                        }
-
                }
                try {
                        ToscaMapValueConverter mapConverterInst = ToscaMapValueConverter.getInstance();
index 62bd720..fbf397a 100644 (file)
@@ -411,6 +411,7 @@ errors:
         message: "Error: Invalid Content. Missing Capability Type '%1'.",
         messageId: "SVC4115"
     }
+#-----------SVC4116---------------------------
     RESOURCE_INSTANCE_BAD_REQUEST: {
         code: 400,
         message: "Error: Invalid Content.",
@@ -1186,7 +1187,6 @@ errors:
         message: "Error: Invalid occurrences format.",
         messageId: "SVC4585"
     }
-#---------SVC4586------------------------------
 #---------SVC4586------------------------------
     INVALID_SERVICE_API_URL: {
         code: 400,
diff --git a/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.json b/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.json
new file mode 100644 (file)
index 0000000..143f623
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "payloadName": "allottedResource.yml",
+  "contactId": "jh0003",
+  "name": "AllottedResource",
+  "description": "Allotted Resource base type all other allotted resources node types derive from",
+  "resourceIconPath": "defaulticon",
+  "categories": [
+  {
+    "name": "Allotted Resource",
+    "subcategories": [
+      {
+        "name": "Allotted Resource"
+      }
+    ]
+  }
+],
+  "tags": [
+    "AllottedResource"
+  ]
+}
\ No newline at end of file
diff --git a/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.yml b/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.yml
new file mode 100644 (file)
index 0000000..00d3bd2
--- /dev/null
@@ -0,0 +1,38 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+  org.openecomp.resource.vfc.AllottedResource:
+    derived_from: tosca.nodes.Root
+    description: ECOMP Allotted Resource base type all other allotted resources node types derive from
+    properties:
+      providing_service_uuid:
+        type: string
+        required: true
+        description: The depending service uuid in order to map the allotted resource to the specific service version
+      providing_service_invariant_uuid:
+        type: string
+        required: true
+        description: The depending service invariant uuid in order to map the allotted resource to the specific service version
+      providing_service_name:
+        type: string
+        required: true
+        description: The depending service name in order to map the allotted resource to the specific service version
+      role:
+        type: string
+        required: true
+        description: Unique label that defines the role that this allotted resource performs
+      min_instances:
+        type: integer
+        default: 1
+      max_instances:
+        type: integer
+        default: 1
+      target_network_role:
+        type: string
+        required: true
+        description: Target network role
+    requirements:
+    - service_dependency:
+        capability: org.openecomp.capabilities.AllottedResource
+        relationship: tosca.relationships.DependsOn
+        node: tosca.services.Root
+
diff --git a/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.zip b/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.zip
new file mode 100644 (file)
index 0000000..fd3f7e9
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/normative-types/allottedResource/allottedResource.zip differ
index d47c0b8..1f52385 100644 (file)
@@ -84,7 +84,7 @@ def usage():
 
 def importNormativeTypes(beHost, bePort, adminUser, fileDir, updateversion):
        
-       normativeTypes = [ "root", "compute", "softwareComponent", "webServer", "webApplication", "DBMS", "database", "objectStorage", "blockStorage", "containerRuntime", "containerApplication", "loadBalancer", "port", "network"]
+       normativeTypes = [ "root", "compute", "softwareComponent", "webServer", "webApplication", "DBMS", "database", "objectStorage", "blockStorage", "containerRuntime", "containerApplication", "loadBalancer", "port", "network", "allottedResource"]
        #normativeTypes = [ "root" ]
        responseCodes = [200, 201]
        
index 664c5cc..18d2270 100644 (file)
@@ -26,12 +26,12 @@ def importOnapTypes(beHost, bePort, adminUser, fileDir, updateversion):
                      "extZteCP",
                      "extZteVDU",
                      "extZteVL",
+                     "NSD",
+                                 "VDU",
                      "vduCompute",
                                  "vduCpd",
                                  "vduVirtualStorage",
-                                 "vnfVirtualLinkDesc",
-                                 "NSD",
-                                 "VDU"
+                                 "vnfVirtualLinkDesc"
                                  ]
                
        responseCodes = [200, 201]
index e6f1ac8..c77c0f1 100644 (file)
 package org.openecomp.sdc.be.tosca;
 
-import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import javax.annotation.Generated;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
+import org.junit.Before;
 import org.junit.Test;
-import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
 import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
 import org.openecomp.sdc.be.tosca.model.ToscaProperty;
 
 import fj.data.Either;
 
 public class PropertyConvertorTest {
+    private PropertyDefinition property;
+    Map<String, DataTypeDefinition> dataTypes;
 
-       private PropertyConvertor createTestSubject() {
-               return new PropertyConvertor();
-       }
-
-       
-       @Test
-       public void testGetInstance() throws Exception {
-               PropertyConvertor result;
-
-               // default test
-               result = PropertyConvertor.getInstance();
-       }
+    @Before
+    public void setUp(){
+        property = new PropertyDefinition();
+        property.setName("myProperty");
+        property.setType(ToscaPropertyType.INTEGER.getType());
+        dataTypes = new HashMap<String, DataTypeDefinition>();
+        dataTypes.put(property.getName(), new DataTypeDefinition());
+    }
 
-       
-       @Test
-       public void testConvertProperties() throws Exception {
-               PropertyConvertor testSubject;
-               Component component = null;
-               ToscaNodeType toscaNodeType = null;
-               Map<String, DataTypeDefinition> dataTypes = null;
-               Either<ToscaNodeType, ToscaError> result;
 
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.convertProperties(component, toscaNodeType, dataTypes);
-       }
+    @Test
+    public void convertPropertyWhenValueAndDefaultNull() {
+        ToscaProperty prop = PropertyConvertor.getInstance().convertProperty(dataTypes, property, false);
+        assertNotNull(prop);
+        assertNull(prop.getDefaultp());
+    }
 
-       
-       @Test
-       public void testConvertProperty() throws Exception {
-               PropertyConvertor testSubject;
-               Map<String, DataTypeDefinition> dataTypes = null;
-               PropertyDefinition property = null;
-               boolean isCapabiltyProperty = false;
-               ToscaProperty result;
+    @Test
+    public void convertPropertyWhenValueNullAndDefaultNotEmpty() {
+        final String def = "1";
+        property.setDefaultValue(def);
+        ToscaProperty result = PropertyConvertor.getInstance().convertProperty(dataTypes, property, false);
+        assertNotNull(result);
+        assertEquals(Integer.valueOf(def).intValue(), result.getDefaultp());
+    }
 
-               // default test
-               testSubject = createTestSubject();
-       }
+    @Test
+    public void convertPropertiesWhenValueAndDefaultNullInOne() {
+        PropertyDefinition property1 = new PropertyDefinition();
+        property1.setName("otherProperty");
+        property1.setType(ToscaPropertyType.INTEGER.getType());
+        property1.setDefaultValue("2");
+        dataTypes.put(property1.getName(), new DataTypeDefinition());
+        Resource resource = new Resource();
+        List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>();
+        properties.add(property);
+        properties.add(property1);
+        resource.setProperties(properties);
+        Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+        assertTrue(result.isLeft());
+        assertEquals(2, result.left().value().getProperties().size());
+        int cnt = 0;
+        for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
+            ToscaProperty prop = it.next();
+            if (prop.getDefaultp() == null) {
+                cnt++;
+            }
+        }
+        assertEquals(1, cnt);
+    }
 
-       
-       @Test
-       public void testConvertToToscaObject() throws Exception {
-               PropertyConvertor testSubject;
-               String propertyType = "";
-               String value = "";
-               String innerType = "";
-               Map<String, DataTypeDefinition> dataTypes = null;
-               Object result;
+    @Test
+    public void convertPropertiesWhenValueAndDefaultExist() {
+        PropertyDefinition property1 = new PropertyDefinition();
+        property1.setName("otherProperty");
+        property1.setType(ToscaPropertyType.INTEGER.getType());
+        property1.setDefaultValue("2");
+        property.setDefaultValue("1");
+        dataTypes.put(property1.getName(), new DataTypeDefinition());
+        Resource resource = new Resource();
+        List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>();
+        properties.add(property);
+        properties.add(property1);
+        resource.setProperties(properties);
+        Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+        assertTrue(result.isLeft());
+        assertEquals(2, result.left().value().getProperties().size());
+        for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
+            ToscaProperty prop = it.next();
+            assertNotNull(prop.getDefaultp());
+        }
+    }
 
-               // default test
-               testSubject = createTestSubject();
-       }
-}
\ No newline at end of file
+    @Test
+    public void convertPropertiesWhenValueAndDefaultNullInAll() {
+        PropertyDefinition property1 = new PropertyDefinition();
+        property1.setName("otherProperty");
+        property1.setType(ToscaPropertyType.INTEGER.getType());
+        dataTypes.put(property1.getName(), new DataTypeDefinition());
+        Resource resource = new Resource();
+        List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>();
+        properties.add(property);
+        properties.add(property1);
+        resource.setProperties(properties);
+        Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+        assertTrue(result.isLeft());
+        assertEquals(2, result.left().value().getProperties().size());
+        for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
+            ToscaProperty prop = it.next();
+            assertNull(prop.getDefaultp());
+        }
+     }
+}
index 2d389f5..f3b842e 100644 (file)
@@ -35,7 +35,7 @@ public class DataTypePropertyConverter {
      */
     public String getDataTypePropertiesDefaultValuesRec(String propertyDataType, Map<String, DataTypeDefinition> dataTypes) {
         JsonObject defaultValues = getDataTypePropsDefaultValuesRec(propertyDataType, dataTypes);
-        return !defaultValues.isJsonNull() ? gson.toJson(defaultValues) : null;
+        return !JsonUtils.isJsonNullOrEmpty(defaultValues) ? gson.toJson(defaultValues) : null;
     }
 
     /**
index ebb7566..e15d784 100644 (file)
@@ -1,8 +1,5 @@
 package org.openecomp.sdc.be.model.tosca.converters;
 
-import static org.junit.Assert.*;
-
-import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import org.junit.Before;
 import org.junit.Test;
@@ -16,226 +13,175 @@ import java.util.HashMap;
 import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.util.*;
-import org.junit.Assert;
+import static org.junit.Assert.assertNull;
 
 public class DataTypePropertyConverterTest {
 
-       private static final String EMPTY_JSON_STR = "{}";
-       public static final String PROPERTY2_DEFAULT = "{\"prop1\":\"def1\",\"prop3\":\"def3\"}";
-       private DataTypePropertyConverter testInstance = DataTypePropertyConverter.getInstance();
-       private Map<String, DataTypeDefinition> dataTypes;
-       private DataTypeDefinition noDefaultValue, dataType1, dataType2, dataType3;
-       private PropertyDefinition prop1, prop2, prop3, noDefaultProp;
-
-       @Before
-       public void setUp() throws Exception {
-               dataTypes = new HashMap<>();
-
-               prop1 = new PropertyDefinition();
-               prop1.setDefaultValue("def1");
-               prop1.setName("prop1");
-
-               prop2 = new PropertyDefinition();
-               prop2.setType("dataType1");
-               prop2.setName("prop2");
-
-               prop3 = new PropertyDefinition();
-               prop3.setDefaultValue("def3");
-               prop3.setName("prop3");
-
-               noDefaultProp = new PropertyDefinition();
-               noDefaultProp.setName("noDefaultProp");
-
-               noDefaultValue = new DataTypeDefinition();
-               noDefaultValue.setProperties(Collections.singletonList(noDefaultProp));
-
-               dataType1 = new DataTypeDefinition();
-               dataType1.setProperties(Arrays.asList(prop1, prop3));
-
-               dataType2 = new DataTypeDefinition();
-               dataType2.setDerivedFrom(dataType1);
-
-               dataType3 = new DataTypeDefinition();
-               dataType3.setProperties(Collections.singletonList(prop2));
-               dataType3.setDerivedFrom(noDefaultValue);
-
-               dataTypes.put("noDefault", noDefaultValue);
-               dataTypes.put("dataType1", dataType1);
-               dataTypes.put("dataType2", dataType2);
-               dataTypes.put("dataType3", dataType3);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_dataTypeNotExist() throws Exception {
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("someType", dataTypes);
-               assertEquals(EMPTY_JSON_STR, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_NoDefaultValue() throws Exception {
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("noDefault", dataTypes);
-               assertEquals(EMPTY_JSON_STR, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec() throws Exception {
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType1", dataTypes);
-               assertEquals(PROPERTY2_DEFAULT, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_defaultFromDerivedDataType_derivedDataTypeHasNoDefaults()
-                       throws Exception {
-               dataType2.setDerivedFrom(noDefaultValue);
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType2", dataTypes);
-               assertEquals(EMPTY_JSON_STR, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_defaultFromDerivedDataType() throws Exception {
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType2", dataTypes);
-               assertEquals(PROPERTY2_DEFAULT, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_defaultFromDataTypesOfProperties_dataTypeOfPropertyHasNoDefault()
-                       throws Exception {
-               dataType3.getProperties().get(0).setType(noDefaultValue.getName());
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType3", dataTypes);
-               assertEquals(EMPTY_JSON_STR, defaultValue);
-       }
-
-       @Test
-       public void testGetPropertyDefaultValuesRec_defaultFromDataTypesOfProperties() throws Exception {
-               String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType3", dataTypes);
-               assertEquals("{\"prop2\":" + PROPERTY2_DEFAULT + "}", defaultValue);// data
-                                                                                                                                                       // type
-                                                                                                                                                       // 3
-                                                                                                                                                       // has
-                                                                                                                                                       // property
-                                                                                                                                                       // prop2
-                                                                                                                                                       // which
-                                                                                                                                                       // has
-                                                                                                                                                       // a
-                                                                                                                                                       // data
-                                                                                                                                                       // type
-                                                                                                                                                       // with
-                                                                                                                                                       // property
-                                                                                                                                                       // prop1
-                                                                                                                                                       // which
-                                                                                                                                                       // has
-                                                                                                                                                       // a
-                                                                                                                                                       // default
-                                                                                                                                                       // value
-       }
-
-       @Test
-       public void testMergeDefaultValues_allDefaultValuesAreOverridden() throws Exception {
-               JsonObject value = new JsonObject();
-               value.addProperty(noDefaultProp.getName(), "override1");
-
-               JsonObject prop1Val = new JsonObject();
-               prop1Val.addProperty(prop1.getName(), "prop1Override");
-
-               JsonObject prop3Val = new JsonObject();
-               prop3Val.addProperty(prop3.getName(), "prop3Override");
-
-               JsonObject prop2Value = new JsonObject();
-               prop2Value.add(prop3.getName(), prop3Val);
-               prop2Value.add(prop1.getName(), prop1Val);
-
-               value.add(prop2.getName(), prop2Value);
-
-               String valBeforeMerge = value.toString();
-
-               testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
-               assertEquals(valBeforeMerge, value.toString());
-       }
-
-       @Test
-       public void testMergeDefaultValues() throws Exception {
-               JsonObject value = new JsonObject();
-               value.addProperty(noDefaultProp.getName(), "override1");
-
-               JsonObject prop1Val = new JsonObject();
-               prop1Val.addProperty(prop1.getName(), "prop1Override");
-
-               value.add(prop2.getName(), prop1Val);
-
-               testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
-
-               assertEquals("{\"noDefaultProp\":\"override1\",\"prop2\":{\"prop1\":\"prop1Override\",\"prop3\":\"def3\"}}",
-                               value.toString());// expect to merge prop 3 default as it was
-                                                                       // not overridden
-       }
-
-       @Test
-       public void testMergeDefaultValues_mergeAll() throws Exception {
-               JsonObject value = new JsonObject();
-               testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
-
-               assertEquals("{\"prop2\":" + PROPERTY2_DEFAULT + "}", value.toString());// expect
-                                                                                                                                                               // to
-                                                                                                                                                               // merge
-                                                                                                                                                               // prop
-                                                                                                                                                               // 3
-                                                                                                                                                               // default
-                                                                                                                                                               // as
-                                                                                                                                                               // it
-                                                                                                                                                               // was
-                                                                                                                                                               // not
-                                                                                                                                                               // overridden
-       }
-
-       @Test
-       public void testMergeDefaultValues_doNotAddDefaultsForGetInputValues() throws Exception {
-
-               JsonObject getInputValue = new JsonObject();
-               getInputValue.addProperty("get_input", "in1");
-
-               JsonObject value = new JsonObject();
-               value.add(prop2.getName(), getInputValue);
-
-               testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
-
-               assertEquals("{\"prop2\":{\"get_input\":\"in1\"}}", value.toString());
-       }
-
-       @Test
-       public void testMergeDefaultValues_doNotAddDefaultsForGetInputInnerValues() throws Exception {
-               JsonObject getInputValue = new JsonObject();
-               getInputValue.addProperty("get_input", "in1");
+    private static final String EMPTY_JSON_STR = "{}";
+    public static final String PROPERTY2_DEFAULT = "{\"prop1\":\"def1\",\"prop3\":\"def3\"}";
+    private DataTypePropertyConverter testInstance = DataTypePropertyConverter.getInstance();
+    private Map<String, DataTypeDefinition> dataTypes;
+    private DataTypeDefinition noDefaultValue, dataType1, dataType2, dataType3;
+    private PropertyDefinition prop1, prop2, prop3, noDefaultProp;
+
+    @Before
+    public void setUp() throws Exception {
+        dataTypes = new HashMap<>();
+
+        prop1 = new PropertyDefinition();
+        prop1.setDefaultValue("def1");
+        prop1.setName("prop1");
+
+        prop2 = new PropertyDefinition();
+        prop2.setType("dataType1");
+        prop2.setName("prop2");
+
+        prop3 = new PropertyDefinition();
+        prop3.setDefaultValue("def3");
+        prop3.setName("prop3");
+
+        noDefaultProp = new PropertyDefinition();
+        noDefaultProp.setName("noDefaultProp");
+
+        noDefaultValue = new DataTypeDefinition();
+        noDefaultValue.setProperties(Collections.singletonList(noDefaultProp));
+
+        dataType1 = new DataTypeDefinition();
+        dataType1.setProperties(Arrays.asList(prop1, prop3));
+
+        dataType2 = new DataTypeDefinition();
+        dataType2.setDerivedFrom(dataType1);
+
+        dataType3 = new DataTypeDefinition();
+        dataType3.setProperties(Collections.singletonList(prop2));
+        dataType3.setDerivedFrom(noDefaultValue);
+
+        dataTypes.put("noDefault", noDefaultValue);
+        dataTypes.put("dataType1", dataType1);
+        dataTypes.put("dataType2", dataType2);
+        dataTypes.put("dataType3", dataType3);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_dataTypeNotExist() throws Exception {
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("someType", dataTypes);
+        assertNull(defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_NoDefaultValue() throws Exception {
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("noDefault", dataTypes);
+        assertNull(defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec() throws Exception {
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType1", dataTypes);
+        assertEquals(PROPERTY2_DEFAULT, defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_defaultFromDerivedDataType_derivedDataTypeHasNoDefaults() throws Exception {
+        dataType2.setDerivedFrom(noDefaultValue);
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType2", dataTypes);
+        assertNull(defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_defaultFromDerivedDataType() throws Exception {
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType2", dataTypes);
+        assertEquals(PROPERTY2_DEFAULT, defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_defaultFromDataTypesOfProperties_dataTypeOfPropertyHasNoDefault() throws Exception {
+        dataType3.getProperties().get(0).setType(noDefaultValue.getName());
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType3", dataTypes);
+        assertNull(defaultValue);
+    }
+
+    @Test
+    public void testGetPropertyDefaultValuesRec_defaultFromDataTypesOfProperties() throws Exception {
+        String defaultValue = testInstance.getDataTypePropertiesDefaultValuesRec("dataType3", dataTypes);
+        assertEquals("{\"prop2\":" + PROPERTY2_DEFAULT + "}", defaultValue);//data type 3 has property prop2 which has a data type with property prop1 which has a default value
+    }
+
+    @Test
+    public void testMergeDefaultValues_allDefaultValuesAreOverridden() throws Exception {
+        JsonObject value = new JsonObject();
+        value.addProperty(noDefaultProp.getName(), "override1");
+
+        JsonObject prop1Val = new JsonObject();
+        prop1Val.addProperty(prop1.getName(), "prop1Override");
+
+        JsonObject prop3Val = new JsonObject();
+        prop3Val.addProperty(prop3.getName(), "prop3Override");
+
+        JsonObject prop2Value = new JsonObject();
+        prop2Value.add(prop3.getName(), prop3Val);
+        prop2Value.add(prop1.getName(), prop1Val);
+
+        value.add(prop2.getName(), prop2Value);
+
+        String valBeforeMerge = value.toString();
+
+        testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
+        assertEquals(valBeforeMerge, value.toString());
+    }
+
+    @Test
+    public void testMergeDefaultValues() throws Exception {
+        JsonObject value = new JsonObject();
+        value.addProperty(noDefaultProp.getName(), "override1");
+
+        JsonObject prop1Val = new JsonObject();
+        prop1Val.addProperty(prop1.getName(), "prop1Override");
+
+        value.add(prop2.getName(), prop1Val);
+
+        testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
+
+        assertEquals("{\"noDefaultProp\":\"override1\",\"prop2\":{\"prop1\":\"prop1Override\",\"prop3\":\"def3\"}}",
+                      value.toString());//expect to merge prop 3 default as it was not overridden
+    }
+
+    @Test
+    public void testMergeDefaultValues_mergeAll() throws Exception {
+        JsonObject value = new JsonObject();
+        testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
 
-               JsonObject prop1Val = new JsonObject();
-               prop1Val.add(prop1.getName(), getInputValue);
+        assertEquals("{\"prop2\":" + PROPERTY2_DEFAULT + "}",
+                     value.toString());//expect to merge prop 3 default as it was not overridden
+    }
 
-               JsonObject value = new JsonObject();
-               value.add(prop2.getName(), prop1Val);
+    @Test
+    public void testMergeDefaultValues_doNotAddDefaultsForGetInputValues() throws Exception {
 
-               testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
+        JsonObject getInputValue = new JsonObject();
+        getInputValue.addProperty("get_input", "in1");
 
-               assertEquals("{\"prop2\":{\"prop1\":{\"get_input\":\"in1\"},\"prop3\":\"def3\"}}", value.toString());
+        JsonObject value = new JsonObject();
+        value.add(prop2.getName(), getInputValue);
 
-       }
+        testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
 
-       private DataTypePropertyConverter createTestSubject() {
-               return DataTypePropertyConverter.getInstance();
-       }
+        assertEquals("{\"prop2\":{\"get_input\":\"in1\"}}", value.toString());
+    }
 
-       
-       @Test
-       public void testGetInstance() throws Exception {
-               DataTypePropertyConverter result;
+    @Test
+    public void testMergeDefaultValues_doNotAddDefaultsForGetInputInnerValues() throws Exception {
+        JsonObject getInputValue = new JsonObject();
+        getInputValue.addProperty("get_input", "in1");
 
-               // default test
-               result = DataTypePropertyConverter.getInstance();
-       }
+        JsonObject prop1Val = new JsonObject();
+        prop1Val.add(prop1.getName(), getInputValue);
 
-       
+        JsonObject value = new JsonObject();
+        value.add(prop2.getName(), prop1Val);
 
+        testInstance.mergeDataTypeDefaultValuesWithPropertyValue(value, "dataType3", dataTypes);
 
-       
+        assertEquals("{\"prop2\":{\"prop1\":{\"get_input\":\"in1\"},\"prop3\":\"def3\"}}", value.toString());
 
+    }
 }
index 367b806..9022e72 100644 (file)
@@ -54,5 +54,8 @@ public class JsonUtils {
        public static boolean isEmptyJson(JsonElement json) {
                return json.isJsonPrimitive() ? false : JsonUtils.isEmptyJson(json.getAsJsonObject());
        }
-
+       
+       public static boolean isJsonNullOrEmpty(JsonObject json) {
+               return json.isJsonNull() || isEmptyJson(json);
+       }
 }
index 7eb591c..731826b 100644 (file)
@@ -33,10 +33,10 @@ public class ConfigSourceLocationTest {
         Properties props = new Properties();
         props.setProperty("maxCachedBufferSize", "1024");
         props.setProperty("artifact.maxsize", "1024");
-        File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Config Property at Conventional Resource");
-        out.close();
+        File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Config Property at Conventional Resource");
+        }
     }
 
     @Test
index 1ca41f8..2140e84 100644 (file)
@@ -39,10 +39,10 @@ public class DynamicConfigurationTest {
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "20");
         props.setProperty("_config.namespace",NAMESPACE);
         props.setProperty("_config.mergeStrategy","override");
-        File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Override Config Property at Conventional Resource");
-        out.close();
+        File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Override Config Property at Conventional Resource");
+        }
 
         //Verify configuration with Configuration without wait. This should fetch cached value
         Assert.assertEquals("14" , config.getAsString(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH));
@@ -60,7 +60,7 @@ public class DynamicConfigurationTest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 }
index 795780b..43729cb 100644 (file)
@@ -51,10 +51,10 @@ public class NodeSpecificCLITest {
         Properties props = new Properties();
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "50");
         props.setProperty("_config.namespace",NAMESPACE);
-        File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Node Config Property");
-        out.close();
+        File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Node Config Property");
+        }
 
         Thread.sleep(35000);
 
@@ -86,7 +86,7 @@ public class NodeSpecificCLITest {
 
         //Verify maxlength on other nodes by deleting node specific configuration
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
 
         Thread.sleep(35000);
@@ -103,7 +103,7 @@ public class NodeSpecificCLITest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 
index 3d1579e..9d71910 100644 (file)
@@ -25,7 +25,7 @@ import java.util.Properties;
 public class NotificationForNodeConfigTest {
     public final static String NAMESPACE = "NotificationForNodeConfig";
 
-    public String updatedValue = null;
+    private String updatedValue = null;
 
     @Before
     public void setUp() throws IOException {
@@ -42,10 +42,10 @@ public class NotificationForNodeConfigTest {
         Properties props = new Properties();
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "30");
         props.setProperty("_config.namespace",NAMESPACE);
-        File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Node Config Property");
-        out.close();
+        File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Node Config Property");
+        }
 
         Thread.sleep(35000);
 
@@ -55,9 +55,9 @@ public class NotificationForNodeConfigTest {
         config.addConfigurationChangeListener(NAMESPACE, ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, new NodePropValListener());
 
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "80");
-        out = new FileOutputStream( f );
-        props.store(out, "Updated Node Config Property");
-        out.close();
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Updated Node Config Property");
+        }
 
         Thread.sleep(35000);
 
@@ -79,7 +79,7 @@ public class NotificationForNodeConfigTest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 }
index 8a46150..7354cd1 100644 (file)
@@ -25,7 +25,7 @@ public class NotificationOnPropValTest {
 
     public final static String NAMESPACE = "NotificationOnPropVal";
 
-    public String updatedValue = null;
+    private String updatedValue = null;
 
     @Before
     public void setUp() throws IOException {
@@ -45,10 +45,10 @@ public class NotificationOnPropValTest {
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "20");
         props.setProperty("_config.namespace",NAMESPACE);
         props.setProperty("_config.mergeStrategy","override");
-        File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Override Config Property at Conventional Resource");
-        out.close();
+        File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Override Config Property at Conventional Resource");
+        }
 
         Thread.sleep(35000);
 
@@ -70,7 +70,7 @@ public class NotificationOnPropValTest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 }
index a53f3c2..e387f13 100644 (file)
@@ -25,7 +25,7 @@ import java.util.Properties;
 public class UnregisterNotificationTest {
     public final static String NAMESPACE = "UnregisterNotification";
 
-    public String updatedValue = null;
+    private String updatedValue = null;
 
     @Before
     public void setUp() throws IOException {
@@ -70,9 +70,9 @@ public class UnregisterNotificationTest {
         props.setProperty("_config.namespace",NAMESPACE);
         props.setProperty("_config.mergeStrategy","override");
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Override Config Property at Conventional Resource");
-        out.close();
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Override Config Property at Conventional Resource");
+        }
     }
 
     private class PropertyListener implements ConfigurationChangeListener {
@@ -88,7 +88,7 @@ public class UnregisterNotificationTest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 }
index 03a6786..8f7d703 100644 (file)
@@ -40,9 +40,9 @@ public class ValidateNodeConfigTest {
         props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "56");
         props.setProperty("_config.namespace","ValidateNodeConfig");
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
-        OutputStream out = new FileOutputStream( f );
-        props.store(out, "Node Config Property");
-        out.close();
+        try (OutputStream out = new FileOutputStream(f)) {
+            props.store(out, "Node Config Property");
+        }
 
         System.out.println(System.getProperty("node.config.location"));
 
@@ -73,7 +73,7 @@ public class ValidateNodeConfigTest {
         TestUtil.cleanUp();
         File f = new File(TestUtil.jsonSchemaLoc+"config.properties");
         if(f.exists()) {
-            boolean isDeleted = f.delete();
+            f.delete();
         }
     }
 
index 01029e8..2de7535 100644 (file)
@@ -73,9 +73,9 @@ public class ArtifactGenerationServiceTest {
   private static final String aaiArtifactType = ArtifactType.AAI.name();
   private static final String aaiArtifactGroupType = GroupType.DEPLOYMENT.name();
   private static final String generatorConfig = "{\"artifactTypes\": [\"OTHER\",\"AAI\"]}";
-  Properties properties = new Properties();
-  Map<String, String> additionalParams = new HashMap();
- Map<String, String> resourcesVersion = new HashMap<>();
+  private final Properties properties = new Properties();
+  private final Map<String, String> additionalParams = new HashMap<>();
 private final Map<String, String> resourcesVersion = new HashMap<>();
 
   @BeforeSuite
   public void loadProperties() throws Exception{
@@ -87,7 +87,7 @@ public class ArtifactGenerationServiceTest {
   public void testArtifactGeneration() {
     // Sunny day scenario service with VF anf vfmodule
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
+
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
@@ -112,7 +112,7 @@ public class ArtifactGenerationServiceTest {
 
         Assert.assertEquals(resultData.size(),5);  //  1-service,1-VF-resource,1-vfmodule and 2
         // others
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -129,7 +129,6 @@ public class ArtifactGenerationServiceTest {
     // Sunny day scenario service with VF and extra widget like CP anf vf has vfmodule without
     // member
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testWidgetinServiceTosca/";
@@ -142,7 +141,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
         Assert.assertEquals(resultData.size(),5);  //  1-service,1-VF-resource,1-vfmodule and 2
         // others
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -159,7 +158,6 @@ public class ArtifactGenerationServiceTest {
     // Sunny day scenario service with VF and extra widget like CP anf vf has vfmodule without
     // member
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testSameVLdifferentVersion/";
@@ -172,7 +170,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
         Assert.assertEquals(resultData.size(),8);
         // others
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -188,7 +186,6 @@ public class ArtifactGenerationServiceTest {
   public void testArtifactGenerationAllottedResourceAndL3Network() {
     // Sunny day scenario service with allotted resource and L3-network
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai2/";
@@ -203,7 +200,7 @@ public class ArtifactGenerationServiceTest {
         Assert.assertEquals(resultData.size(),5);
         // and 2
         // others
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -248,7 +245,6 @@ public class ArtifactGenerationServiceTest {
   public void testWhenOnlyServToscaNoResTosca() {
     try {
       //Testing only service tosca no resource Tosca
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       String aaiResourceBasePaths = "testArtifactGeneration4/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
@@ -261,7 +257,7 @@ public class ArtifactGenerationServiceTest {
         }
       }
       Assert.assertEquals(resultData.size(),3);  //  1-service and 2-Others
-      outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+      Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
       testServiceTosca(toscas, outputArtifactMap);
     } catch (Exception e) {
       Assert.fail(e.getMessage());
@@ -286,7 +282,6 @@ public class ArtifactGenerationServiceTest {
   public void testWhenExtraResToscaNotPartOfServ() {
     try {
       // Valid scenario with extra resource tosca which is not part of Service
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       String aaiResourceBasePaths = "testArtifactGeneration6/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
@@ -299,7 +294,7 @@ public class ArtifactGenerationServiceTest {
         }
       }
       Assert.assertEquals(resultData.size(),3);  //  1-service and 2 Others
-      outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+      Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
       testServiceTosca(toscas, outputArtifactMap);
     } catch (Exception e) {
       Assert.fail(e.getMessage());
@@ -397,13 +392,8 @@ public class ArtifactGenerationServiceTest {
     try {
       //mandatory attribute <vfModuleModelInvariantUUID> missing
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_ModInvUUID.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_ModInvUUID.yml");
-      fis1.close();
-
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_ModInvUUID.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_ModInvUUID.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_ModInvUUID.yml");
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_ModInvUUID.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -415,7 +405,7 @@ public class ArtifactGenerationServiceTest {
     }
   }
 
-  public static void readPayload(List<Artifact> inputArtifacts,InputStream fis, String fileName) throws
+  public static void readPayload(List<Artifact> inputArtifacts, InputStream fis, String fileName) throws
       IOException {
     byte[] payload = new byte[fis.available()];
     fis.read(payload);
@@ -435,13 +425,9 @@ public class ArtifactGenerationServiceTest {
     try {
       //invalid id since not of length 36 for  <vfModuleModelInvariantUUID>
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_InvalidVfModInvUuIdAttr.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_InvalidVfModInvUuIdAttr.yml");
-      fis1.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_InvalidVfModInvUuIdAttr.yml");
 
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_InvalidVfModInvUuIdAttr.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_InvalidVfModInvUuIdAttr.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_InvalidVfModInvUuIdAttr.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -458,13 +444,9 @@ public class ArtifactGenerationServiceTest {
     try {
       //mandatory attribute <vfModuleModelName> missing
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_ModelName.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_ModelName.yml");
-      fis1.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_ModelName.yml");
 
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_ModelName.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_ModelName.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_ModelName.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -497,13 +479,9 @@ public class ArtifactGenerationServiceTest {
     try {
       //mandatory attribute <vfModuleModelUUID> missing in Artifact
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_ModelUUID.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_ModelUUID.yml");
-      fis1.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_ModelUUID.yml");
 
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_ModelUUID.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_ModelUUID.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_ModelUUID.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -521,13 +499,9 @@ public class ArtifactGenerationServiceTest {
     try {
       //invalid id since not of length 36 for  <vfModuleModelUUID>
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_InvalidVfModUuIdAttr.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_InvalidVfModUuIdAttr.yml");
-      fis1.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_InvalidVfModUuIdAttr.yml");
 
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_InvalidVfModUuIdAttr.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_InvalidVfModUuIdAttr.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_InvalidVfModUuIdAttr.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -544,13 +518,9 @@ public class ArtifactGenerationServiceTest {
     try {
       //mandatory attribute <vfModuleModelVersion> missing
       List<Artifact> inputArtifacts = new ArrayList<>();
-      InputStream fis1 = ArtifactGenerationServiceTest.class.getResourceAsStream("/service_vmme_template_ModelVersion.yml");
-      readPayload(inputArtifacts,fis1, "service_vmme_template_ModelVersion.yml");
-      fis1.close();
+      readPayloadFromResource(inputArtifacts, "service_vmme_template_ModelVersion.yml");
 
-      InputStream fis2 = ArtifactGenerationServiceTest.class.getResourceAsStream("/vf_vmme_template_ModelVersion.yml");
-      readPayload(inputArtifacts,fis2, "vf_vmme_template_ModelVersion.yml");
-      fis2.close();
+      readPayloadFromResource(inputArtifacts, "vf_vmme_template_ModelVersion.yml");
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
       Assert.assertEquals(
@@ -567,9 +537,7 @@ public class ArtifactGenerationServiceTest {
     String configLoc = System.getProperty("artifactgenerator.config");
     try {
       System.clearProperty("artifactgenerator.config");
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -599,17 +567,14 @@ public class ArtifactGenerationServiceTest {
           .getName();
       String assertMsg = ArtifactType.AAI.name() + ".model-version-id." +Widget.getWidget
           (Widget.Type.SERVICE).getName();
-      OutputStream fos = new FileOutputStream(new File(configLoc));
-      String serviceWidgetId = properties.getProperty(serviceWidgetName);
 
       //Remove property from Artifact-Generator.properties
       properties.remove(serviceWidgetName);
-      properties.store(fos,null);
-      fos.close();
+      try (OutputStream fos = new FileOutputStream(new File(configLoc))) {
+        properties.store(fos,null);
+      }
 
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -634,9 +599,7 @@ public class ArtifactGenerationServiceTest {
     String configLoc = System.getProperty("artifactgenerator.config");
     try {
       System.setProperty("artifactgenerator.config",configLoc + File.separator + "testErrorWhenNoFileAtConfigLocation");
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -656,9 +619,7 @@ public class ArtifactGenerationServiceTest {
     //  scenario service with VF anf vfmodule but no service version in additional parameter
     try {
       additionalParams.clear();
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -678,7 +639,6 @@ public class ArtifactGenerationServiceTest {
     // Sunny day scenario service with VF anf vfmodule and service version as adiitional parameter
     try {
       additionalParams.put(AdditionalParams.ServiceVersion.getName(),"9.0");
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
@@ -703,7 +663,7 @@ public class ArtifactGenerationServiceTest {
 
         Assert.assertEquals(resultData.size(),5);  //  1-service,1-VF-resource,1-vfmodule and 2
         // others
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -722,9 +682,7 @@ public class ArtifactGenerationServiceTest {
   public void testErrorWhenInvalidServiceVersion() {
     //  scenario service with VF anf vfmodule but invalid service version in additional parameter
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "aai/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
 
@@ -785,9 +743,7 @@ public class ArtifactGenerationServiceTest {
   public void testErrorWhenNoResourceVersion() {
     //  scenario service with VF but missing resource version in service tosca
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testErrorWhenNoResourceVersion/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -803,9 +759,7 @@ public class ArtifactGenerationServiceTest {
   public void testErrorWhenInvalidResourceVersion1() {
     //  scenario service with VF but invalid resource version 0.0 in service tosca
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testErrorWhenInvalidResourceVersion1/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -821,9 +775,7 @@ public class ArtifactGenerationServiceTest {
   public void testErrorWhenInvalidResourceVersion2() {
     //  scenario service with VF but invalid resource version 1 in service tosca
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testErrorWhenInvalidResourceVersion2/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -838,7 +790,6 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationAllottedResourceWithIpMuxAndTunnelXConn() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testArtifactGeneration15/";
@@ -851,7 +802,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
 
         Assert.assertEquals(resultData.size(),5);
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -866,9 +817,7 @@ public class ArtifactGenerationServiceTest {
 //  @Test
   public void testErrorWhenAllottedResourceWithOutProvidingServiceId() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testErrorWhenAllottedResourceWithOutDependingServiceId/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -883,9 +832,7 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationWithoutAllottedResource() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
-      List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testArtifactGeneration16/";
       List<Artifact> inputArtifacts = init(aaiResourceBasePaths);
       GenerationData data = obj.generateArtifact(inputArtifacts, generatorConfig, additionalParams);
@@ -900,7 +847,6 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationAllottedResourceIpmuxSameInvariantDiffVersion() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testArtifactGeneration17/";
@@ -913,7 +859,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
 
         Assert.assertEquals(resultData.size(),5);
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -928,7 +874,6 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationAllottedResourceIpmuxSameInvariantSameVersion() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testArtifactGeneration18/";
@@ -942,7 +887,7 @@ public class ArtifactGenerationServiceTest {
 
 
         Assert.assertEquals(resultData.size(),4);
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -957,7 +902,6 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationAllottedResourceIpmuxWithGroups() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testAllotedResourceWithDependingSerWithGroups/";
@@ -970,7 +914,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
 
         Assert.assertEquals(resultData.size(),5);
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -985,7 +929,6 @@ public class ArtifactGenerationServiceTest {
   @Test
   public void testArtifactGenerationAllottedResourceWithVF() {
     try {
-      Map<String, Model> outputArtifactMap = new HashMap<>();
       ArtifactGenerationServiceImpl obj = new ArtifactGenerationServiceImpl();
       List<ToscaTemplate> toscas = new LinkedList<>();
       String aaiResourceBasePaths = "testArtifactGenerationAllottedResourceWithVF/";
@@ -998,7 +941,7 @@ public class ArtifactGenerationServiceTest {
         List<Artifact> resultData = data.getResultData();
 
         Assert.assertEquals(resultData.size(),7);
-        outputArtifactMap = populateAAIGeneratedModelStore(resultData);
+        Map<String, Model> outputArtifactMap = populateAAIGeneratedModelStore(resultData);
         testServiceTosca(toscas, outputArtifactMap);
         testResourceTosca(toscas.iterator(), outputArtifactMap);
       } else {
@@ -1500,7 +1443,7 @@ nodeProperties = node.getProperties();
     return matchedModelElements;
   }
 
-  private Map<String, Model> populateAAIGeneratedModelStore(List<Artifact> resultData) {
+  private Map<String, Model> populateAAIGeneratedModelStore(List<Artifact> resultData) throws IOException {
     Map<String, Model> outputArtifactMap = new HashMap<>();
     for (Artifact outputArtifact : resultData) {
       if (outputArtifact.getType().equals(ArtifactType.MODEL_INVENTORY_PROFILE.name())) {
@@ -1513,16 +1456,21 @@ nodeProperties = node.getProperties();
     return outputArtifactMap;
   }
 
-  private Model getUnmarshalledArtifactModel(String aaiModel) {
-    JAXBContext jaxbContext;
+  private Model getUnmarshalledArtifactModel(String aaiModel) throws IOException {
+
     try {
-      jaxbContext = JAXBContext.newInstance(Model.class);
+
+      JAXBContext jaxbContext = JAXBContext.newInstance(Model.class);
       Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-      InputStream aaiModelStream = new ByteArrayInputStream(aaiModel.getBytes());
-      return (Model) unmarshaller.unmarshal(aaiModelStream);
+
+      try (InputStream aaiModelStream = new ByteArrayInputStream(aaiModel.getBytes())) {
+        return (Model) unmarshaller.unmarshal(aaiModelStream);
+      }
+
     } catch (JAXBException e) {
       e.printStackTrace();
     }
+
     return null;
   }
 
@@ -1567,20 +1515,6 @@ nodeProperties = node.getProperties();
     return null;
   }
 
-
-  private ToscaTemplate getResourceTosca(List<ToscaTemplate> input) {
-    Iterator<ToscaTemplate> iter = input.iterator();
-    while (iter.hasNext()) {
-      ToscaTemplate tosca = iter.next();
-      if (!tosca.isService()) {
-        iter.remove();
-        return tosca;
-      }
-    }
-    return null;
-  }
-
-
   private Map<String, String> getVFModuleMetadataTosca(ToscaTemplate toscaTemplate,
                                                        String vfModuleModelUUID) {
     Map<String, GroupDefinition> groupDefinitionMap =
@@ -1589,7 +1523,7 @@ nodeProperties = node.getProperties();
     for (Map.Entry<String, GroupDefinition> e : groupDefinitionMap.entrySet()) {
       if (e.getValue().getType().contains("org.openecomp.groups.VfModule")) {
         String uuid = e.getValue().getMetadata().get("vfModuleModelUUID");
-        if (uuid == vfModuleModelUUID) {
+        if (Objects.equals(uuid, vfModuleModelUUID)) {
           vfModuleModelMetadata = e.getValue().getMetadata();
           vfModuleModelMetadata.put("vf_module_description",
               (String) e.getValue().getProperties().get("vf_module_description"));
@@ -1606,17 +1540,15 @@ nodeProperties = node.getProperties();
     Map<String, NodeTemplate> nodeTemplateMaps =
         toscaTemplate.getTopology_template().getNode_templates();
     Map<String, Object> vfModuleMembers = new LinkedHashMap<>();
-    List<String> vfModuleModelMetadata = new ArrayList<>();
+    List<String> vfModuleModelMetadata;
     for (Map.Entry<String, GroupDefinition> e : groupDefinitionMap.entrySet()) {
       if (e.getValue().getType().contains("org.openecomp.groups.VfModule")) {
         String uuid = e.getValue().getMetadata().get("vfModuleModelUUID");
-        if (uuid == vfModuleModelUUID) {
+        if (Objects.equals(uuid, vfModuleModelUUID)) {
           vfModuleModelMetadata = e.getValue().getMembers();
           if (vfModuleModelMetadata !=null) {
-            Iterator itr = vfModuleModelMetadata.iterator();
-            while (itr.hasNext()) {
-              Object obj = itr.next();
-              NodeTemplate nodeTemplate = nodeTemplateMaps.get(obj);
+            for (Object key : vfModuleModelMetadata) {
+              NodeTemplate nodeTemplate = nodeTemplateMaps.get(key);
               String nodetype = null;
               if (nodeTemplate != null) {
                 nodetype = nodeTemplate.getType();
@@ -1624,7 +1556,7 @@ nodeProperties = node.getProperties();
               if (nodetype != null) {
                 String widgetType = membersType(nodetype);
                 if (widgetType != null) {
-                  vfModuleMembers.put(widgetType, obj);
+                  vfModuleMembers.put(widgetType, key);
                 }
               }
             }
@@ -1686,24 +1618,24 @@ nodeProperties = node.getProperties();
         Assert.fail("Invalid resource directory");
       }
 
-      for (int i = 0; i < resourceFileList.length; i++) {
-        byte[] payload = null;
+      for (String aResourceFileList : resourceFileList) {
         File resourceFile = new File(
-            this.getClass().getClassLoader().getResource(aaiResourceBasePaths + resourceFileList[i])
-                .getPath());
-        FileInputStream fileInputStream;
+                this.getClass().getClassLoader().getResource(aaiResourceBasePaths + aResourceFileList)
+                        .getPath());
+
         //convert service tosca file into array of bytes
-        payload = new byte[(int) resourceFile.length()];
-        fileInputStream = new FileInputStream(resourceFile);
-        fileInputStream.read(payload);
-        fileInputStream.close();
+        byte[] payload = new byte[(int) resourceFile.length()];
+        try (FileInputStream fileInputStream = new FileInputStream(resourceFile)) {
+          fileInputStream.read(payload);
+        }
+
         String checksum = GeneratorUtil.checkSum(payload);
         byte[] encodedPayload = GeneratorUtil.encode(payload);
         Artifact artifact =
-            new Artifact(aaiArtifactType, aaiArtifactGroupType, checksum, encodedPayload);
-        artifact.setName(resourceFileList[i]);
-        artifact.setLabel(resourceFileList[i]);
-        artifact.setDescription(resourceFileList[i]);
+                new Artifact(aaiArtifactType, aaiArtifactGroupType, checksum, encodedPayload);
+        artifact.setName(aResourceFileList);
+        artifact.setLabel(aResourceFileList);
+        artifact.setDescription(aResourceFileList);
         artifact.setVersion("1.0");
         inputArtifacts1.add(artifact);
 
@@ -1742,4 +1674,10 @@ nodeProperties = node.getProperties();
       }
     }
   }
+
+  private void readPayloadFromResource(List<Artifact> inputArtifacts, String file) throws IOException {
+    try (InputStream stream = ArtifactGenerationServiceTest.class.getResourceAsStream("/" + file)) {
+      readPayload(inputArtifacts, stream, file);
+    }
+  }
 }
index f320a98..c9dda19 100644 (file)
@@ -562,6 +562,12 @@ data_types:
         type: string
         status: SUPPORTED
         required: false
+      subnet_id:
+        type: string
+        description: Subnet in which to allocate the IP address for this port
+        required: false
+        status: SUPPORTED
+
 
   org.openecomp.datatypes.heat.contrailV2.virtual.machine.interface.Properties:
     derived_from: tosca.datatypes.Root
index 085f9c6..281f07d 100644 (file)
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
 
+=============
 Configuration
 =============
 
-.. note::
-   * This section is used to describe the options a software component offers for configuration.
+.. contents::
+   :depth: 3
+..
+
+Global Configuration
+====================
+
+environment.json
+----------------
+
+::
+
+    {
+        # Environment name
+        "name": "xxx",
+        
+        # Environment description
+        "description": "OpenSource-xxx",
+        
+        # Chef properties
+        "cookbook_versions": {
+            "Deploy-SDandC": "= 1.0.0"
+        },
+        "json_class": "Chef::Environment",
+        "chef_type": "environment",
+        
+        "default_attributes": {
+        
+            # IPs used for docker configuration
+            "CS_VIP": "yyy",
+            "BE_VIP": "yyy",
+            "FE_VIP": "yyy",
+            "ES_VIP": "yyy",
+            "interfaces": {
+                "application": "eth0",
+                "private": "eth1"
+            },
+            
+            # Configuration parameters used in portal properties 
+            "ECompP": {
+                "ecomp_rest_url": "http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi",
+                "ueb_url_list": "10.0.11.1,10.0.11.1",
+                "app_secret": "XftIATw9Jr3VzAcPqt3NnJOu",
+                "app_key": "x9UfO7JsDn8BESVX",
+                "inbox_name": "ECOMP-PORTAL-INBOX",
+                "ecomp_redirect_url": "http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/login.htm",
+                "app_topic_name": "ECOMP-PORTAL-OUTBOX-SDC1",
+                "decryption_key": "AGLDdG4D04BKm2IxIWEr8o=="
+            },
+            
+            # Configuration parameters used by SDC to work with Dmaap
+            "UEB": {
+                "PublicKey": "iPIxkpAMI8qTcQj8",
+                "SecretKey": "Ehq3WyT4bkif4zwgEbvshGal",
+                "fqdn": ["10.0.11.1", "10.0.11.1"]
+            },
+            
+            # IPs used for docker configuration
+            "Nodes": {
+                "CS": "yyy",
+                "BE": "yyy",
+                "FE": "yyy",
+                "ES": "yyy"
+            }
+        },
+        "override_attributes": {
+             
+            # FE and BE listening ports
+            "FE": {
+                "http_port": "8181",
+                "https_port": "9443"
+            },
+            "BE": {
+                "http_port": "8080",
+                "https_port": "8443"
+            },
+            
+            # Elasticsearch configuration
+            "elasticsearch": {
+                "cluster_name": "SDC-ES-",
+                "ES_path_home": "/usr/share/elasticsearch",
+                "ES_path_data": "/usr/share/elasticsearch/data",
+                "num_of_replicas": "0",
+                "num_of_shards": "1"
+            },
+            
+            # Cassandra configuration
+            "cassandra": {
+                "concurrent_reads": "32",
+                "num_tokens": "256",
+                "data_dir": "/var/lib/cassandra/data",
+                "hinted_handoff_enabled": "true",
+                "cassandra_user": "asdc_user",
+                "cassandra_password": "Aa1234%^!",
+                "concurrent_writes": "32",
+                "cluster_name": "SDC-CS-",
+                "multithreaded_compaction": "false",
+                "cache_dir": "/var/lib/cassandra/saved_caches",
+                "log_file": "/var/lib/cassandra/log/system.log",
+                "phi_convict_threshold": "8",
+                "commitlog_dir": "/var/lib/cassandra/commitlog"
+            }
+        }
+    }
+
+Backend Configurations
+======================
+
+BE-configuration.yaml
+---------------------
+
+::
+
+    # Request headers for identification of the user that made the request
+    identificationHeaderFields:
+    - HTTP_IV_USER
+    - HTTP_CSP_FIRSTNAME
+    - HTTP_CSP_LASTNAME
+    - HTTP_IV_REMOTE_ADDRESS
+    - HTTP_CSP_WSTYPE
+    
+    # Catalog backend hostname
+    beFqdn: <%= @host_ip %>
+    
+    # Catalog backend http port
+    beHttpPort: <%= @catalog_port %>
+    
+    # Catalog backend http context
+    beContext: /sdc/rest/config/get
+    
+    # Catalog backend protocol
+    beProtocol: http
+    
+    # Catalog backend ssl port
+    beSslPort: <%= @ssl_port %>
+    
+    # Catalog backend configuration vesrion
+    version: 1.0
+    
+    # Catalog backend configuration release date
+    released: 2012-11-30
+    
+    # Catalog tosca current conformance version
+    toscaConformanceLevel: 4.0
+    
+    # Catalog minimum tosca conformance version
+    minToscaConformanceLevel: 3.0
+    
+    # Titan configuration file location
+    titanCfgFile: /var/lib/jetty/config/catalog-be/titan.properties
+    
+    # Does titan holds the persistency data in memory
+    titanInMemoryGraph: false
+    
+    # The timeout for titan to lock on an object in a transaction
+    titanLockTimeout: 1800
+    
+    # The interval to try and reconnect to titan DB when it is down during SDC startup
+    titanReconnectIntervalInSeconds: 3
+    
+    # The read timeout towards Titan DB when health check is invoked
+    titanHealthCheckReadTimeout: 1
+    
+    # The interval to try and reconnect to Elasticsearch when it is down during SDC startup
+    esReconnectIntervalInSeconds: 3
+    
+    # The interval to try and reconnect to UEB health check when it is down during SDC startup
+    uebHealthCheckReconnectIntervalInSeconds: 15
+    
+    # The read timeout towards UEB when helath check is invoked
+    uebHealthCheckReadTimeout: 4
+    
+    # Protocols being used in SDC
+    protocols:
+        - http
+        - https
+    
+    # Default imports
+    # Under each import there is the file the data will be imported from
+    defaultImports:
+        - nodes:
+            file: nodes.yml
+        - datatypes:
+            file: data.yml
+        - capabilities:
+            file: capabilities.yml
+        - relationships:
+            file: relationships.yml
+        - groups:
+            file: groups.yml
+        - policies:
+            file: policies.yml
+    
+    # Users
+    # Deprecated. Will be removed in future releases
+    users:
+        tom: passwd
+        bob: passwd
+    
+    cassandraConfig:
+        # Cassandra hostname
+        cassandraHosts: <%= @cassandra_ip %>
+        
+        # Cassandra local data center name
+        localDataCenter: <%= @DC_NAME %>
+        
+        # The read timeout towards Cassandra when health check is invoked
+        reconnectTimeout : 30000
+        
+        # Should an authentication be used when accessing Cassandra
+        authenticate: true
+        
+        # Username for accessing Cassandra
+        username: asdc_user
+        
+        # Password for accessing Cassnadra
+        password: {{cassandra_password}}
+        
+        # Does an ssl should be used
+        ssl: false
+        
+        # Location of .truststore file
+        truststorePath : /config/.truststore
+        
+        # The .truststore file password
+        truststorePassword : Aa123456
+        
+        # Keyspaces configuration for Cassandra
+        keySpaces:
+            - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']}
+            - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']}
+            - { name: sdcartifact, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']}
+            - { name: sdccomponent, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']}
+            - { name: sdcrepository, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @DC_NAME %>','<%= @rep_factor %>']}
+    
+    # Application-specific settings of ES
+    elasticSearch:
+        
+        # Mapping of index prefix to time-based frame. For example, if below is configured:
+        #
+        # - indexPrefix: auditingevents
+        #    creationPeriod: minute
+        #
+        # then ES object of type which is mapped to "auditingevents-*" template, and created on 2015-12-23 13:24:54, will enter "auditingevents-2015-12-23-13-24" index.
+        # Another object created on 2015-12-23 13:25:54, will enter "auditingevents-2015-12-23-13-25" index.
+        # If creationPeriod: month, both of the above will enter "auditingevents-2015-12" index.
+        #
+        # PLEASE NOTE: the timestamps are created in UTC/GMT timezone! This is needed so that timestamps will be correctly presented in Kibana.
+        #
+        # Legal values for creationPeriod - year, month, day, hour, minute, none (meaning no time-based behaviour).
+        #
+        # If no creationPeriod is configured for indexPrefix, default behavour is creationPeriod: month.
+        indicesTimeFrequency:
+            - indexPrefix: auditingevents
+              creationPeriod: month
+            - indexPrefix: monitoring_events
+              creationPeriod: month
+    
+    # Artifact types placeholder
+    artifactTypes:
+        - CHEF
+        - PUPPET
+        - SHELL
+        - YANG
+        - YANG_XML
+        - HEAT
+        - BPEL
+        - DG_XML
+        - MURANO_PKG
+        - WORKFLOW
+        - NETWORK_CALL_FLOW
+        - TOSCA_TEMPLATE
+        - TOSCA_CSAR
+        - AAI_SERVICE_MODEL
+        - AAI_VF_MODEL
+        - AAI_VF_MODULE_MODEL
+        - AAI_VF_INSTANCE_MODEL
+        - OTHER
+        - SNMP_POLL
+        - SNMP_TRAP
+        - GUIDE
+        - PLAN
+    
+    # License types placeholder
+    licenseTypes:
+        - User
+        - Installation
+        - CPU
+    
+    # Resource types placeholder
+    resourceTypes: &allResourceTypes
+        - VFC
+        - CP
+        - VL
+        - VF
+        - VFCMT
+        - Abstract
+        - CVFC
+    
+    #Deployment resource artifacts placeHolder
+    deploymentResourceArtifacts:
+    
+    # Deployment resource instance artifacts placeholders
+    # For each artifact the following properties exists:
+    # 
+    # displayName - The display name of the artifact
+    # type - The type of the artifact
+    # description - The description of the artifact
+    # fileExtension - The file extension of the artifact file for uploading
+    deploymentResourceInstanceArtifacts:
+        heatEnv:
+            displayName: "HEAT ENV"
+            type: HEAT_ENV
+            description: "Auto-generated HEAT Environment deployment artifact"
+            fileExtension: "env"
+        VfHeatEnv:
+            displayName: "VF HEAT ENV"
+            type: HEAT_ENV
+            description: "VF Auto-generated HEAT Environment deployment artifact"
+            fileExtension: "env"
+    
+    # Tosca artifacts placeholders
+    # For each artifact there is a template and a scar.
+    # For each one the following properties exists:
+    # 
+    # artifactName - The suffix of the artifact file
+    # displayName - The display name of the artifact
+    # type - The type of the artifact
+    # description - The description of the artifact
+    toscaArtifacts:
+        assetToscaTemplate:
+            artifactName: -template.yml
+            displayName: Tosca Template
+            type: TOSCA_TEMPLATE
+            description: TOSCA representation of the asset
+        assetToscaCsar:
+            artifactName: -csar.csar
+            displayName: Tosca Model
+            type: TOSCA_CSAR
+            description: TOSCA definition package of the asset
+    
+    # Resource category to exclude
+    excludeResourceCategory:
+        - Generic
+    
+    # Resource type to exclude
+    excludeResourceType:
+        - PNF
+    
+    # Informational resource artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # displayName - The display name of the artifact
+    # type - The type of the artifact
+    informationalResourceArtifacts:
+        features:
+            displayName: Features
+            type: OTHER
+    capacity:
+        displayName: Capacity
+        type: OTHER
+    vendorTestResult:
+        displayName: Vendor Test Result
+        type: OTHER
+    testScripts:
+        displayName: Test Scripts
+        type: OTHER
+    CloudQuestionnaire:
+        displayName: Cloud Questionnaire (completed)
+        type: OTHER
+    HEATTemplateFromVendor:
+        displayName: HEAT Template from Vendor
+        type: HEAT
+    resourceSecurityTemplate:
+        displayName: Resource Security Template
+        type: OTHER
+    
+    # Service category to exclude
+    excludeServiceCategory:
+    
+    # Informational service artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # displayName - The display name of the artifact
+    # type - The type of the artifact
+    informationalServiceArtifacts:
+        serviceArtifactPlan:
+            displayName: Service Artifact Plan
+            type: OTHER
+        summaryOfImpactsToECOMPElements:
+            displayName: Summary of impacts to ECOMP elements,OSSs, BSSs
+            type: OTHER
+        controlLoopFunctions:
+            displayName: Control Loop Functions
+            type: OTHER
+        dimensioningInfo:
+            displayName: Dimensioning Info
+            type: OTHER
+        affinityRules:
+            displayName: Affinity Rules
+            type: OTHER
+        operationalPolicies:
+            displayName: Operational Policies
+            type: OTHER
+        serviceSpecificPolicies:
+            displayName: Service-specific Policies
+            type: OTHER
+        engineeringRules:
+            displayName: Engineering Rules (ERD)
+            type: OTHER
+        distributionInstructions:
+            displayName: Distribution Instructions
+            type: OTHER
+        certificationTestResults:
+            displayName: TD Certification Test Results
+            type: OTHER
+        deploymentVotingRecord:
+            displayName: Deployment Voting Record
+            type: OTHER
+        serviceQuestionnaire:
+            displayName: Service Questionnaire
+            type: OTHER
+        serviceSecurityTemplate:
+            displayName: Service Security Template
+            type: OTHER
+    
+    # Service api artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # displayName - The display name of the artifact
+    # type - The type of the artifact
+    serviceApiArtifacts:
+        configuration:
+            displayName: Configuration
+            type: OTHER
+        instantiation:
+            displayName: Instantiation
+            type: OTHER
+        monitoring:
+            displayName: Monitoring
+            type: OTHER
+        reporting:
+            displayName: Reporting
+            type: OTHER
+        logging:
+            displayName: Logging
+            type: OTHER
+        testing:
+            displayName: Testing
+            type: OTHER
+    
+    # The maximum number of keys permited for additional information on service
+    additionalInformationMaxNumberOfKeys: 50
+    
+    # Collect process statistics
+    systemMonitoring:
+        
+        # Should monitoring be enabled
+        enabled: false
+        
+        # In case of going through the FE server proxy the information to the BE
+        isProxy: false
+        
+        # What is the interval of the statistics collection
+        probeIntervalInSeconds: 15
+    
+    defaultHeatArtifactTimeoutMinutes: 60
+    
+    # Service deployment artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # acceptedTypes - File types that can be uploaded as each artifact
+    serviceDeploymentArtifacts:
+        YANG_XML:
+            acceptedTypes:
+                - xml
+        VNF_CATALOG:
+            acceptedTypes:
+                - xml
+        MODEL_INVENTORY_PROFILE:
+            acceptedTypes:
+                - xml
+        MODEL_QUERY_SPEC:
+            acceptedTypes:
+                - xml
+        UCPE_LAYER_2_CONFIGURATION:
+            acceptedTypes:
+                - xml
+    
+    #AAI Artifacts
+        AAI_SERVICE_MODEL:
+            acceptedTypes:
+                - xml
+        AAI_VF_MODULE_MODEL:
+            acceptedTypes:
+                - xml
+        AAI_VF_INSTANCE_MODEL:
+            acceptedTypes:
+                - xml
+        OTHER:
+            acceptedTypes:
+    
+    #PLAN
+        PLAN:
+            acceptedTypes:
+                - xml
+    
+    # Resource deployment artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # acceptedTypes - File types that can be uploaded as each artifact
+    # validForRespurceTypes - Resource types that support each artifact. 
+    # If left empty it means all resource types are valid
+    resourceDeploymentArtifacts:
+        HEAT:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes: *allResourceTypes
+        HEAT_VOL:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes: *allResourceTypes
+        HEAT_NET:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes: *allResourceTypes
+        HEAT_NESTED:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes: *allResourceTypes
+        HEAT_ARTIFACT:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        YANG_XML:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        VNF_CATALOG:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        VF_LICENSE:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        VENDOR_LICENSE:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        MODEL_INVENTORY_PROFILE:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        MODEL_QUERY_SPEC:
+            acceptedTypes:
+                - xml
+            validForResourceTypes: *allResourceTypes
+        LIFECYCLE_OPERATIONS:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes:
+                - VF
+                - VFC
+        VES_EVENTS:
+            acceptedTypes:
+                - yaml
+                - yml
+            validForResourceTypes: *allResourceTypes
+        PERFORMANCE_COUNTER:
+            acceptedTypes:
+                - csv
+            validForResourceTypes: *allResourceTypes
+        APPC_CONFIG:
+            acceptedTypes:
+            validForResourceTypes:
+                - VF
+        DCAE_TOSCA:
+            acceptedTypes:
+                - yml
+                - yaml
+            validForResourceTypes:
+                - VF
+                - VFCMT
+        DCAE_JSON:
+            acceptedTypes:
+                - json
+            validForResourceTypes:
+                - VF
+                - VFCMT
+        DCAE_POLICY:
+            acceptedTypes:
+                - emf
+            validForResourceTypes:
+                - VF
+                - VFCMT
+        DCAE_DOC:
+            acceptedTypes:
+            validForResourceTypes:
+                - VF
+                - VFCMT
+        DCAE_EVENT:
+            acceptedTypes:
+            validForResourceTypes:
+                - VF
+                - VFCMT
+        AAI_VF_MODEL:
+            acceptedTypes:
+                - xml
+            validForResourceTypes:
+                - VF
+        AAI_VF_MODULE_MODEL:
+            acceptedTypes:
+                - xml
+            validForResourceTypes:
+                - VF
+        OTHER:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        SNMP_POLL:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        SNMP_TRAP:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+    
+    #PLAN
+        PLAN:
+            acceptedTypes:
+                - xml
+            validForResourceTypes:
+                - VF
+                - VFC
+    
+    # Resource instance deployment artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # acceptedTypes - File types that can be uploaded as each artifact
+    # validForRespurceTypes - Resource types that support each artifact. 
+    # If left empty it means all resource types are valid
+    resourceInstanceDeploymentArtifacts:
+        HEAT_ENV:
+            acceptedTypes:
+                - env
+        VF_MODULES_METADATA:
+            acceptedTypes:
+                - json
+        VES_EVENTS:
+            acceptedTypes:
+                - yaml
+                - yml
+        PERFORMANCE_COUNTER:
+            acceptedTypes:
+                - csv
+        DCAE_INVENTORY_TOSCA:
+            acceptedTypes:
+                - yml
+                - yaml
+        DCAE_INVENTORY_JSON:
+            acceptedTypes:
+                - json
+        DCAE_INVENTORY_POLICY:
+          acceptedTypes:
+                - emf
+        DCAE_INVENTORY_DOC:
+          acceptedTypes:
+        DCAE_INVENTORY_BLUEPRINT:
+          acceptedTypes:
+        DCAE_INVENTORY_EVENT:
+          acceptedTypes:
+        SNMP_POLL:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        SNMP_TRAP:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+    
+    #PLAN
+        PLAN:
+            acceptedTypes:
+                - xml
+    
+    # Resource informational artifacts placeHolder
+    # For each artifact the following properties exists:
+    # 
+    # acceptedTypes - File types that can be uploaded as each artifact
+    # validForRespurceTypes - Resource types that support each artifact. 
+    # If left empty it means all resource types are valid
+    resourceInformationalArtifacts:
+        CHEF:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        PUPPET:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        SHELL:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        YANG:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        YANG_XML:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        HEAT:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        BPEL:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        DG_XML:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        MURANO_PKG:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        OTHER:
+            acceptedTypes:
+            validForResourceTypes:
+                - VFC
+                - CVFC
+                - CP
+                - VL
+                - VF
+                - VFCMT
+                - Abstract
+                - PNF
+        SNMP_POLL:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        SNMP_TRAP:
+            acceptedTypes:
+            validForResourceTypes: *allResourceTypes
+        GUIDE:
+            acceptedTypes:
+            validForResourceTypes:
+                - VF
+                - VFC
+                - CVFC
+    
+    # Resource informational deployment artifact placeholder
+    resourceInformationalDeployedArtifacts:
+    
+    # Requirements needed to be fulfilled before certificattion
+    requirementsToFulfillBeforeCert:
+    
+    # Capabillities needed to be fulfilled before certificattion
+    capabilitiesToConsumeBeforeCert:
+    
+    # Urls that should not be logged
+    unLoggedUrls:
+       - /sdc2/rest/healthCheck
+    
+    # When component is being set as deleted those are the clean configurations
+    cleanComponentsConfiguration:
+        
+        # The interval to check for deleted components to clean
+        cleanIntervalInMinutes: 1440
+        
+        # The components types to delete
+        componentsToClean:
+           - Resource
+           - Service
+    
+    # Deprecated. Will be removed in future releases
+    artifactsIndex: resources
+    
+    # Used to add header and footer to heatENV files generated by SDC
+    heatEnvArtifactHeader: ""
+    heatEnvArtifactFooter: ""
+    
+    onboarding:
+        
+        # Onboarding protocol
+        protocol: http
+        
+        # Onboarding backend hostname
+        host: <%= @host_ip %>
+        
+        # Onboarding backend http port
+        port: <%= @catalog_port %>
+        
+        # The url that being used when downloading CSARs
+        downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages"
+        
+        # Url for onboarding health check
+        healthCheckUri: "/onboarding-api/v1.0/healthcheck"
+    
+    
+    #GSS IDNS
+    # Switchover configuration is used for geo redundency to provide automatic failovers
+    switchoverDetector:
+        gBeFqdn:
+        gFeFqdn:
+        beVip: 1.2.3.4
+        feVip: 1.2.3.4
+        beResolveAttempts: 3
+        feResolveAttempts: 3
+        enabled: false
+        interval: 60
+        changePriorityUser: ecompasdc
+        changePriorityPassword: ecompasdc123
+        publishNetworkUrl:
+        publishNetworkBody: '{"note":"comment"}'
+        groups:
+          beSet: { changePriorityUrl: "", changePriorityBody: '{"name":"","uri":"","no_ad_redirection":false,"v4groups":{"failover_groups":["","","failover_policy":["FAILALL"]},"comment":"","intended_app_proto":"DNS"}'}
+          feSet: { changePriorityUrl: "", changePriorityBody: '{"name":"","uri":"","no_ad_redirection":false,"v4groups":{"failover_groups":["",""],"failover_policy":["FAILALL"]},"comment":"","intended_app_proto":"DNS"}'}
+    
+    # Cache for datatypes. Improving run times for data type search
+    applicationL1Cache:
+        datatypes:
+            enabled: true
+            firstRunDelay: 10
+            pollIntervalInSec: 60
+    
+    # Deprecated. Will be removed in future releases
+    applicationL2Cache:
+        enabled: false
+        catalogL1Cache:
+            enabled: false
+            resourcesSizeInCache: 300
+            servicesSizeInCache: 200
+            productsSizeInCache: 100
+        queue:
+            syncIntervalInSecondes: 43200
+            waitOnShutDownInMinutes: 10
+            numberOfCacheWorkers: 4
+    
+    # Validators for tosca properties
+    toscaValidators:
+        stringMaxLength: 2500
+    
+    # Should audit be disabled
+    disableAudit: false
+    
+    # VF module validations properties
+    vfModuleProperties:
+        min_vf_module_instances:
+            forBaseModule: 1
+            forNonBaseModule: 0
+        max_vf_module_instances:
+            forBaseModule: 1
+            forNonBaseModule:
+        initial_count:
+            forBaseModule: 1
+            forNonBaseModule: 0
+        vf_module_type:
+            forBaseModule: Base
+            forNonBaseModule: Expansion
+    
+    # For each generic node type defining it's coresponding class
+    genericAssetNodeTypes:
+        VFC: org.openecomp.resource.abstract.nodes.VFC
+        CVFC: org.openecomp.resource.abstract.nodes.VFC
+        VF : org.openecomp.resource.abstract.nodes.VF
+        PNF: org.openecomp.resource.abstract.nodes.PNF
+        Service: org.openecomp.resource.abstract.nodes.service
+
+
+BE-distribution-engine-configuration.yaml
+-----------------------------------------
+
+::
+
+    # UEB servers list
+    uebServers:
+        <% node['UEB']['fqdn'].each do |conn| -%>
+            - <%= conn %>
+        <% end -%>
+    
+    # UEB public key
+    uebPublicKey: <%= node['UEB']['PublicKey'] %>
+    
+    # UEB secret key
+    uebSecretKey: <%= node['UEB']['SecretKey'] %>
+    
+    # Topic name for receiving distribution notification
+    distributionNotifTopicName:  SDC-DISTR-NOTIF-TOPIC
+    
+    # Topic name for distribution status
+    distributionStatusTopicName: SDC-DISTR-STATUS-TOPIC
+    
+    # Distibution initializtion retry interval time
+    initRetryIntervalSec: 5
+    
+    # Distribution initializtion maximum interval time
+    initMaxIntervalSec: 60
+    
+    # Deprecated. Will be removed in future releases
+    distribNotifServiceArtifactTypes:
+        info:
+            - MURANO-PKG
+    
+    # Deprecated. Will be removed in future releases
+    distribNotifResourceArtifactTypes:
+        lifecycle:
+            - HEAT
+            - DG-XML
+    
+    # Distribution environments
+    environments:
+        - <%= node.chef_environment %>
+    
+    distributionStatusTopic:
+        
+        # Distribution status polling interval
+        pollingIntervalSec: 60
+        
+        # Distribution status fetch time
+        fetchTimeSec: 15
+        
+        # Distribution status consumer group
+        consumerGroup: sdc-<%= node.chef_environment %>
+        
+        # Distribution status consumer id
+        consumerId: sdc-<%= node.chef_environment %>1
+    
+    distributionNotificationTopic:
+        
+        # Minimum pool size for distribution notifications
+        minThreadPoolSize: 0
+        
+        # Maximum pool size for distribution notifications
+        maxThreadPoolSize: 10
+        
+        # Maximum waiting time after sending a notification
+        maxWaitingAfterSendingSeconds: 5
+    
+    # Deprecated. Will be removed in future releases
+    createTopic:
+        partitionCount: 1
+        replicationCount: 1
+    
+    # STarting the distribution engine
+    startDistributionEngine: true
+    
+    #This is false by default, since ONAP Dmaap currently doesn't support https
+    # Does https should be used with Dmaap
+    useHttpsWithDmaap: false
+
+
+BE-onboarding-configuration.yaml
+--------------------------------
+
+::
+
+    notifications:
+        
+        # Backend onboarding notifications polling interval in milliseconds
+        pollingIntervalMsec: 2000
+        
+        # Backend onboarding notifications selection size
+        selectionSize: 100
+        
+        # Backend onboarding norifications backend hostname
+        beHost: <%= @catalog_ip %>
+        
+        # Backend onboarding notifications backend http port
+        beHttpPort: <%= @catalog_port %>
+
+
+BE-titan.properties
+-------------------
+
+::
+
+    # Titan storage backend
+    storage.backend=cassandra
+    
+    # Titan storage hostname
+    storage.hostname=<%= @CASSANDRA_IP %>
+    
+    # Titan storage port]
+    storage.port=9160
+    
+    # Titan storage username
+    storage.username=<%= @CASSANDRA_USR %>
+    
+    # Titan storage password
+    storage.password=<%= @CASSANDRA_PWD %>
+    
+    # Titan storage connection timeout
+    storage.connection-timeout=10000
+    
+    # Titan cassandra keyspace name
+    storage.cassandra.keyspace=sdctitan
+    
+    # Is Titan cassandra ssl is enabled
+    storage.cassandra.ssl.enabled=false
+    
+    # Titan cassandra ssl truststore file location
+    storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/.truststore
+    
+    # Titan cassandra ssl truststore file password
+    storage.cassandra.ssl.truststore.password=Aa123456
+    
+    # Does titan should use cache
+    cache.db-cache = false
+    
+    # How long in milliseconds should the cache keep entries before flushing them
+    cache.db-cache-clean-wait = 20
+    
+    # Default experation time in milliseconds for entries in the cache
+    cache.db-cache-time = 180000
+    
+    # Size of titan database cache
+    cache.db-cache-size = 0.5
+    
+    # Titan cassandra read consistency level
+    storage.cassandra.read-consistency-level=LOCAL_QUORUM
+    
+    # Titan cassandra write consistency level
+    storage.cassandra.write-consistency-level=LOCAL_QUORUM
+    
+    # Titan cassandra replication strategy class name
+    storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.NetworkTopologyStrategy
+    
+    # Titan cassandra replication startegy options
+    storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,<%= @rep_factor %>
+    
+    # Titan cassandra local data center name
+    storage.cassandra.astyanax.local-datacenter=<%= @DC_NAME %>
+    
+    # Number of times the system attempts to acquire a lock before giving up and throwing an exception
+    storage.lock.retries=5
+    
+    # Number of milliseconds the system waits for a lock application to be acknowledged by the storage backend
+    storage.lock.wait-time=500
+
 
-   * Configuration is typically: provided for platform-component and sdk projects;
-     and referenced in developer and user guides.
-   
-   * This note must be removed after content has been added.
+Frontend Configuration
+======================
 
+FE-configuration.yaml
+---------------------
 
+::
 
-Example ...
+    # Catalog frontend hostname
+    feFqdn: <%= @fe_host_ip %>
+    
+    # Catalog backend hostname
+    beHost: <%= @be_host_ip %>
+    
+    # Catalog backend http port
+    beHttpPort: <%= @catalog_port %>
+    
+    # Catalog backend http context
+    beContext: /sdc2/rest/v1/catalog/upload/resources
+    
+    # Catalog backend protocol
+    beProtocol: http
+    
+    # Catalog backend ssl port
+    beSslPort: <%= @ssl_port %>
+    
+    # Threadpool size for handling requests
+    threadpoolSize: 50
+    
+    # Request processing timeout (seconds)
+    requestTimeout: 10
+    
+    # Health check timeout in milliseconds
+    healthCheckSocketTimeoutInMs: 5000
+    
+    # Health check inteval in seconds
+    healthCheckIntervalInSeconds: 5
+    
+    onboarding:
+        
+        # Onboarding protocol
+        protocol: http
+        
+        # Onboarding frontend hostname
+        host: <%= @fe_host_ip %>
+        
+        # Onboarding frontend port
+        port: 8181
+        
+        # Onboarding frontend health check url
+        healthCheckUri: "/onboarding/v1.0/healthcheck"
+    
+    # Request headers for identification of the user that made the request
+    identificationHeaderFields: 
+        -
+            - &HTTP_IV_USER HTTP_IV_USER
+            - &iv-user iv-user
+        -
+            - &USER_ID USER_ID
+            - &user-id user-id
+        -
+            - &HTTP_CSP_ATTUID HTTP_CSP_ATTUID
+            - &csp-attuid csp-attuid
+        -
+            - &HTTP_CSP_WSTYPE HTTP_CSP_WSTYPE
+            - &csp-wstype csp-wstype
+    
+    # Optional request headers
+    optionalHeaderFields:
+        -
+            - &HTTP_CSP_FIRSTNAME HTTP_CSP_FIRSTNAME
+            - &csp-firstname csp-firstname
+        -
+            - &HTTP_CSP_LASTNAME HTTP_CSP_LASTNAME
+            - &csp-lastname csp-lastname
+        -
+            - &HTTP_IV_REMOTE_ADDRESS HTTP_IV_REMOTE_ADDRESS
+            - &iv-remote-address iv-remote-address
+        -
+            - &HTTP_CSP_EMAIL HTTP_CSP_EMAIL
+            - &csp-email csp-email
+    
+    # Frontend configuration version
+    version: 1.0
+    
+    # Frontend configuration release date
+    released: 2012-11-30
+    
+    # Connection parameters
+    connection:
+        url: jdbc:mysql://localhost:3306/db
+        poolSize: 17
+    
+    # Protocols being used in SDC
+    protocols:
+        - http
+        - https
+    
+    # Collect process statistics
+    systemMonitoring:
+        
+        # Should monitoring be enabled
+        enabled: false
+        
+        # In case of going through the FE server proxy the information to the BE
+        isProxy: true
+        
+        # What is the interval of the statistics collection
+        probeIntervalInSeconds: 15
+    
+    # Kibana hostname
+    kibanaHost: localhost
+    
+    # Kibana http port
+    kibanaPort: 5601
+    
+    # Kibana usage protocol
+    kibanaProtocol: http
 
-You can provide the following in ``basic.conf``
 
-``host=ADDRESS``
-  The address of the host
+FE-onboarding-configuration.yaml
+--------------------------------
 
-``port=PORT``
-  The port used for signaling
+::
 
-  Optional. Default: ``8080``
+    notifications:
+        
+        # Frontend onboarding notifications polling interval in milliseconds
+        pollingIntervalMsec: 2000
+        
+        # Frontend onboarding notifications selection size
+        selectionSize: 100
+        
+        # Frontend onboarding norifications backend hostname
+        beHost: <%= @catalog_ip %>
+        
+        # Frontend onboarding notifications backend http port
+        beHttpPort: <%= @catalog_port %>
index c2af4c2..2379d75 100644 (file)
@@ -1,16 +1,8 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
 
+=============
 Consumed APIs
 =============
 
-.. note::
-   * This section is used to reference APIs that a software component depends on
-     and uses from other sources.  
-   
-   * Consumed APIs should be a specific link to the offered APIs from another component
-     or external source.
-
-   * This note must be removed after content has been added.
-
-
+SDC Project does not consume any APIs from other sources therefore this section is currently empty
index 1845ba0..9e82e15 100644 (file)
@@ -1,25 +1,16 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
 
+=======
 Logging
 =======
 
-.. note::
-   * This section is used to describe the informational or diagnostic messages emitted from 
-     a software component and the methods or collecting them.
-   
-   * This section is typically: provided for a platform-component and sdk; and
-     referenced in developer and user guides
-   
-   * This note must be removed after content has been added.
-
-
 Where to Access Information
 ---------------------------
 
 +--------+------------------------------------------+---------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
 | Server | Location                                 | Type                | Description                                                                                                                                                                               | Rolling             |
-+--------+------------------------------------------+---------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
++========+==========================================+=====================+===========================================================================================================================================================================================+=====================+
 | BE     | /data/logs/BE/2017_03_10.stderrout.log   | Jetty server log    | The log describes info regarding Jetty startup and execution                                                                                                                              | the log rolls daily |
 +        +------------------------------------------+---------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
 |        | /data/logs/BE/SDC/SDC-BE/audit.log       | application audit   | An audit record is created for each operation in SDC                                                                                                                                      | rolls at 20 mb      |
@@ -52,3 +43,3271 @@ Where to Access Information
 
 Error / Warning Messages
 ------------------------
+
+Respone Types
+=============
+
+::
+
+    OK: {
+        code: 200,
+        message: "OK"
+    }
+
+    CREATED: {
+        code: 201,
+        message: "OK"
+    }
+
+    NO_CONTENT: {
+        code: 204,
+        message: "No Content" 
+    }
+
+--------POL4050-----------------------------
+============================================
+
+::
+
+    NOT_ALLOWED: {
+        code: 405,
+        message: "Error: Method not allowed.",
+        messageId: "POL4050"
+    }
+
+--------POL5000-----------------------------
+============================================
+
+::
+
+    GENERAL_ERROR: {
+        code: 500,
+        message: "Error: Internal Server Error. Please try again later.",
+        messageId: "POL5000"
+    }
+
+---------POL5001----------------------------
+============================================
+
+::
+
+    MISSING_X_ECOMP_INSTANCE_ID: {
+        code: 400 ,
+        message: "Error: Missing 'X-ECOMP-InstanceID' HTTP header.",
+        messageId: "POL5001"
+    }
+
+---------POL5002------------------------------
+==============================================
+
+::
+
+    AUTH_REQUIRED: {
+        code: 401 ,
+        message: "Error: Authentication is required to use the API.",
+        messageId: "POL5002"
+    }
+
+---------POL5003------------------------------
+==============================================
+
+::
+
+    AUTH_FAILED: {
+        code: 403 ,
+        message: "Error: Not authorized to use the API.",
+        messageId: "POL5003"
+    }
+
+---------POL5004------------------------------
+==============================================
+
+::
+
+    MISSING\_USER\_ID: {
+        code: 400 ,
+        message: "Error: Missing 'USER\_ID' HTTP header.",
+        messageId: "POL5004"
+    }
+
+---------SVC4000-----------------------------
+=============================================
+
+::
+
+    INVALID_CONTENT: {
+        code: 400,
+        message: "Error: Invalid content.",
+        messageId: "SVC4000"
+    }
+
+---------SVC4002-----------------------------
+=============================================
+
+::
+
+    MISSING_INFORMATION: {
+        code: 403,
+        message: "Error: Missing information.",
+        messageId: "SVC4002"
+    }
+
+---------SVC4003------------------------------
+==============================================
+
+- %1 - Users's ID
+
+::
+
+    USER_NOT_FOUND: {
+        code: 404,
+        message: "Error: User '%1' was not found.",
+        messageId: "SVC4003"
+    }
+
+---------SVC4004-----------------------------
+=============================================
+
+- %1 - Users's email address
+
+::
+
+    INVALID_EMAIL_DDRESS: {
+        code: 400,
+        message: "Error: Invalid email address '%1'.",
+        messageId: "SVC4004"
+    }
+
+---------SVC4005------------------------------
+==============================================
+
+- %1 - role
+
+::
+
+    INVALID_ROLE: {
+        code: 400,
+        message: "Error: Invalid role '%1'.",
+        messageId: "SVC4005"
+    }
+
+---------SVC4006------------------------------
+==============================================
+
+- %1 - Users's USER_ID
+
+::
+
+    USER_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: User with '%1' ID already exists.",
+        messageId: "SVC4006"
+    }
+
+---------SVC4007------------------------------
+==============================================
+
+::
+
+    DELETE_USER_ADMIN_CONFLICT: {
+        code: 409,
+        message: "Error: An administrator can only be deleted by another administrator.",
+        messageId: "SVC4007"
+    }
+
+---------SVC4008-----------------------------
+=============================================
+
+- %1 - Users's USER_ID 
+
+::
+
+    INVALID_USER_ID: {
+        code: 400,
+        message: "Error: Invalid userId '%1'.",
+        messageId: "SVC4008" 
+    }
+
+---------SVC4049------------------------------
+==============================================
+
+- %1 - Service/Resource
+
+::
+
+    COMPONENT_MISSING_CONTACT: {
+        code: 400,
+        message: "Error: Invalid Content. Missing %1 contact.",
+        messageId: "SVC4049"
+    }
+
+---------SVC4050-----------------------------
+=============================================
+
+- %1 - Service/Resource/Additional parameter 
+- %2 - Service/Resource/Label name
+
+::
+
+    COMPONENT_NAME_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: %1 with name '%2' already exists.",
+        messageId: "SVC4050"
+    }
+
+---------SVC4051------------------------------
+==============================================
+
+- %1 - Resource/Service
+
+::
+
+    COMPONENT_MISSING_CATEGORY: {
+        code: 400,
+        message: "Error: Invalid Content. Missing %1 category.", 
+        messageId: "SVC4051"
+    }
+
+
+---------SVC4052------------------------------
+==============================================
+
+::
+
+    COMPONENT_MISSING_TAGS: {
+        code: 400,
+        message: "Error: Invalid Content. At least one tag has to be specified.",
+        messageId: "SVC4052"
+    }
+
+---------SVC4053------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    COMPONENT_MISSING_DESCRIPTION: {
+        code: 400,
+        message: "Error: Invalid Content. Missing %1 description.",
+        messageId: "SVC4053"
+    }
+
+---------SVC4054------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    COMPONENT_INVALID_CATEGORY: {
+        code: 400,
+        message: "Error: Invalid Content. Invalid %1 category.",
+        messageId: "SVC4054"
+    }
+
+---------SVC4055------------------------------
+==============================================
+
+::
+
+    MISSING_VENDOR_NAME: {
+        code: 400,
+        message: "Error: Invalid Content. Missing vendor name.",
+        messageId: "SVC4055"
+    }
+
+---------SVC4056------------------------------
+==============================================
+
+::
+
+    MISSING_VENDOR_RELEASE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing vendor release.",
+        messageId: "SVC4056"
+    }
+
+---------SVC4057------------------------------
+==============================================
+
+::
+
+    MISSING_DERIVED_FROM_TEMPLATE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing derived from template specification.",
+        messageId: "SVC4057"
+    }
+
+---------SVC4058------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    COMPONENT_MISSING_ICON: {
+        code: 400,
+        message: "Error: Invalid Content. Missing %1 icon.",
+        messageId: "SVC4058"
+    }
+
+---------SVC4059------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    COMPONENT_INVALID_ICON: {
+        code: 400,
+        message: "Error: Invalid Content. Invalid %1 icon.",
+        messageId: "SVC4059"
+    }
+
+---------SVC4060------------------------------
+==============================================
+
+::
+
+    PARENT_RESOURCE_NOT_FOUND: {
+        code: 400,
+        message: "Error: Invalid Content. Derived from resource template was not found.",
+        messageId: "SVC4060"
+    }
+
+---------SVC4061------------------------------
+==============================================
+
+::
+
+    MULTIPLE_PARENT_RESOURCE_FOUND: {
+        code: 400,
+        message: "Error: Invalid Content. Multiple derived from resource template is not allowed.",
+        messageId: "SVC4061"
+    }
+
+---------SVC4062------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    MISSING_COMPONENT_NAME: {
+        code: 400,
+        message: "Error: Invalid Content. Missing %1 name.",
+        messageId: "SVC4062"
+    }
+
+---------SVC4063------------------------------
+==============================================
+
+- %1 - service/resource
+
+::
+
+    RESOURCE_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' resource was not found.",
+        messageId: "SVC4063"
+    }
+
+---------SVC4064------------------------------
+==============================================
+
+- %1 - Service/Resource/Property
+
+::
+
+    COMPONENT_INVALID_DESCRIPTION: {
+        code: 400,
+        message: "Error: Invalid Content. %1 description contains non-english characters.",
+        messageId: "SVC4064"
+    }
+
+---------SVC4065------------------------------
+==============================================
+
+- %1 - Service/Resource/Property
+- %2 - max resource/service name length
+
+::
+
+    COMPONENT_DESCRIPTION_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. %1 description exceeds limit of %2 characters.",
+        messageId: "SVC4065"
+    }
+
+---------SVC4066------------------------------
+==============================================
+
+- %1 - max length
+
+::
+
+    COMPONENT_TAGS_EXCEED_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Tags overall length exceeds limit of %1 characters.",
+        messageId: "SVC4066"
+    }
+
+---------SVC4067------------------------------
+==============================================
+
+- %1 - max length
+
+::
+
+    VENDOR_NAME_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Vendor name exceeds limit of %1 characters.",
+        messageId: "SVC4067"
+    }
+
+---------SVC4068------------------------------
+==============================================
+
+- %1 - max length
+
+::
+
+    VENDOR_RELEASE_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Vendor release exceeds limit of %1 characters.",
+        messageId: "SVC4068"
+    }
+
+---------SVC4069------------------------------
+==============================================
+
+- %1 - Service/Resource/Product
+
+::
+
+    COMPONENT_INVALID_CONTACT: {
+        code: 400,
+        message: "Error: Invalid Content. %1 Contact Id should be in format 'mnnnnnn' or 'aannna' or 'aannnn', where m=m ,a=a-zA-Z and n=0-9",
+        messageId: "SVC4069"
+    }
+
+---------SVC4070------------------------------
+==============================================
+
+- %1 - Service/Resource
+
+::
+
+    INVALID_COMPONENT_NAME: {
+        code: 400,
+        message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4070"
+    }
+
+---------SVC4071------------------------------
+==============================================
+
+::
+
+    INVALID_VENDOR_NAME: {
+        code: 400,
+        message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4071"
+    }
+
+---------SVC4072------------------------------
+==============================================
+
+::
+
+    INVALID_VENDOR_RELEASE: {
+        code: 400,
+        message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4072"
+    }
+
+---------SVC4073------------------------------
+==============================================
+
+- %1 - Service/Resource
+- %2 - max resource/service name
+
+::
+
+    COMPONENT_NAME_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. %1 name exceeds limit of %2 characters.",
+        messageId: "SVC4073"
+    }
+
+---------SVC4080------------------------------
+==============================================
+
+- %1 - Service/Resource name
+- %2 - Service/Resource
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_IN_CHECKOUT_STATE: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is locked for modification by %3 %4(%5).",
+        messageId: "SVC4080"
+    }
+
+---------SVC4081-----------------------------
+=============================================
+
+- %1 - Service/Resource name
+- %2 - Service/Resource
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_IN_CERT_IN_PROGRESS_STATE: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is locked for certification by %3 %4(%5).",
+        messageId: "SVC4081"
+    }
+
+-----------SVC4082---------------------------
+=============================================
+
+- %1 - Service/Resource name
+- %2 - Service/Resource
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_SENT_FOR_CERTIFICATION: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is sent for certification by %3 %4(%5).",
+        messageId: "SVC4082"
+    }
+
+-----------SVC4083---------------------------
+=============================================
+
+- %1 - Service/Resource name
+
+::
+
+    COMPONENT_VERSION_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Version of this %1 was already promoted.",
+        messageId: "SVC4083"
+    }
+
+-----------SVC4084---------------------------
+=============================================
+
+- %1 - Service/Resource/Product name
+- %2 - Service/Resource/Product
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_ALREADY_CHECKED_IN: {
+        code: 409,
+        message: "Error: The current version of '%1' %2 was already checked-in by %3 %4(%5).",
+        messageId: "SVC4084"
+    }
+
+-----------SVC4085---------------------------
+=============================================
+
+- %1 - Service/Resource/Product name
+- %2 - Service/Resource/Product
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_CHECKOUT_BY_ANOTHER_USER: {
+        code: 403,
+        message: "Error: %1 %2 has already been checked out by %3 %4(%5).",
+        messageId: "SVC4085"
+    }
+
+-----------SVC4086---------------------------
+=============================================
+
+- %1  - Service/Resource name
+- %2  - Service/Resource
+
+::
+
+    COMPONENT_IN_USE: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is in use by another user.",
+        messageId: "SVC4086"
+    }
+
+-----------SVC4087---------------------------
+=============================================
+
+- %1 - Component name
+- %2 - Service/Resource/Product
+
+::
+
+    COMPONENT_HAS_NEWER_VERSION: {
+        code: 409,
+        message: "Error: Checking out of the requested version of the '%1' %2 is not allowed as a newer version exists.",
+        messageId: "SVC4087"
+    }
+
+-----------SVC4088---------------------------
+=============================================
+
+- %1 - Service/Resource name
+- %2 - Service/Resource
+- %3 - First name of last modifier
+- %4 - Last name of last modifier
+- %5 - USER_ID of last modifier
+
+::
+
+    COMPONENT_ALREADY_CERTIFIED: {
+        code: 403,
+        message: "Error: Requested %1 %2 has already been certified by %3 %4(%5).",
+        messageId: "SVC4088"
+    }
+
+-----------SVC4089---------------------------
+=============================================
+
+- %1 - Service/Resource name
+- %2 - Service/Resource
+
+::
+
+    COMPONENT_NOT_READY_FOR_CERTIFICATION: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is not ready for certification.",
+        messageId: "SVC4089"
+    }
+
+-----------SVC4100---------------------------
+=============================================
+
+- %1 - property name
+
+::
+
+    PROPERTY_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' property was not found.",
+        messageId: "SVC4100"
+    }
+
+-----------SVC4101---------------------------
+=============================================
+
+- %1 - property name
+
+::
+
+    PROPERTY_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Property with '%1' name already exists.",
+        messageId: "SVC4101"
+    }
+
+-----------SVC4102---------------------------
+=============================================
+
+- %1 - capability type name
+
+::
+
+    CAPABILITY_TYPE_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Capability Type with name '%1' already exists.",
+        messageId: "SVC4102"
+    }
+
+-----------SVC4114---------------------------
+=============================================
+
+::
+
+    AUTH_FAILED_INVALIDE_HEADER: {
+        code: 400,
+        message: "Error: Invalid Authorization header.",
+        messageId: "SVC4114"
+    }
+
+-----------SVC4115---------------------------
+=============================================
+
+- %1 - capability type name
+
+::
+
+    MISSING_CAPABILITY_TYPE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing Capability Type '%1'.",
+        messageId: "SVC4115"
+    }
+
+-----------SVC4116---------------------------
+=============================================
+
+::
+
+    RESOURCE_INSTANCE_BAD_REQUEST: {
+        code: 400,
+        message: "Error: Invalid Content.",
+        messageId: "SVC4116"
+    }
+
+-----------SVC4117---------------------------
+=============================================
+
+- %1 - resource instance name
+- %2 - resource instance name
+- %3 - requirement name
+
+::
+
+    RESOURCE_INSTANCE_MATCH_NOT_FOUND: {
+        code: 404,
+        message: "Error: Match not found between resource instance '%1' and resource instance '%2' for requirement '%3'.",
+        messageId: "SVC4117"
+    }
+
+-----------SVC4118---------------------------
+=============================================
+
+- %1 - resource instance name
+- %2 - resource instance name
+- %3 - requirement name
+
+::
+
+    RESOURCE_INSTANCE_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Resource instances '%1' and '%2' are already associated with requirement '%3'.",
+        messageId: "SVC4118"
+    }
+
+-----------SVC4119---------------------------
+=============================================
+
+- %1 - resource instance name
+- %2 - resource instance name
+- %3 - requirement name
+
+::
+
+    RESOURCE_INSTANCE_RELATION_NOT_FOUND: {
+        code: 404,
+        message: "Error: No relation found between resource instances '%1' and '%2' for requirement '%3'.",
+        messageId: "SVC4119"
+    }
+
+-----------SVC4120---------------------------
+=============================================
+
+- %1 - User's USER_ID
+
+::
+
+    USER_INACTIVE: {
+        code: 404,
+        message: "Error: User %1 was not found.",
+        messageId: "SVC4120"
+    }
+
+-----------SVC4121---------------------------
+=============================================
+
+- %1 - User's USER\_ID
+
+::
+
+    USER_HAS_ACTIVE_ELEMENTS: {
+        code: 403,
+        message: "Error: User with %1 ID can not be deleted since it has active elements(resources/services/artifacts).",
+        messageId: "SVC4121"
+    }
+
+-----------SVC4122---------------------------
+=============================================
+
+- %1 - artifact type
+
+::
+
+    ARTIFACT_TYPE_NOT_SUPPORTED: {
+        code: 400,
+        message: "Error: Invalid artifact type '%1'.",
+        messageId: "SVC4122"
+    }
+
+-----------SVC4123---------------------------
+=============================================
+
+::
+
+    ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Artifact logical name cannot be changed.",
+        messageId: "SVC4123"
+    }
+
+-----------SVC4124---------------------------
+=============================================
+
+::
+
+    MISSING_ARTIFACT_TYPE: {
+        code: 400,
+        message: "Error: Missing artifact type.",
+        messageId: "SVC4124"
+    }
+
+-----------SVC4125---------------------------
+=============================================
+
+- %1 - artifact name
+
+::
+
+    ARTIFACT_EXIST: {
+        code: 400,
+        message: "Error: Artifact '%1' already exists.",
+        messageId: "SVC4125"
+    }
+
+---------SVC4126------------------------------
+==============================================
+
+- %1 - Resource/Service/Product/...
+- %2 - field (tag, vendor name...)
+
+::
+
+    INVALID_FIELD_FORMAT: {
+        code: 400,
+        message: "Error:  Invalid %1 %2 format.",
+        messageId: "SVC4126"
+    }
+
+-----------SVC4127---------------------------
+=============================================
+
+::
+
+    ARTIFACT_INVALID_MD5: {
+        code: 400,
+        message: "Error: Invalid artifact checksum.",
+        messageId: "SVC4127"
+    }
+
+-----------SVC4128---------------------------
+=============================================
+
+::
+
+    MISSING_ARTIFACT_NAME: {
+        code: 400,
+        message: "Error: Invalid content. Missing artifact name.",
+        messageId: "SVC4128"
+    }
+
+-----------SVC4129---------------------------
+=============================================
+
+::
+
+    MISSING_PROJECT_CODE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing PROJECT_CODE number.",
+        messageId: "SVC4129"
+    }
+
+-----------SVC4130---------------------------
+=============================================
+
+::
+
+    INVALID_PROJECT_CODE: {
+        code: 400,
+        message: "Error: Invalid Content. PROJECT_CODE must be from 3 up to 50 characters.",
+        messageId: "SVC4130"
+    }
+
+-----------SVC4131---------------------------
+=============================================
+
+- %1-resource/service
+- %2-artifact/artifacts
+- %3-semicolomn separated list of artifact
+
+::
+
+    COMPONENT_MISSING_MANDATORY_ARTIFACTS: {
+        code: 403,
+        message: "Error: Missing mandatory informational %1 %2: [%3].",
+        messageId: "SVC4131"
+    }
+
+-----------SVC4132---------------------------
+=============================================
+
+- %1 - lifecycle type name
+
+::
+
+    LIFECYCLE_TYPE_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Lifecycle Type with name '%1' already exists.",
+        messageId: "SVC4132"
+    }
+
+-----------SVC4133---------------------------
+=============================================
+
+- %1 - service version
+- %2 - service name
+
+::
+
+    SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION: {
+        code: 403,
+        message: "Error: Version %1 of '%2' service is not available for distribution.",
+        messageId: "SVC4133"
+    }
+
+-----------SVC4134---------------------------
+=============================================
+
+::
+
+    MISSING_LIFECYCLE_TYPE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing interface life-cycle type.",
+        messageId: "SVC4134"
+    }
+
+---------SVC4135------------------------------
+==============================================
+
+::
+
+    SERVICE_CATEGORY_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Service category cannot be changed once the service is certified.",
+        messageId: "SVC4135"
+    }
+
+---------SVC4136------------------------------
+==============================================
+
+- %1 - distribution environment name
+
+::
+
+    DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE: {
+        code: 500,
+        message: "Error: Requested distribution environment '%1' is not available.",
+        messageId: "SVC4136"
+    }
+
+---------SVC4137------------------------------
+==============================================
+
+- %1 - distribution environment name
+
+::
+
+    DISTRIBUTION_ENVIRONMENT_NOT_FOUND: {
+        code: 400,
+        message: "Error: Requested distribution environment '%1' was not found.",
+        messageId: "SVC4137"
+    }
+
+---------SVC4138------------------------------
+==============================================
+
+::
+
+    DISTRIBUTION_ENVIRONMENT_INVALID: {
+        code: 400,
+        message: "Error: Invalid distribution environment.",
+        messageId: "SVC4138"
+    }
+
+---------SVC4139------------------------------
+==============================================
+
+- %1 - service name
+
+::
+
+    DISTRIBUTION_ARTIFACT_NOT_FOUND: {
+        code: 409,
+        message: "Error: Service '%1' cannot be distributed due to missing deployment artifacts.",
+        messageId: "SVC4139"
+    }
+
+---------SVC4200------------------------------
+==============================================
+
+- %1 - Service/Resource
+- %2 - max icon name length
+
+::
+
+    COMPONENT_ICON_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. %1 icon name exceeds limit of %2 characters.",
+        messageId: "SVC4200"
+    }
+
+---------SVC4300------------------------------
+==============================================
+
+::
+
+    RESTRICTED_ACCESS: {
+        code: 403,
+        message: "Error: Restricted access.",
+        messageId: "SVC4300"
+    }
+
+---------SVC4301------------------------------
+==============================================
+
+::
+
+    RESTRICTED_OPERATION: {
+        code: 409,
+        message: "Error: Restricted operation.",
+        messageId: "SVC4301"
+    }
+
+---------SVC4500------------------------------
+==============================================
+
+::
+
+    MISSING_BODY: {
+        code: 400  ,
+        message: "Error: Missing request body.",
+        messageId: "SVC4500"
+    }
+
+---------SVC4501------------------------------
+==============================================
+
+::
+
+    MISSING_PUBLIC_KEY: {
+        code: 400  ,
+        message: "Error: Invalid Content. Missing mandatory parameter 'apiPublicKey'." ,
+        messageId: "SVC4501"
+    }
+
+---------SVC4502------------------------------
+==============================================
+
+::
+
+    DISTRIBUTION_ENV_DOES_NOT_EXIST: {
+        code: 400  ,
+        message: "Error: Invalid  Body  : Missing mandatory parameter 'distrEnvName'." ,
+        messageId: "SVC4502"
+    }
+
+-----------SVC4503---------------------------
+=============================================
+
+- %1 - service name
+
+::
+
+    SERVICE_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' service was not found.",
+        messageId: "SVC4503"
+    }
+
+---------SVC4504------------------------------
+==============================================
+
+- %1 - Service/Resource
+- %2 - service/resource version
+
+::
+
+    COMPONENT_VERSION_NOT_FOUND: {
+        code: 404,
+        message: "Error: %1 version %2 was not found.",
+        messageId: "SVC4504"
+    }
+
+-----------SVC4505---------------------------
+=============================================
+
+- %1 - artifact name
+
+::
+
+    ARTIFACT_NOT_FOUND: {
+        code: 404,
+        message: "Error: Artifact '%1' was not found.",
+        messageId: "SVC4505"
+    }
+
+---------SVC4506------------------------------
+==============================================
+
+::
+
+    MISSING_ENV_NAME: {
+        code: 400  ,
+        message: "Error: Invalid Content. Missing mandatory parameter 'distrEnvName'.",
+        messageId: "SVC4506"
+    }
+
+---------SVC4507------------------------------
+==============================================
+
+::
+
+    COMPONENT_INVALID_TAGS_NO_COMP_NAME: {
+        code: 400,
+        message: "Error: Invalid Content. One of the tags should be the component name.",
+        messageId: "SVC4507"
+    }
+
+---------SVC4508------------------------------
+==============================================
+
+::
+
+    SERVICE_NAME_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Service name cannot be changed once the service is certified.",
+        messageId: "SVC4508"
+    }
+
+---------SVC4509------------------------------
+==============================================
+
+::
+
+    SERVICE_ICON_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Icon cannot be changed once the service is certified.",
+        messageId: "SVC4509"
+    }
+
+---------SVC4510------------------------------
+==============================================
+
+- %1 - icon name max length
+
+::
+
+    SERVICE_ICON_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Icon name exceeds limit of %1 characters.",
+        messageId: "SVC4510"
+    }
+
+---------SVC4511------------------------------
+==============================================
+
+::
+
+    DISTRIBUTION_REQUESTED_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested distribution was not found.",
+        messageId: "SVC4511"
+    }
+
+---------SVC4512------------------------------
+==============================================
+
+- %1 - Distribution ID
+
+::
+
+    DISTRIBUTION_REQUESTED_FAILED: {
+        code: 403,
+        message: "Error: Requested distribution '%1' failed.",
+        messageId: "SVC4512"
+    }
+
+---------SVC4513------------------------------
+==============================================
+
+::
+
+    RESOURCE_CATEGORY_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Resource category cannot be changed once the resource is certified.",
+        messageId: "SVC4513"
+    }
+
+---------SVC4514------------------------------
+==============================================
+
+::
+
+    RESOURCE_NAME_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Resource name cannot be changed once the resource is certified.",
+        messageId: "SVC4514"
+    }
+
+---------SVC4515------------------------------
+==============================================
+
+::
+
+    RESOURCE_ICON_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Icon cannot be changed once the resource is certified.",
+        messageId: "SVC4515"
+    }
+
+---------SVC4516------------------------------
+==============================================
+
+::
+
+    RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Vendor name cannot be changed once the resource is certified.",
+        messageId: "SVC4516"
+    }
+
+---------SVC4517------------------------------
+==============================================
+
+::
+
+    RESOURCE_DERIVED_FROM_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: Derived from resource template cannot be changed once the resource is certified.",
+        messageId: "SVC4517"
+    }
+
+---------SVC4518------------------------------
+==============================================
+
+- %1 - max length
+
+::
+
+    COMPONENT_SINGLE_TAG_EXCEED_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Single tag exceeds limit of %1 characters.",
+        messageId: "SVC4518"
+    }
+
+---------SVC4519------------------------------
+==============================================
+
+::
+
+    INVALID_DEFAULT_VALUE: {
+        code: 400,
+        message: "Error: mismatch in data-type occurred for property %1. data type is %2 and default value found is %3.",
+        messageId: "SVC4519"
+    }
+
+---------SVC4520------------------------------
+==============================================
+
+- %1 - service\resource
+
+::
+
+    ADDITIONAL_INFORMATION_MAX_NUMBER_REACHED: {
+        code: 409,
+        message: "Error: Maximal number of additional %1 parameters was reached.",
+        messageId: "SVC4520"
+    }
+
+---------SVC4521------------------------------
+==============================================
+
+::
+
+    ADDITIONAL_INFORMATION_EMPTY_STRING_NOT_ALLOWED: {
+        code: 400,
+        message: "Error: Invalid Content. The Additional information label and value cannot be empty.",
+        messageId: "SVC4521"
+    }
+
+---------SVC4522------------------------------
+==============================================
+
+- %1 - label/value
+- %2 - Maximal length of %1
+
+::
+
+    ADDITIONAL_INFORMATION_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Additional information %1 exceeds limit of %2 characters.",
+        messageId: "SVC4522"
+    }
+
+---------SVC4523------------------------------
+==============================================
+
+::
+
+    ADDITIONAL_INFORMATION_KEY_NOT_ALLOWED_CHARACTERS: {
+        code: 400,
+        message: 'Error: Invalid Content. Additional information label is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4523"
+    }
+
+---------SVC4524------------------------------
+==============================================
+
+::
+
+    ADDITIONAL_INFORMATION_NOT_FOUND: {
+        code: 409,
+        message: "Error: Requested additional information was not found.",
+        messageId: "SVC4524"
+    }
+
+---------SVC4525------------------------------
+==============================================
+
+::
+
+    ADDITIONAL_INFORMATION_VALUE_NOT_ALLOWED_CHARACTERS: {
+        code: 400,
+        message: 'Error: Invalid Content. Additional information contains non-english characters.',
+        messageId: "SVC4525"
+    }
+
+---------SVC4526------------------------------
+==============================================
+
+::
+
+    RESOURCE_INSTANCE_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' resource instance was not found.",
+        messageId: "SVC4526"
+    }
+
+---------SVC4527------------------------------
+==============================================
+
+::
+
+    ASDC_VERSION_NOT_FOUND: {
+        code: 500,
+        message: 'Error: ASDC version cannot be displayed.',
+        messageId: "SVC4527"
+    }
+
+---------SVC4528------------------------------
+==============================================
+
+- %1-artifact url/artifact label/artifact description/VNF Service Indicator
+
+::
+
+    MISSING_DATA: {
+        code: 400,
+        message: "Error: Invalid content. Missing %1.",
+        messageId: "SVC4528"
+    }
+
+---------SVC4529------------------------------
+==============================================
+
+- %1-artifact url/artifact label/artifact description/artifact name
+- %2 - Maximal length of %1
+
+::
+
+    EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. %1 exceeds limit of %2 characters.",
+        messageId: "SVC4529"
+    }
+
+---------SVC4530------------------------------
+==============================================
+
+::
+
+    ARTIFACT_INVALID_TIMEOUT: {
+        code: 400,
+        message: "Error: Invalid Content. Artifact Timeout should be set to valid positive non-zero number of minutes.",
+        messageId: "SVC4530"
+    }
+
+---------SVC4531------------------------------
+==============================================
+
+::
+
+    SERVICE_IS_VNF_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: VNF Indicator cannot be updated for certified service.",
+        messageId: "SVC4531"
+    }
+
+---------SVC4532------------------------------
+==============================================
+
+::
+
+    RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE: { 
+        code: 404,
+        message: "Error: Requested '%1' resource instance was not found on the service '%2.",
+        messageId: "SVC4532"
+    }
+
+---------SVC4533------------------------------
+==============================================
+
+- %1 - artifact name("HEAT"/"HEAT_ENV"/"MURANO_PKG"/"YANG_XML")
+
+::
+
+    WRONG_ARTIFACT_FILE_EXTENSION: { 
+        code: 400,
+        message: "Error: Invalid file extension for %1 artifact type.",
+        messageId: "SVC4533"
+    }
+
+---------SVC4534------------------------------
+==============================================
+
+- %1 - "HEAT"/"HEAT_ENV"
+
+::
+
+    INVALID_YAML: {
+        code: 400,
+        message: "Error: Uploaded YAML file for %1 artifact is invalid.",
+        messageId: "SVC4534"
+    }
+
+---------SVC4535------------------------------
+==============================================
+
+- %1 - "HEAT"
+
+::
+
+    INVALID_DEPLOYMENT_ARTIFACT_HEAT: {
+        code: 400,
+        message: "Error: Invalid %1 artifact.",
+        messageId: "SVC4535"
+    }
+
+---------SVC4536------------------------------
+==============================================
+
+- %1 - Resource/Service
+- %2 - Resource/Service name
+- %3 - "HEAT"/"HEAT_ENV"/"MURANO_PKG"
+- %4 - "HEAT"/"HEAT_ENV"/"MURANO_PKG
+
+::
+
+    DEPLOYMENT_ARTIFACT_OF_TYPE_ALREADY_EXISTS: {
+        code: 400,
+        message: "Error: %1 '%2' already has a deployment artifact of %3 type .Please delete or update an existing %4 artifact.",
+        messageId: "SVC4536"
+    }
+
+---------SVC4537------------------------------
+==============================================
+
+::
+
+    MISSING_HEAT: {
+        code: 400,
+        message: "Error: Missing HEAT artifact. HEAT_ENV artifact cannot be uploaded without corresponding HEAT template.",
+        messageId: "SVC4537"
+    }
+
+---------SVC4538------------------------------
+==============================================
+
+::
+
+    MISMATCH_HEAT_VS_HEAT_ENV: {
+        code: 400,
+        message: "Error: Invalid artifact content. Parameter's set in HEAT_ENV '%1' artifact doesn't match the parameters in HEAT '%2' artifact.",
+        messageId: "SVC4538"
+    }
+
+---------SVC4539------------------------------
+==============================================
+
+::
+
+    INVALID_RESOURCE_PAYLOAD: {
+        code: 400,
+        message: "Error: Invalid resource payload.",
+        messageId: "SVC4539"
+    }
+
+---------SVC4540------------------------------
+==============================================
+
+::
+
+    INVALID_TOSCA_FILE_EXTENSION: {
+        code: 400,
+        message: "Error: Invalid file extension for TOSCA template.",
+        messageId: "SVC4540"
+    }
+
+---------SVC4541------------------------------
+==============================================
+
+::
+
+    INVALID_YAML_FILE: {
+        code: 400,
+        message: "Error: Invalid YAML file.",
+        messageId: "SVC4541"
+    }
+
+---------SVC4542------------------------------
+==============================================
+
+::
+
+    INVALID_TOSCA_TEMPLATE: {
+        code: 400,
+        message: "Error: Invalid TOSCA template.",
+        messageId: "SVC4542"
+    }
+
+---------SVC4543------------------------------
+==============================================
+
+::
+
+    NOT_RESOURCE_TOSCA_TEMPLATE: {
+        code: 400,
+        message: "Error: Imported Service TOSCA template.",
+        messageId: "SVC4543"
+    }
+
+---------SVC4544------------------------------
+==============================================
+
+::
+
+    NOT_SINGLE_RESOURCE: {
+        code: 400,
+        message: "Error: Imported TOSCA template should contain one resource definition.",
+        messageId: "SVC4544"
+    }
+
+---------SVC4545------------------------------
+==============================================
+
+::
+
+    INVALID_RESOURCE_NAMESPACE: {
+        code: 400,
+        message: "Error: Invalid resource namespace.",
+        messageId: "SVC4545"
+    }
+
+---------SVC4546------------------------------
+==============================================
+
+::
+
+    RESOURCE_ALREADY_EXISTS: {
+        code: 400,
+        message: "Error: Imported resource already exists in ASDC Catalog.",
+        messageId: "SVC4546"
+    }
+
+---------SVC4549------------------------------
+==============================================
+
+::
+
+    INVALID_RESOURCE_CHECKSUM: {
+        code: 400,
+        message: "Error: Invalid resource checksum.",
+        messageId: "SVC4549"
+    }
+
+---------SVC4550------------------------------
+==============================================
+
+- %1 - Consumer salt
+
+::
+
+    INVALID_LENGTH: {
+        code: 400,
+        message: "Error: Invalid %1 length.",
+        messageId: "SVC4550"
+    }
+
+---------SVC4551------------------------------
+==============================================
+    
+- %1 - ECOMP User name
+
+::
+
+    ECOMP_USER_NOT_FOUND: {
+        code: 404,
+        message: "Error: ECOMP User '%1' was not found.",
+        messageId: "SVC4551"
+    }
+
+---------SVC4552------------------------------
+==============================================
+
+::
+
+    CONSUMER_ALREADY_EXISTS: {
+        code: 409,
+        message: "Error: ECOMP User already exists.",
+        messageId: "SVC4552"
+    }
+
+---------SVC4553-----------------------------
+=============================================
+
+- %1 - Consumer name / Consumer password/ Consumer salt
+
+::
+
+    INVALID_CONTENT_PARAM: {
+        code: 400,
+        message: "Error: %1 is invalid.",
+        messageId: "SVC4553"
+    }
+
+---------SVC4554------------------------------
+==============================================
+
+- %1 - "Resource"/"Service"
+
+::
+
+    COMPONENT_ARTIFACT_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested artifact doesn't belong to specified %1.",
+        messageId: "SVC4554"
+    }
+
+---------SVC4554------------------------------
+==============================================
+
+- %1 - "Service name"
+
+::
+
+    SERVICE_DEPLOYMENT_ARTIFACT_NOT_FOUND: {
+        code: 403,
+        message: "Error: Requested '%1' service is not ready for certification. Service has to have at least one deployment artifact.",
+        messageId: "SVC4554"
+    }
+
+---------SVC4555------------------------------
+==============================================
+
+- %1 - Resource/Service/Product
+- %2 - Category"
+
+::
+
+    COMPONENT_ELEMENT_INVALID_NAME_LENGTH: {
+        code: 400,
+        message: "Error: Invalid %1 %2 name length.",
+        messageId: "SVC4555"
+    }
+
+---------SVC4556------------------------------
+==============================================
+
+%1 - Resource/Service/Product
+%2 - Category"
+
+::
+
+    COMPONENT_ELEMENT_INVALID_NAME_FORMAT: {
+        code: 400,
+        message: "Error: Invalid %1 %2 name format.",
+        messageId: "SVC4556"
+    }
+
+---------SVC4557------------------------------
+==============================================
+
+- %1 - Resource/Service/Product
+- %2 - Category name"
+
+::
+
+    COMPONENT_CATEGORY_ALREADY_EXISTS: {
+        code: 409,
+        message: "Error: %1 category name '%2' already exists.",
+        messageId: "SVC4557"
+    }
+
+---------SVC4558------------------------------
+==============================================
+
+- %1 - service/VF
+- %2 - Resource name
+
+::
+
+    VALIDATED_RESOURCE_NOT_FOUND: {
+        code: 403,
+        message: "Error: Submit for Testing is not permitted as your '%1' includes non-validated '%2' resource.",
+        messageId: "SVC4558"
+    }
+
+---------SVC4559------------------------------
+==============================================
+
+- %1 - Service/VF
+- %2 - Resource name
+
+::
+
+    FOUND_ALREADY_VALIDATED_RESOURCE: {
+        code: 403,
+        message: "Error: Submit for Testing is not permitted as your '%1' includes non-validated '%2' resource. Please use already available validated resource version.",
+        messageId: "SVC4559"
+    }
+
+---------SVC4560------------------------------
+==============================================
+
+- %1 - Service/VF
+- %2 - Resource name
+
+::
+
+    FOUND_LIST_VALIDATED_RESOURCES: {
+        code: 403,
+        message: "Error: Submit for Testing is not permitted as your '%1' includes non-validated '%2' resource. Please use one of available validated resource versions.",
+        messageId: "SVC4560"
+    }
+
+---------SVC4561------------------------------
+==============================================
+
+- %1 - Resource/Product
+- %2 - Category
+- %3 - Category name
+
+::
+
+    COMPONENT_CATEGORY_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested %1 %2 '%3' was not found.",
+        messageId: "SVC4561"
+    }
+
+---------SVC4562------------------------------
+==============================================
+
+- %1 - Resource/Product
+- %2 - Sub-Category name
+- %3 - Category name
+
+::
+
+    COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY: {
+        code: 409,
+        message: "Error: %1 sub-category '%2' already exists under '%3' category.",
+        messageId: "SVC4562"
+    }
+
+---------SVC4563------------------------------
+==============================================
+
+- %1 - Product
+- %2 - Grouping name
+- %3 - Sub-Category name
+
+::
+
+    COMPONENT_GROUPING_EXISTS_FOR_SUB_CATEGORY: {
+        code: 409,
+        message: "Error: %1 grouping '%2' already exists under '%3' sub-category.",
+        messageId: "SVC4563"
+    }
+
+---------SVC4564------------------------------
+==============================================
+
+- %1 - Product name
+
+::
+
+    PRODUCT_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' product was not found.",
+        messageId: "SVC4564"
+    }
+
+---------SVC4565------------------------------
+==============================================
+
+- %1 - "HEAT"
+- %2 - Parameter type ("string" , "boolean" , "number")
+- %3 - Parameter name
+
+::
+
+    INVALID_HEAT_PARAMETER_VALUE: {
+        code: 400,
+        message: "Error: Invalid %1 artifact. Invalid %2 value set for '%3' parameter.",
+        messageId: "SVC4565"
+    }
+
+---------SVC4566------------------------------
+==============================================
+
+- %1 - "HEAT"
+- %2 - Parameter type ("string" , "boolean" , "number")
+
+::
+
+    INVALID_HEAT_PARAMETER_TYPE: {
+        code: 400,
+        message: "Error: Invalid %1 artifact. Unsupported '%2' parameter type.",
+        messageId: "SVC4566"
+    }
+
+---------SVC4567------------------------------
+==============================================
+
+- %1 - "YANG_XML"
+
+::
+
+    INVALID_XML: {
+        code: 400,
+        message: "Error: Uploaded XML file for %1 artifact is invalid.",
+        messageId: "SVC4567"
+    }
+
+---------SVC4567------------------------------
+==============================================
+
+- %1 - User Name and UserId
+- %2 - Checked-out/In-certification
+
+::
+
+    CANNOT_DELETE_USER_WITH_ACTIVE_ELEMENTS: {
+        code: 409,
+        message: "Error: User cannot be deleted. User '%1' has %2 projects.",
+        messageId: "SVC4567"
+    }
+
+---------SVC4568------------------------------
+==============================================
+
+- %1 - User Name and UserId
+- %2 - Checked-out/In-certification
+
+::
+
+    CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS: {
+        code: 409,
+        message: "Error: Role cannot be changed. User '%1' has %2 projects.",
+        messageId: "SVC4568"
+    }
+
+---------SVC4570------------------------------
+==============================================
+
+::
+
+    UPDATE_USER_ADMIN_CONFLICT: {
+        code: 409,
+        message: "Error: An administrator is not allowed to change his/her role.",
+        messageId: "SVC4570"
+    }
+
+---------SVC4571------------------------------
+==============================================
+
+::
+
+    SERVICE_CANNOT_CONTAIN_SUBCATEGORY: {
+        code: 400,
+        message: "Error: Sub category cannot be defined for service",
+        messageId: "SVC4571"
+    }
+
+---------SVC4572------------------------------
+==============================================
+
+- %1 - Resource/Service
+
+::
+
+    COMPONENT_TOO_MUCH_CATEGORIES: {
+        code: 400,
+        message: "Error: %1 must have only 1 category",
+        messageId: "SVC4572"
+    }
+
+---------SVC4574------------------------------
+==============================================
+
+::
+
+    RESOURCE_TOO_MUCH_SUBCATEGORIES: {
+        code: 400,
+        message: "Error: Resource must have only 1 sub category",
+        messageId: "SVC4574"
+    }
+
+---------SVC4575------------------------------
+==============================================
+
+::
+
+    COMPONENT_MISSING_SUBCATEGORY: {
+        code: 400,
+        message: "Error: Missing sub category",
+        messageId: "SVC4575"
+    }
+
+---------SVC4576------------------------------
+==============================================
+
+- %1 - Component type
+
+::
+
+    UNSUPPORTED_ERROR: {
+        code: 400,
+        message: "Error : Requested component type %1 is unsupported.",
+        messageId: "SVC4576"
+    }
+
+---------SVC4577------------------------------
+==============================================
+
+- %1 - Resource type
+
+::
+
+    RESOURCE_CANNOT_CONTAIN_RESOURCE_INSTANCES: {
+        code: 409,
+        message: "Error : Resource of type %1 cannot contain resource instances.",
+        messageId: "SVC4577"
+    }
+
+---------SVC4578------------------------------
+==============================================
+
+- %1 - Resource/Service 
+- %2 - Resource/Service name 
+- %3 - Artifact name
+
+::
+
+    DEPLOYMENT_ARTIFACT_NAME_ALREADY_EXISTS: {
+        code: 400,
+        message: "Error: %1 '%2' already has a deployment artifact named '%3'.",
+        messageId: "SVC4578"
+    }
+
+---------SVC4579------------------------------
+==============================================
+
+- %1 - "Category/Sub-Category/Group"
+- %2 - Category/Sub-Category/Grouping name.
+
+::
+
+    INVALID_GROUP_ASSOCIATION: {
+        code: 400,
+        message: "Error: Invalid group association. %1 '%2' was not found.",
+        messageId: "SVC4579"
+    }
+
+---------SVC4580------------------------------
+==============================================
+
+::
+
+    EMPTY_PRODUCT_CONTACTS_LIST: {
+        code: 400,
+        message: "Error: Invalid content. At least one Product Contact has to be specified.",
+        messageId: "SVC4580"
+    }
+
+---------SVC4581------------------------------
+==============================================
+
+- %1 - UserId
+
+::
+
+    INVALID_PRODUCT_CONTACT: {
+        code: 400,
+        message: "Error: Invalid content. User '%1' cannot be set as Product Contact.",
+        messageId: "SVC4581"
+    }
+
+---------SVC4582------------------------------
+==============================================
+
+- %1 - Product
+- %2 - Aabbreviated/Full"
+
+::
+
+    MISSING_ONE_OF_COMPONENT_NAMES: {
+        code: 400,
+        message: "Error: Invalid content. Missing %1 %2 name.",
+        messageId: "SVC4582"
+    }
+
+---------SVC4583------------------------------
+==============================================
+
+- %1 - Icon
+- %2 - Resource/Service/Product
+
+::
+
+    COMPONENT_PARAMETER_CANNOT_BE_CHANGED: {
+        code: 400,
+        message: "Error: %1 cannot be changed once the %2 is certified.",
+        messageId: "SVC4583"
+    }
+
+---------SVC4584------------------------------
+==============================================
+
+- %1 - Service/VF name
+- %2 - Service/VF 
+- %3 - Resource instance origin type 
+- %4 - Resource instance name 
+- %5 - Requirement/Capability 
+- %6 - Requirement/Capability name 
+- %7 - Fulfilled" (for req)/Consumed (forcap)
+
+::
+
+    REQ_CAP_NOT_SATISFIED_BEFORE_CERTIFICATION: {
+        code: 403,
+        message: "Error: Requested '%1' %2 is not ready for certification. %3'%4' has to have %5 '%6' %7.",
+        messageId: "SVC4584" 
+    }
+
+---------SVC4585------------------------------
+==============================================
+
+::
+
+    INVALID\_OCCURRENCES: {
+        code: 400,
+        message: "Error: Invalid occurrences format.",
+        messageId: "SVC4585"
+    }
+
+---------SVC4586------------------------------
+==============================================
+
+::
+
+    INVALID_SERVICE_API_URL:{
+        code: 400,
+        message: 'Error: Invalid Service API URL. Please check whether your URL has a valid domain extension 
+                'and does not contain the following characters - #?&@%+;,=$<>~^\`[]{}\|"\*!',
+        messageId: "SVC4586"
+    }
+
+---------SVC4587------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_ALREADY_EXIST: {
+        code: 409,
+        message: 'Error: Data type %1 already exists.',
+        messageId: "SVC4587"
+    }
+
+---------SVC4588------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_NOR_PROPERTIES_NEITHER_DERIVED_FROM: {
+        code: 400,
+        message: 'Error: Invalid Data type %1. Data type must have either a valid derived from declaration or at least one valid property',
+        messageId: "SVC4588"
+    }
+
+---------SVC4589------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_PROPERTIES_CANNOT_BE_EMPTY: {
+        code: 400,
+        message: "Error: Invalid Data type %1. 'properties' parameter cannot be empty if provided.",
+        messageId: "SVC4589"
+    }
+
+---------SVC4590------------------------------
+==============================================
+
+- %1 - Property type name
+- %2 - Property name
+
+::
+
+    INVALID_PROPERTY_TYPE: {
+        code: 400,
+        message: "Error: Invalid Property type %1 in property %2.",
+        messageId: "SVC4590"
+    }
+
+---------SVC4591------------------------------
+==============================================
+
+- %1 - Property inner type
+- %2 - Property name
+
+::
+
+    INVALID_PROPERTY_INNER_TYPE: {
+        code: 400,
+        message: "Error: Invalid property inner type %1, in property %2",
+        messageId: "SVC4591"
+    }
+
+---------SVC4592------------------------------
+==============================================
+
+- %1 - Component instance name
+- %2 - Resource instance/Service instance
+
+::
+
+    COMPONENT_INSTANCE_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' %2 was not found.",
+        messageId: "SVC4592"
+    }
+
+---------SVC4593------------------------------
+==============================================
+
+- %1 - Component instance name
+- %2 - Resource instance/Service instance
+- %3 - Resource/Service/Product
+- %4 - Container name
+
+::
+
+    COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER: {
+        code: 404,
+        message: "Error: Requested '%1' %2 was not found on the %3 '%4'.",
+        messageId: "SVC4593"
+    }
+
+---------SVC4594------------------------------
+==============================================
+
+- %1 - Requirement/Capability
+- %2 - Requirement name
+
+::
+
+    IMPORT_DUPLICATE_REQ_CAP_NAME: {
+        code: 400,
+        message: "Error: Imported TOSCA template contains more than one %1 named '%2'.",
+        messageId: "SVC4594"
+    }
+
+---------SVC4595------------------------------
+==============================================
+
+- %1 - Requirement/Capability
+- %2 - Requirement name
+- %3 - Parent containing the requirement
+
+::
+
+    IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED: {
+        code: 400,
+        message: "Error: Imported TOSCA template contains %1 '%2' that is already defined by derived template %3.",
+        messageId: "SVC4595"
+    }
+
+---------SVC4596------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_DERIVED_IS_MISSING: {
+        code: 400,
+        message: "Error: Invalid Content. The ancestor data type %1 cannot be found in the system.",
+        messageId: "SVC4596"
+    }
+
+---------SVC4597------------------------------
+==============================================
+
+- %1 - Data type name
+- %2 - Property names
+
+::
+
+    DATA_TYPE_PROPERTY_ALREADY_DEFINED_IN_ANCESTOR: {
+        code: 400,
+        message: "Error: Invalid Content. The data type %1 contains properties named %2 which are already defined in one of its ancestors.",
+        messageId: "SVC4597"
+    }
+
+---------SVC4598------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_DUPLICATE_PROPERTY: {
+        code: 400,
+        message: "Error: Invalid Content. The data type %1 contains duplicate property.",
+        messageId: "SVC4598"
+    }
+
+---------SVC4599------------------------------
+==============================================
+
+- %1 - Data type name
+- %2 - Property names
+
+::
+
+    DATA_TYPE_PROEPRTY_CANNOT_HAVE_SAME_TYPE_OF_DATA_TYPE: {
+        code: 400,
+        message: "Error: Invalid Content. The data type %1 contains properties %2 which their type is this data type.",
+        messageId: "SVC4599"
+    }
+
+---------SVC4600------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_CANNOT_HAVE_PROPERTIES: {
+        code: 400,
+        message: "Error: Invalid Content. The data type %1 cannot have properties since it is of type scalar",
+        messageId: "SVC4600"
+    }
+
+---------SVC4601------------------------------
+==============================================
+
+::
+
+    NOT_TOPOLOGY_TOSCA_TEMPLATE: {
+        code: 400,
+        message: "Error: TOSCA yaml file %1 cannot be modeled to VF as it does not contain 'topology_template.",
+        messageId: "SVC4601"
+    }
+
+---------SVC4602--------------------------------
+================================================
+
+- %1 - YAML file name
+- %2 - Node_Template label
+- %3 - Node_Template type
+
+::
+
+    INVALID_NODE_TEMPLATE: {
+        code: 400,
+        message: "Error: TOSCA yaml file '%1' contains node_template '%2' of type '%3' that does not represent existing VFC/CP/VL",
+        messageId: "SVC4602"
+    }
+
+---------SVC4603------------------------------
+==============================================
+
+- %1 - Component type
+- %2 - Component name
+- %3 - State
+
+::
+
+    ILLEGAL_COMPONENT_STATE: {
+        code: 403,
+        message: "Error: Component instance of %1 can not be created because the component '%2' is in an illegal state %3.",
+        messageId: "SVC4603"
+    }
+
+---------SVC4604------------------------------
+==============================================
+
+- %1 - CSAR file name
+
+::
+
+    CSAR_INVALID: {
+        code: 400,
+        message: "Error: TOSCA CSAR '%1' is invalid. 'TOSCA-Metadata/Tosca.meta' file must be provided.",
+        messageId: "SVC4604"
+    }
+
+---------SVC4605------------------------------
+==============================================
+
+- %1 - CSAR file name
+
+::
+
+    CSAR_INVALID_FORMAT: {
+        code: 400,
+        message: "Error: TOSCA CSAR '%1' is invalid. Invalid 'TOSCA-Metadata/Tosca.meta' file format.",
+        messageId: "SVC4605"
+    }
+
+---------SVC4606------------------------------
+==============================================
+
+- %1 - Property name
+- %2 - Property type
+- %3 - Property innerType
+- %4 - Default value
+
+::
+
+    INVALID_COMPLEX_DEFAULT_VALUE: {
+        code: 400,
+        message: "Error: Invalid default value of property %1. Data type is %2 with inner type %3 and default value found is %4.",
+        messageId: "SVC4606"
+    }
+
+---------SVC4607------------------------------
+==============================================
+
+- %1 - csar file name
+
+::
+
+    CSAR_NOT_FOUND: {
+        code: 400,
+        message: "Error: TOSCA CSAR '%1' is not found.",
+        messageId: "SVC4607"
+    }
+
+---------SVC4608------------------------------
+==============================================
+
+- %1 - Artifact name
+- %2 - Component type
+- %3 - Actual component type
+
+::
+
+    MISMATCH_BETWEEN_ARTIFACT_TYPE_AND_COMPONENT_TYPE: {
+        code: 400,
+        message: "Error: Artifact %1 is only compatible with component of type %2, but component type is %3.",
+        messageId: "SVC4608"
+    }
+
+---------SVC4609------------------------------
+==============================================
+
+- %1 - INVALID_JSON
+
+::
+
+    INVALID_JSON: {
+        code: 400,
+        message: "Error: Uploaded JSON file for %1 artifact is invalid.",
+        messageId: "SVC4609"
+    }
+
+---------SVC4610------------------------------
+==============================================
+
+- %1 - CSAR file name
+- %2 - Missing file name
+
+::
+
+    YAML_NOT_FOUND_IN_CSAR: {
+        code: 400,
+        message: "Error - TOSCA CSAR %1 is invalid. TOSCA-Metadata/Tosca.meta refers to file %2 that is not provided.",
+        messageId: "SVC4610"
+    }
+
+---------SVC4611------------------------------
+==============================================
+
+- %1 - Group name
+
+::
+
+    GROUP_MEMBER_EMPTY: {
+        code: 400,
+        message: "Error: Invalid Content. Group %1 member list was provided but does not have values",
+        messageId: "SVC4611"
+    }
+
+---------SVC4612------------------------------
+==============================================
+
+- %1 - Group name
+
+::
+
+    GROUP_TYPE_ALREADY_EXIST: {
+        code: 409,
+        message: 'Error: Group type %1 already exists.',
+        messageId: "SVC4612"
+    }
+
+---------SVC4613------------------------------
+==============================================
+
+- %1 - Group name
+- %2 - VF name(component name)
+- %3 - Actual component type [VF]
+
+::
+
+    GROUP_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Group with name '%1' already exists in %2 %3.",
+        messageId: "SVC4613"
+    }
+
+---------SVC4614------------------------------
+==============================================
+
+- %1 - Group type
+
+::
+
+    GROUP_TYPE_IS_INVALID: {
+        code: 400,
+        message: "Error: Invalid content. Group type %1 does not exist",
+        messageId: "SVC4614"
+    }
+
+---------SVC4615------------------------------
+==============================================
+
+- %1 - group name
+
+::
+
+    GROUP_MISSING_GROUP_TYPE: {
+        code: 400,
+        message: "Error: Invalid Content. Missing Group Type for group '%1'",
+        messageId: "SVC4615"
+    }
+
+---------SVC4616------------------------------
+==============================================
+
+- %1 - Member name
+- %2 - Group name
+- %3 - VF name
+- %4 - Component type [VF ]
+
+::
+
+    GROUP_INVALID_COMPONENT_INSTANCE: {
+        code: 400,
+        message: "Error: Member '%1' listed in group '%2' is not part of '%3' %4.",
+        messageId: "SVC4616"
+    }
+
+---------SVC4617------------------------------
+==============================================
+
+- %1 - Member name
+- %2 - Group name
+- %3 - Group type
+
+::
+
+    GROUP_INVALID_TOSCA_NAME_OF_COMPONENT_INSTANCE: {
+        code: 400,
+        message: "Error: member %1 listed in group %2 is not part of allowed members of group type %3.",
+        messageId: "SVC4617"
+    }
+
+---------SVC4618------------------------------
+==============================================
+
+- %1 - Missing file name
+- %2 - CSAR file name
+
+::
+
+    ARTIFACT_NOT_FOUND_IN_CSAR: {
+        code: 400,
+        message: "Error: artifact %1 is defined in CSAR %2 manifest but is not provided",
+        messageId: "SVC4618"
+    }
+
+---------SVC4619------------------------------
+==============================================
+
+- %1 - Artifact name
+- %2 - Artifact type
+- %3 - Existing artifact type
+
+::
+
+    ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR: {
+        code: 400,
+        message: "Error: artifact %1 in type %2 already exists in type %3.",
+        messageId: "SVC4619"
+    }
+
+---------SVC4620------------------------------
+==============================================
+
+::
+
+    FAILED_RETRIVE_ARTIFACTS_TYPES: {
+        code: 400,
+        message: "Error: Failed to retrieve list of suported artifact types.",
+        messageId: "SVC4620"
+    }
+
+---------SVC4621------------------------------
+==============================================
+
+- %1 - Artifact name
+- %2 - Master
+
+::
+
+    ARTIFACT_ALRADY_EXIST_IN_MASTER_IN_CSAR: {
+        code: 400,
+        message: "Error: artifact %1 already exists in master %2 .",
+        messageId: "SVC4621"
+    }
+
+---------SVC4622------------------------------
+==============================================
+
+- %1 - Artifact name
+- %2 - Artifact type
+- %3 - Master name
+- %4 - Master type
+
+::
+
+    ARTIFACT_NOT_VALID_IN_MASTER: {
+        code: 400,
+        message: "Error: artifact %1 in type %2 can not be exists under master %3 in type %4.",
+        messageId: "SVC4622"
+    }
+
+---------SVC4623------------------------------
+==============================================
+
+- %1 - Artifact name
+- %2 - Artifact type
+- %3 - Env name
+- %4 - Existing env
+
+::
+
+    ARTIFACT_NOT_VALID_ENV: {
+        code: 400,
+        message: "Error: Artifact %1 in type %2 with env %3 already exists with another env %4",
+        messageId: "SVC4623"
+    }
+
+---------SVC4624------------------------------
+==============================================
+
+- %1 - Groups names
+- %2 - VF name
+- %3 - Component type [VF ]
+
+::
+
+    GROUP_IS_MISSING: {
+        code: 400,
+        message: "Error: Invalid Content. The groups '%1' cannot be found under %2 %3.",
+        messageId: "SVC4624"
+    }
+
+---------SVC4625------------------------------
+==============================================
+
+- %1 - Groups name
+
+::
+
+    GROUP_ARTIFACT_ALREADY_ASSOCIATED: {
+        code: 400,
+        message: "Error: Invalid Content. Artifact already associated to group '%1'.",
+        messageId: "SVC4625"
+    }
+
+---------SVC4626------------------------------
+==============================================
+
+- %1 - Groups name
+
+::
+
+    GROUP_ARTIFACT_ALREADY_DISSOCIATED: {
+        code: 400,
+        message: "Error: Invalid Content. Artifact already dissociated from group '%1'.",
+        messageId: "SVC4626"
+    }
+
+---------SVC4627------------------------------
+==============================================
+
+- %1 - Property name
+- %2 - Group name
+- %3 - Group type name
+
+::
+
+    GROUP_PROPERTY_NOT_FOUND: {
+        code: 400,
+        message: "Error: property %1 listed in group %2 is not exist in group type %3.",
+        messageId: "SVC4627"
+    }
+
+---------SVC4628------------------------------
+==============================================
+
+- %1 - CSAR UUID
+- %2 - VF name
+
+::
+
+    VSP_ALREADY_EXISTS: {
+        code: 400,
+        message: "Error: The VSP with UUID %1 was already imported for VF %2. Please select another or update the existing VF.",
+        messageId: "SVC4628"
+    }
+
+---------SVC4629------------------------------
+==============================================
+
+- %1 - VF name
+
+::
+
+    MISSING_CSAR_UUID: {
+        code: 400,
+        message: "Error: The Csar UUID or payload name is missing for VF %1.",
+        messageId: "SVC4629"
+    }
+
+---------SVC4630------------------------------
+==============================================
+
+- %1 - VF name
+- %2 - New CSAR UUID
+- %3 - Old CSAR UUID
+
+::
+
+    RESOURCE_LINKED_TO_DIFFERENT_VSP: {
+        code: 400,
+        message: "Error: Resource %1 cannot be updated using CsarUUID %2 since the resource is linked to a different VSP with csarUUID %3.",
+        messageId: "SVC4630"
+    }
+
+---------SVC4631------------------------------
+==============================================
+
+- %1 - Policy name
+
+::
+
+    POLICY_TYPE_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Policy type %1 already exists.",
+        messageId: "SVC4631"
+    }
+
+---------SVC4632------------------------------
+==============================================
+
+- %1 - Target name
+- %2 - Policy type name
+
+::
+
+    TARGETS_NON_VALID: {
+        code: 400,
+        message: "Error: target %1 listed in policy type %2 is not a group or resource.",
+        messageId: "SVC4632"
+    }
+
+---------SVC4633------------------------------
+==============================================
+
+- %1 - Policy name
+
+::
+
+    TARGETS_EMPTY: {
+        code: 400,
+        message: "Error: Invalid Content. Policy %1 target list was provided but does not have values",
+        messageId: "SVC4633"
+    }
+
+---------SVC4634------------------------------
+==============================================
+
+::
+
+    DATA_TYPE_CANNOT_BE_EMPTY: {
+        code: 500,
+        message: "Error: Data types are empty. Please import the data types.",
+        messageId: "SVC4634"
+    }
+
+---------SVC4635------------------------------
+==============================================
+
+- %1 - CSAR UUID
+
+::
+
+    RESOURCE_FROM_CSAR_NOT_FOUND: {
+        code: 400,
+        message: "Error: resource from csar uuid %1 not found",
+        messageId: "SVC4635"
+    }
+
+---------SVC4636------------------------------
+==============================================
+
+- %1 - Data type name
+
+::
+
+    DATA_TYPE_CANNOT_BE_UPDATED_BAD_REQUEST: {
+        code: 400,
+        message: 'Error: Data type %1 cannot be upgraded. The new data type does not contain old properties or the type of one of the properties has been changed.',
+        messageId: "SVC4636"
+    }
+
+-----------SVC4637---------------------------
+=============================================
+
+- %1 - Attribute name
+
+::
+
+    ATTRIBUTE_NOT_FOUND: {
+        code: 404,
+        message: "Error: Requested '%1' attribute was not found.",
+        messageId: "SVC4637"
+    }
+
+-----------SVC4638---------------------------
+=============================================
+
+- %1 - Attribute name
+
+::
+
+    ATTRIBUTE_ALREADY_EXIST: {
+        code: 409,
+        message: "Error: Attribute with '%1' name already exists.",
+        messageId: "SVC4638"
+    }
+
+-----------SVC4639---------------------------
+=============================================
+
+- %1 - Property name
+
+::
+
+    PROPERTY_NAME_ALREADY_EXISTS: {
+        code: 409,
+        message: "Error: Property with '%1' name and different type already exists.",
+        messageId: "SVC4639"
+    }
+
+-----------SVC4640---------------------------
+=============================================
+
+- %1 - Property name
+
+::
+
+    INVALID_PROPERTY: {
+        code: 409,
+        message: "Error: Invalid property received.",
+        messageId: "SVC4640"
+    }
+
+---------SVC4641-----------------------------
+=============================================
+
+- %1 - Invalid filter
+- %2 - Valid filters
+
+::
+
+    INVALID_FILTER_KEY: {
+        code: 400,
+        message: "Error: The filter %1 is not applicable. Please use one of the following filters: %2",
+        messageId: "SVC4641"
+    }
+
+---------SVC4642-----------------------------
+=============================================
+
+- %1 - Asset type
+- %2 - Filter
+
+::
+
+    NO_ASSETS_FOUND: {
+        code: 404,
+        message: "No %1 were found to match criteria %2",
+        messageId: "SVC4642"
+    }
+
+---------SVC4643------------------------------
+==============================================
+
+- %1 - Resource"/"Product
+- %2 - Sub-Category name
+- %3 - Category name
+
+::
+
+    COMPONENT_SUB_CATEGORY_NOT_FOUND_FOR_CATEGORY: {
+        code: 404,
+        message: "Error: %1 sub-category '%2' not found under category '%3'.",
+        messageId: "SVC4643"
+    }
+
+---------SVC4644------------------------------
+==============================================
+
+- %1 - Format
+
+::
+
+    CORRUPTED_FORMAT: {
+        code: 400,
+        message: "Error: %1 format is corrupted.",
+        messageId: "SVC4644"
+    }
+
+---------SVC4645------------------------------
+==============================================
+
+- %1 - GroupType
+
+::
+
+    INVALID_VF_MODULE_TYPE: {
+        code: 400,
+        message: "Error: Invalid group type '%1' (should be VfModule).",
+        messageId: "SVC4645"
+    }
+
+---------SVC4646------------------------------
+==============================================
+
+- %1 - GroupName
+
+::
+
+    INVALID_VF_MODULE_NAME: {
+        code: 400,
+        message: "Error: Invalid Content. VF Module name '%1' contains invalid characters",
+        messageId: "SVC4646"
+    }
+
+---------SVC4647------------------------------
+==============================================
+
+- %1 - ModifiedName
+
+::
+
+    INVALID_VF_MODULE_NAME_MODIFICATION: {
+        code: 400,
+        message: "Error: Invalid VF Module name modification, can not modify '%1'",
+        messageId: "SVC4647"
+    }
+
+---------SVC4648------------------------------
+==============================================
+
+- %1 - InputId
+- %2 - ComponentId
+
+::
+
+    INPUT_IS_NOT_CHILD_OF_COMPONENT: {
+        code: 400,
+        message: "Error: Input id: '%1' is not child of component id: '%2'",
+        messageId: "SVC4648"
+    }
+
+---------SVC4649------------------------------
+==============================================
+
+- %1 - GroupName
+
+::
+
+    GROUP_HAS_CYCLIC_DEPENDENCY: {
+        code: 400,
+        message: "Error: The group '%1' has cyclic dependency",
+        messageId: "SVC4649"
+    }
+
+---------SVC4650------------------------------
+==============================================
+
+- %1 - Component Type
+- %2 - Service Name
+- %3 - Error description
+
+::
+
+    AAI_ARTIFACT_GENERATION_FAILED: {
+        code: 500,
+        message: "Error: %1 %2 automatic generation of artifacts failed. Description: %3",
+        messageId: "SVC4650"
+    }
+
+---------SVC4651------------------------------
+==============================================
+
+::
+
+    PARENT_RESOURCE_DOES_NOT_EXTEND: {
+        code: 400,
+        message: "Error: Once resource is certified, derived_from can be changed only to a sibling",
+        messageId: "SVC4651"
+    }
+
+---------SVC4652------------------------------
+==============================================
+
+- %1 - Resource/Service
+
+::
+
+    COMPONENT_INVALID_SUBCATEGORY: {
+        code: 400,
+        message: "Error: Invalid Content. Invalid %1 sub category.",
+        messageId: "SVC4652"
+    }
+
+---------SVC4653------------------------------
+==============================================
+
+- %1 - Group instance uniqueId
+- %2 - Service uniqueId
+
+::
+
+    GROUP_INSTANCE_NOT_FOUND_ON_COMPONENT_INSTANCE: {
+        code: 404,
+        message: "Error: Requested group instance %1 was not found on component %2.",
+        messageId: "SVC4653"
+    }
+
+---------SVC4654------------------------------
+==============================================
+
+- %1 - Group property name
+- %2 - Valid min limit value
+- %3 - Valid max limit value
+
+::
+
+    INVALID_GROUP_MIN_MAX_INSTANCES_PROPERTY_VALUE: {
+        code: 400,
+        message: "Error: Value of %1 must be not higher than %2, and not lower than %3.",
+        messageId: "SVC4654"
+    }
+
+---------SVC4655------------------------------
+==============================================
+
+- %1 - Group property name
+- %2 - Valid min limit value
+- %3 - Valid max limit value
+
+::
+
+    INVALID_GROUP_INITIAL_COUNT_PROPERTY_VALUE: {
+        code: 400,
+        message: "Error: Value of %1 must be between %2 and %3.",
+        messageId: "SVC4655"
+    }
+
+---------SVC4656------------------------------
+==============================================
+
+- %1 - Group property name
+- %2 - Lower/Higher
+- %3 - Valid max/min value
+
+::
+
+    INVALID_GROUP_PROPERTY_VALUE_LOWER_HIGHER: {
+        code: 400,
+        message: "Error: Value of %1 must be %2 or equals to %3.",
+        messageId: "SVC4656"
+    }
+
+---------SVC4657------------------------------
+==============================================
+
+- %1 - CertificationRequest/StartTesting
+
+::
+
+    RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID: {
+        code: 400,
+        message: "Error - Lifecycle state %1 is not valid for resource of type VFCMT",
+        messageId: "SVC4657"
+    }
+
+---------SVC4658------------------------------
+==============================================
+
+- %1 â€“ Asset type [Service/Resource]
+- %2 â€“ Main asset uuid
+- %3 â€“ Not found asset type [Service/Resource]
+- %4 â€“ Not found asset name
+
+::
+
+    ASSET_NOT_FOUND_DURING_CSAR_CREATION: {
+        code: 400,
+        message: "Error: CSAR packaging failed for %1 %2. %3 %4 was not found",
+        messageId: "SVC4658"
+    }
+
+---------SVC4659------------------------------
+==============================================
+
+- %1 â€“ asset type [Service/Resource]
+- %2 â€“ Main asset UUID
+- %3 â€“ Artifact name
+- %4 â€“ Artifact uuid
+
+::
+
+    ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION: {
+        code: 400,
+        message: "Error: CSAR packaging failed for %1 %2. Artifact %3 [%4] was not found",
+        messageId: "SVC4659"
+    }
+
+---------SVC4660------------------------------
+==============================================
+
+- %1 - Asset type
+- %2 - Matching generic node type name
+
+::
+
+    GENERIC_TYPE_NOT_FOUND: {
+        code: 404,
+        message: "Creation of %1 failed. Generic type %2 was not found",
+        messageId: "SVC4660"
+    }
+
+---------SVC4661------------------------------
+==============================================
+
+- %1 - Asset type
+- %2 - Matching generic node type name
+
+::
+
+    TOSCA_SCHEMA_FILES_NOT_FOUND: {
+        code: 400,
+        message: "Error: CSAR packaging failed. TOSCA schema files for SDC-Version: %1 and Conformance-Level %2 were not found",
+        messageId: "SVC4661"
+    }
+
+---------SVC4662------------------------------
+==============================================
+
+- %1 - File name
+- %2 - Parser error
+
+::
+
+    TOSCA_PARSE_ERROR: {
+        code: 400,
+        message: "Error: Invalid TOSCA template in file %1. %2",
+        messageId: "SVC4662"
+    }
+
+---------SVC4663------------------------------
+==============================================
+
+- %1 - Max length
+
+::
+
+    RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Resource vendor model number exceeds limit of %1 characters.",
+        messageId: "SVC4663"
+    }
+
+---------SVC4664------------------------------
+==============================================
+
+::
+
+    INVALID_RESOURCE_VENDOR_MODEL_NUMBER: {
+        code: 400,
+        message: 'Error: Invalid Content. Resource vendor model number is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4664"
+    }
+
+---------SVC4665------------------------------
+==============================================
+
+- %1 - Max length
+
+::
+
+    SERVICE_TYPE_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Service type exceeds limit of %1 characters.",
+        messageId: "SVC4665"
+    }
+
+---------SVC4666------------------------------
+==============================================
+
+::
+
+    INVALID_SERVICE_TYPE: {
+        code: 400,
+        message: 'Error: Invalid Content. Serivce type is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4666"
+    }
+
+---------SVC4667------------------------------
+==============================================
+
+- %1 - Max length
+
+::
+
+    SERVICE_ROLE_EXCEEDS_LIMIT: {
+        code: 400,
+        message: "Error: Invalid Content. Service role exceeds limit of %1 characters.",
+        messageId: "SVC4667"
+    }
+
+---------SVC4668------------------------------
+==============================================
+
+::
+
+    INVALID_SERVICE_ROLE: {
+        code: 400,
+        message: 'Error: Invalid Content. Service role is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.',
+        messageId: "SVC4668"
+    }
+
+---------SVC4669-----------------------------
+=============================================
+
+::
+
+    INVALID_RESOURCE_TYPE: {
+        code: 400,
+        message: "Error: Invalid resource type.",
+        messageId: "SVC4669"
+    }
+
+---------SVC4670------------------------------
+==============================================
+
+::
+
+    ARTIFACT_NAME_INVALID: {
+        code: 400,
+        message: "Error: Artifact name is invalid.",
+        messageId: "SVC4670"
+    }
+
+---------SVC4671------------------------------
+==============================================
+
+- %1 - VSP name
+- %2 - VFC name
+
+::
+
+    CFVC_LOOP_DETECTED: {
+        code: 400,
+        message: 'Error: VSP %1 cannot be imported. The VSP contains internal loop in VFC %2',
+        messageId: "SVC4671"
+    }
\ No newline at end of file
index 349e7ba..e9decd1 100644 (file)
@@ -17,7 +17,7 @@ Overview
 Version information
 -------------------
 
-*Version* : 1.0.0
+*Version* : 1.1.0
 
 URI scheme
 ----------
index 0582c76..d3023c5 100644 (file)
@@ -2,7 +2,6 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
-    <groupId>org.openecomp.sdc</groupId>
     <artifactId>sdc-onboarding</artifactId>
     <packaging>pom</packaging>
 
@@ -96,7 +95,6 @@
         <ws.rs.version>2.0.1</ws.rs.version>  <!--  New version 2.0.1 to fix blackduck violation Failing with comiplation issues-->
         <zusammen.version>0.2.0</zusammen.version>
         <zusammen-state-store.version>0.2.2</zusammen-state-store.version>
-        <skipSA>true</skipSA>
         <pmd.version>5.8.1</pmd.version>
         <build.tools.version>${project.version}</build.tools.version>
     </properties>
                 <artifactId>maven-jxr-plugin</artifactId>
                 <version>2.5</version>
                 <configuration>
-                    <skip>${skipSA}</skip>
+                    <skip>${pmd.skip}</skip>
                 </configuration>
                 <executions>
                     <execution>
                 <artifactId>maven-pmd-plugin</artifactId>
                 <version>3.8</version>
                 <configuration>
-                    <skip>${skipSA}</skip>
+                    <skip>${pmd.skip}</skip>
                     <aggregate>false</aggregate>
-                    <targetJdk>${maven.compiler.target}</targetJdk>
+                    <includeTests>true</includeTests>
+                    <printFailingErrors>true</printFailingErrors>
                     <rulesets>
                         <ruleset>build-pmd-ruleset.xml</ruleset>
                     </rulesets>
index 53ebf0b..875b515 100644 (file)
@@ -557,15 +557,13 @@ public class ActionsImpl implements Actions {
           ACTION_REQUEST_MISSING_MANDATORY_PARAM + ARTIFACT_FILE);
     }
 
-    InputStream artifactInputStream = null;
-    try {
-      artifactInputStream = artifactToUpload.getDataHandler().getInputStream();
+    try (InputStream artifactInputStream = artifactToUpload.getDataHandler().getInputStream()) {
+      payload = FileUtils.toByteArray(artifactInputStream);
     } catch (IOException exception) {
       LOGGER.error(ACTION_ARTIFACT_READ_FILE_ERROR, exception);
       throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ARTIFACT_READ_FILE_ERROR);
     }
 
-    payload = FileUtils.toByteArray(artifactInputStream);
     //Validate Artifact size
     if (payload != null && payload.length > MAX_ACTION_ARTIFACT_SIZE) {
       throw new ActionException(ACTION_ARTIFACT_TOO_BIG_ERROR_CODE, ACTION_ARTIFACT_TOO_BIG_ERROR);
@@ -761,15 +759,14 @@ public class ActionsImpl implements Actions {
     }
 
     if (artifactToUpdate != null) {
-      InputStream artifactInputStream = null;
-      try {
-        artifactInputStream = artifactToUpdate.getDataHandler().getInputStream();
+
+      try (InputStream artifactInputStream = artifactToUpdate.getDataHandler().getInputStream()) {
+        payload = FileUtils.toByteArray(artifactInputStream);
       } catch (IOException exception) {
         LOGGER.error(ACTION_ARTIFACT_READ_FILE_ERROR, exception);
         throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE, ACTION_ARTIFACT_READ_FILE_ERROR);
       }
 
-      payload = FileUtils.toByteArray(artifactInputStream);
       //Validate Artifact size
       if (payload != null && payload.length > MAX_ACTION_ARTIFACT_SIZE) {
         throw new ActionException(ACTION_ARTIFACT_TOO_BIG_ERROR_CODE,
index 9e4d3bf..0450244 100644 (file)
@@ -78,6 +78,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 import static org.openecomp.sdc.logging.messages.AuditMessages.SUBMIT_VSP_ERROR;
 
@@ -403,59 +404,30 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
     MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Re_Submit_ALL_Final_VSPs.toString());
     logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.RESUBMIT_ALL_FINAL_VSPS);
 
-    List<VersionedVendorSoftwareProductInfo> vspList = Objects.requireNonNull(
-        vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), user));
-    int skippedCounter = 0;
-    final int vspListSizeBefore = vspList.size();
-
-    for (VersionedVendorSoftwareProductInfo versionVspInfo : vspList) {
-      final VspDetails vspDetails = versionVspInfo.getVspDetails();
-      final String vspId = vspDetails.getId();
-      final Version latestFinalVersion =
-          getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion();
-
-      if (latestFinalVersion.getStatus().equals(VersionStatus.Locked)) {
-        logger.info("Skipping processing VSP name [{}]/id [{}] due to status LOCKED", vspDetails
-                .getName(),
-            vspId);
-        skippedCounter++;
-        vspList.remove(versionVspInfo);
-      }
-    }
+    List<VersionedVendorSoftwareProductInfo> latestFinalVsps = Objects
+        .requireNonNull(vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), user));
 
-    logger.info("Removed {} VSPs out of {} from processing due to status LOCKED", skippedCounter,
-        vspListSizeBefore);
+    List<VersionedVendorSoftwareProductInfo> nonLockedLatestFinalVsps = latestFinalVsps.stream()
+        .filter(vsp ->
+            !isVspLocked(vsp.getVspDetails().getId(), vsp.getVspDetails().getName(), user))
+        .collect(Collectors.toList());
+
+    logger.info("Removed {} VSPs out of {} from processing due to status LOCKED.\n" +
+            "Total number of VSPs: {}. Performing healing and resubmit for all non-Manual VSPs " +
+            "in submitted status.\n No need to pre-set oldVersion field",
+        latestFinalVsps.size() - nonLockedLatestFinalVsps.size(), latestFinalVsps.size(),
+        nonLockedLatestFinalVsps.size());
 
     int healingCounter = 0;
     int failedCounter = 0;
-    int totalCounter = 0;
-
-
-    final int vspListSize = vspList.size();
-    logger.info("Total number of VSPs: {}. Performing healing and " +
-        "resubmit for all non-Manual VSPs in submitted status.\n No need to pre-set oldVersion " +
-        "field", vspListSize);
-
-    for (VersionedVendorSoftwareProductInfo versionVspInfo : vspList) {
+    for (int counter = 0; counter < nonLockedLatestFinalVsps.size(); counter++) {
+      VersionedVendorSoftwareProductInfo versionVspInfo = nonLockedLatestFinalVsps.get(counter);
       try {
-        totalCounter++;
-        final Version activeVersion = versionVspInfo.getVersionInfo().getActiveVersion();
         final VspDetails vspDetails = versionVspInfo.getVspDetails();
-        final String vspId = vspDetails.getId();
-        final Version latestFinalVersion =
-            getVersionInfo(vspId, VersionableEntityAction.Read, user).getLatestFinalVersion();
-
-        final String vspName = vspDetails.getName();
-        logger.info("VSP Name {}, VSP id [{}], Active Version {} , Active Version Status {}," +
-                "Latest Final Version {} ,  " +
-                "Latest Final Version Status {}", vspName, vspId, activeVersion
-                .toString(),
-            activeVersion.getStatus(), latestFinalVersion.toString(),
-            latestFinalVersion.getStatus());
-
-        if (Objects.nonNull(latestFinalVersion) &&
-            (!OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod()))) {
-          reSubmit(vspDetails, user, totalCounter, vspListSize);
+        if (!OnboardingMethod.Manual.name().equals(vspDetails.getOnboardingMethod())) {
+          logger.info("Starting on healing and resubmit for VSP [{}], #{} out of total {}",
+              vspDetails.getName(), counter + 1, nonLockedLatestFinalVsps.size());
+          reSubmit(vspDetails, user);
           healingCounter++;
         }
       } catch (Exception e) {
@@ -464,42 +436,46 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
     }
 
     logger.info("Total VSPs processed {}. Completed running healing and resubmit for {} VSPs out" +
-            " " +
-            "of total # of {} submitted VSPs.  Failures count during resubmitAll: {}",
-        totalCounter, healingCounter, vspListSize, failedCounter);
-
+            " of total # of {} submitted VSPs.  Failures count during resubmitAll: {}",
+        nonLockedLatestFinalVsps.size(), healingCounter, latestFinalVsps.size(), failedCounter);
 
     return Response.ok().build();
   }
 
+  private boolean isVspLocked(String vspId, String vspName, String user) {
+    final VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
 
-  private void reSubmit(VspDetails vspDetails, String user, int currentCount, int total) throws
-      Exception {
+    if (versionInfo.getStatus().equals(VersionStatus.Locked)) {
+      logger.info("VSP name [{}]/id [{}] status is LOCKED", vspName, vspId);
+      return true;
+    }
+    logger.info("VSP Name {}, VSP id [{}], Active Version {} , Status {}, Latest Final Version {}",
+        vspName, vspId, versionInfo.getActiveVersion().toString(), versionInfo.getStatus(),
+        versionInfo.getLatestFinalVersion().toString());
+    return false;
+  }
 
-    final String vspId = vspDetails.getId();
-    final String vspName = vspDetails.getName();
-    final Version versionBefore = vspDetails.getVersion();
-    Version finalVersion;
 
-    logger.info("Starting on healing and resubmit for VSP [{}], #{} out of total {}", vspName,
-        currentCount, total);
+  private void reSubmit(VspDetails vspDetails, String user) throws Exception {
+    final Version versionBefore = vspDetails.getVersion();
     vspDetails.setOldVersion("true");
 
+    Version finalVersion;
     try {
       finalVersion =
-          vendorSoftwareProductManager.healAndAdvanceFinalVersion(vspId, vspDetails, user);
-
+          vendorSoftwareProductManager
+              .healAndAdvanceFinalVersion(vspDetails.getId(), vspDetails, user);
     } catch (Exception e) {
-
       logger.error("Failed during resubmit, VSP [{}] , version before:{}, version after:{}, " +
               "status after:{}, with exception:{}",
-          vspName, versionBefore.toString(), vspDetails.getVersion().toString(), vspDetails
+          vspDetails.getName(), versionBefore.toString(), vspDetails.getVersion().toString(),
+          vspDetails
               .getVersion().getStatus().name(), e.getMessage());
       throw e;
     }
 
     logger.info("Completed healing and resubmit for VSP [{}], version before:{}, version after:" +
-        " {}", vspName, versionBefore.toString(), finalVersion);
+        " {}", vspDetails.getName(), versionBefore.toString(), finalVersion);
   }
 
   private static void printAuditForErrors(List<ErrorMessage> errorList, String vspId,
index ddb56dd..1d1ce4f 100644 (file)
@@ -62,20 +62,19 @@ import java.util.zip.ZipInputStream;
  */
 public class UploadValidationManagerImpl implements UploadValidationManager {
 
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+  private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
 
 
   private static FileContentHandler getFileContentMapFromZip(byte[] uploadFileData)
       throws IOException, CoreException {
+
     ZipEntry zipEntry;
     List<String> folderList = new ArrayList<>();
     FileContentHandler mapFileContent = new FileContentHandler();
-    try {
-      ZipInputStream inputZipStream;
+    try (ZipInputStream inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData))) {
 
       byte[] fileByteContent;
       String currentEntryName;
-      inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData));
 
       while ((zipEntry = inputZipStream.getNextEntry()) != null) {
         currentEntryName = zipEntry.getName();
@@ -130,7 +129,7 @@ public class UploadValidationManagerImpl implements UploadValidationManager {
       throws IOException {
 
 
-    mdcDataDebugMessage.debugEntryMessage(null, null);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null, (String[]) null);
 
     ValidationFileResponse validationFileResponse = new ValidationFileResponse();
 
@@ -150,15 +149,12 @@ public class UploadValidationManagerImpl implements UploadValidationManager {
       Map<String, List<ErrorMessage>> errors = validateHeatUploadData(content);
       tree = HeatTreeManagerUtil.initHeatTreeManager(content);
       tree.createTree();
-      if (MapUtils.isNotEmpty(errors)) {
-
 
+      if (MapUtils.isNotEmpty(errors)) {
         tree.addErrors(errors);
         validationStructureList.setImportStructure(tree.getTree());
-        //validationFileResponse.setStatus(ValidationFileStatus.Failure);
-      } else {
-        //validationFileResponse.setStatus(ValidationFileStatus.Success);
       }
+
     } else {
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
           LoggerTragetServiceName.VALIDATE_FILE_TYPE, ErrorLevel.ERROR.name(),
@@ -167,12 +163,11 @@ public class UploadValidationManagerImpl implements UploadValidationManager {
     }
     validationFileResponse.setValidationData(validationStructureList);
 
-    mdcDataDebugMessage.debugExitMessage(null, null);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null, (String[]) null);
     return validationFileResponse;
   }
 
-  private Map<String, List<ErrorMessage>> validateHeatUploadData(FileContentHandler fileContentMap)
-      throws IOException {
+  private Map<String, List<ErrorMessage>> validateHeatUploadData(FileContentHandler fileContentMap) {
     ValidationManager validationManager =
         ValidationManagerUtil.initValidationManager(fileContentMap);
     return validationManager.validate();
index 924a956..53b05eb 100644 (file)
@@ -29,6 +29,7 @@ import org.openecomp.sdc.common.utils.SdcCommon;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
@@ -43,11 +44,12 @@ public class ValidationManagerUtil {
    * @param errors         the errors
    */
   public static void handleMissingManifest(FileContentHandler fileContentMap,
-                                           Map<String, List<ErrorMessage>> errors) {
-    InputStream manifest = fileContentMap.getFileContent(SdcCommon.MANIFEST_NAME);
-    if (manifest == null) {
-      ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.MANIFEST_NAME, errors)
-          .add(new ErrorMessage(ErrorLevel.ERROR, Messages.MANIFEST_NOT_EXIST.getErrorMessage()));
+                                           Map<String, List<ErrorMessage>> errors) throws IOException {
+    try (InputStream manifest = fileContentMap.getFileContent(SdcCommon.MANIFEST_NAME)) {
+      if (manifest == null) {
+        ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.MANIFEST_NAME, errors)
+                .add(new ErrorMessage(ErrorLevel.ERROR, Messages.MANIFEST_NOT_EXIST.getErrorMessage()));
+      }
     }
   }
 
index 3f6ffcc..07a3fa7 100644 (file)
@@ -30,6 +30,7 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
 import org.openecomp.sdc.activityLog.ActivityLogManager;
 import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.CommonUtil;
 import org.openecomp.sdc.common.utils.SdcCommon;
 import org.openecomp.sdc.datatypes.error.ErrorLevel;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -258,20 +259,20 @@ public class OrchestrationTemplateCandidateManagerImpl
     OnboardingTypesEnum type =
         OnboardingTypesEnum.getOnboardingTypesEnum(vspDetails.getOnboardingOrigin());
 
-    if(vspDetails.getOnboardingOrigin().equals(OnboardingTypesEnum.ZIP.toString())) {
+    if(CommonUtil.isFileOriginFromZip(vspDetails.getOnboardingOrigin())) {
       FilesDataStructure structure = JsonUtil
           .json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
       String manifest = candidateService.createManifest(vspDetails, structure);
 
       mdcDataDebugMessage
           .debugExitMessage("VSP id", vspId);
-      return Optional.ofNullable(
+      return Optional.of(
           new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(),candidateService
               .replaceManifestInZip(candidateDataEntity.get().getContentData(),
               manifest, vspId, type)));
     }
 
-    return Optional.ofNullable(
+    return Optional.of(
         new ImmutablePair<>(vspDetails.getOnboardingOrigin(),candidateDataEntity.get()
             .getContentData().array()));
   }
index 4df00fd..a3d0286 100644 (file)
@@ -50,10 +50,10 @@ import java.io.InputStream;
 import java.util.Collection;
 
 public class ProcessManagerImpl implements ProcessManager {
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-  private ActivityLogManager activityLogManager;
+  private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
+  private final ActivityLogManager activityLogManager;
 
-  private VendorSoftwareProductDao vendorSoftwareProductDao;
+  private final VendorSoftwareProductDao vendorSoftwareProductDao;
 
   private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
 
@@ -66,15 +66,15 @@ public class ProcessManagerImpl implements ProcessManager {
   public Collection<ProcessEntity> listProcesses(String vspId, Version version,
                                                  String componentId,
                                                  String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
 
     return vendorSoftwareProductDao.listProcesses(vspId, version, componentId);
   }
 
   @Override
   public void deleteProcesses(String vspId, Version version, String componentId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     Collection<ProcessEntity> processes =
         vendorSoftwareProductDao.listProcesses(vspId, version, componentId);
@@ -87,12 +87,12 @@ public class ProcessManagerImpl implements ProcessManager {
 
       vendorSoftwareProductDao.deleteProcesses(vspId, version, componentId);
     }
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
   }
 
   @Override
   public ProcessEntity createProcess(ProcessEntity process, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", process.getId(),
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", process.getId(),
         process.getComponentId());
     validateUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
         process.getName());
@@ -102,7 +102,7 @@ public class ProcessManagerImpl implements ProcessManager {
     createUniqueName(process.getVspId(), process.getVersion(), process.getComponentId(),
         process.getName());
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", process.getId(),
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", process.getId(),
         process.getComponentId());
 
     return process;
@@ -112,20 +112,20 @@ public class ProcessManagerImpl implements ProcessManager {
   @Override
   public ProcessEntity getProcess(String vspId, Version version, String componentId,
                                   String processId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     ProcessEntity retrieved =
         vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
     validateProcessExistence(vspId, version, componentId, processId, retrieved);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
 
     return retrieved;
   }
 
   @Override
   public void updateProcess(ProcessEntity process, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", process.getId(),
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", process.getId(),
         process.getComponentId());
 
     ProcessEntity retrieved = vendorSoftwareProductDao
@@ -138,14 +138,14 @@ public class ProcessManagerImpl implements ProcessManager {
         retrieved.getName(), process.getName());
     vendorSoftwareProductDao.updateProcess(process);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", process.getId(),
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", process.getId(),
         process.getComponentId());
   }
 
   @Override
   public void deleteProcess(String vspId, Version version, String componentId, String processId,
                             String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     ProcessEntity retrieved =
         vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
@@ -155,33 +155,30 @@ public class ProcessManagerImpl implements ProcessManager {
     deleteUniqueValue(retrieved.getVspId(), retrieved.getVersion(), retrieved.getComponentId(),
         retrieved.getName());
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
   }
 
 
   @Override
   public File getProcessArtifact(String vspId, Version version, String componentId,
                                  String processId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     ProcessEntity retrieved =
         vendorSoftwareProductDao.getProcessArtifact(vspId, version, componentId, processId);
     validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved);
 
     File file = new File(String.format("%s_%s_%s", vspId, componentId, processId));
-    try {
-      FileOutputStream fos = new FileOutputStream(file);
+    try (FileOutputStream fos = new FileOutputStream(file)) {
       fos.write(retrieved.getArtifact().array());
-      fos.close();
     } catch (IOException exception) {
-      log.debug("", exception);
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.GET_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
           LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get process artifact");
-      throw new CoreException(new UploadInvalidErrorBuilder().build());
+      throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
 
     return file;
   }
@@ -189,7 +186,7 @@ public class ProcessManagerImpl implements ProcessManager {
   @Override
   public void deleteProcessArtifact(String vspId, Version version, String componentId,
                                     String processId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     ProcessEntity retrieved =
         vendorSoftwareProductDao.getProcessArtifact(vspId, version, componentId, processId);
@@ -197,14 +194,14 @@ public class ProcessManagerImpl implements ProcessManager {
 
     vendorSoftwareProductDao.deleteProcessArtifact(vspId, version, componentId, processId);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
   }
 
   @Override
   public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId,
                                     Version version, String componentId, String processId,
                                     String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id", vspId, componentId);
 
     ProcessEntity retrieved =
         vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId);
@@ -221,11 +218,10 @@ public class ProcessManagerImpl implements ProcessManager {
     try {
       artifact = FileUtils.toByteArray(artifactFile);
     } catch (RuntimeException exception) {
-      log.debug("", exception);
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
           LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(),
           LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact");
-      throw new CoreException(new UploadInvalidErrorBuilder().build());
+      throw new CoreException(new UploadInvalidErrorBuilder().build(), exception);
     }
 
     vendorSoftwareProductDao.uploadProcessArtifact(vspId, version, componentId, processId, artifact,
@@ -234,13 +230,13 @@ public class ProcessManagerImpl implements ProcessManager {
         ActivityType.UPLOAD_MONITORING_FILE.toString(), user, true, "", "");
     activityLogManager.addActionLog(activityLogEntity, user);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id", vspId, componentId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id", vspId, componentId);
   }
 
 
   private void validateProcessExistence(String vspId, Version version, String componentId,
                                         String processId, ProcessEntity retrieved) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
         processId);
 
     if (retrieved != null) {
@@ -250,13 +246,13 @@ public class ProcessManagerImpl implements ProcessManager {
         new ProcessEntity(vspId, version, componentId, processId),
         VspDetails.ENTITY_TYPE);//todo retrieved is always null ??
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id, process id", vspId, componentId,
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id, process id", vspId, componentId,
         processId);
   }
 
   private void validateProcessArtifactExistence(String vspId, Version version, String componentId,
                                                 String processId, ProcessEntity retrieved) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id, component id, process id", vspId, componentId,
         processId);
 
     if (retrieved != null) {
@@ -269,7 +265,7 @@ public class ProcessManagerImpl implements ProcessManager {
           VspDetails.ENTITY_TYPE); //todo retrieved is always null ??
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id, component id, process id", vspId, componentId,
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id, component id, process id", vspId, componentId,
         processId);
   }
 
index be1aaf0..d4879da 100644 (file)
@@ -146,25 +146,25 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   private static final String VALIDATION_VSP_NAME = "validationOnlyVspName";
   //private static final String VALIDATION_VSP_USER = "validationOnlyVspUser";
 
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-  private static final Logger logger =
+  private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
+  private static final Logger LOGGER =
       LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
 
-  private OrchestrationTemplateDao orchestrationTemplateDao;
-  private VendorSoftwareProductInfoDao vspInfoDao;
-  private VersioningManager versioningManager;
-  private VendorSoftwareProductDao vendorSoftwareProductDao;
-  private VendorLicenseFacade vendorLicenseFacade;
-  private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao;
-  private EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao;
-  private HealingManager healingManager;
-  private VendorLicenseArtifactsService licenseArtifactsService;
-  private InformationArtifactGenerator informationArtifactGenerator;
-  private PackageInfoDao packageInfoDao;
-  private ActivityLogManager activityLogManager;
-  private DeploymentFlavorDao deploymentFlavorDao;
-  private NicDao nicDao;
-  private ManualVspToscaManager manualVspToscaManager;
+  private final OrchestrationTemplateDao orchestrationTemplateDao;
+  private final VendorSoftwareProductInfoDao vspInfoDao;
+  private final VersioningManager versioningManager;
+  private final VendorSoftwareProductDao vendorSoftwareProductDao;
+  private final VendorLicenseFacade vendorLicenseFacade;
+  private final ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao;
+  private final EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao;
+  private final HealingManager healingManager;
+  private final VendorLicenseArtifactsService licenseArtifactsService;
+  private final InformationArtifactGenerator informationArtifactGenerator;
+  private final PackageInfoDao packageInfoDao;
+  private final ActivityLogManager activityLogManager;
+  private final DeploymentFlavorDao deploymentFlavorDao;
+  private final NicDao nicDao;
+  private final ManualVspToscaManager manualVspToscaManager;
 
   /**
    * Instantiates a new Vendor software product manager.
@@ -230,7 +230,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   @Override
   public Version checkout(String vendorSoftwareProductId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
     MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_Entity.toString());
 
     Version newVersion = versioningManager
@@ -244,14 +244,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       activityLogManager.addActionLog(activityLogEntity, user);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
     return newVersion;
   }
 
 
   @Override
   public Version undoCheckout(String vendorSoftwareProductId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
 
     Version version =
         getVersionInfo(vendorSoftwareProductId, VersionableEntityAction.Read, user)
@@ -275,14 +275,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
     updateUniqueName(preVspName, postVspName);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
 
     return newVersion;
   }
 
   @Override
   public Version checkin(String vendorSoftwareProductId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vendorSoftwareProductId);
 
     Version newVersion = versioningManager.checkin(
         VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
@@ -295,14 +295,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       activityLogManager.addActionLog(activityLogEntity, user);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vendorSoftwareProductId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vendorSoftwareProductId);
 
     return newVersion;
   }
 
   @Override
   public ValidationResponse submit(String vspId, String user) throws IOException {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     Version version = getVersionInfo(vspId, VersionableEntityAction.Read, user).getActiveVersion();
     VspDetails vspDetails = getVsp(vspId, version, user);
@@ -379,7 +379,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       activityLogManager.addActionLog(activityLogEntity, user);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return validationResponse;
   }
 
@@ -397,7 +397,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   private Collection<ErrorCode> deploymentFlavorValidation(String vspId,
                                                            Version version) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
     Set<CompositionEntityValidationData> validationData = new HashSet<>();
     Collection<ErrorCode> errorCodeList = new ArrayList<>();
     Collection<DeploymentFlavorEntity> deploymentFlavors =
@@ -451,7 +451,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   }
 
   private Set<CompositionEntityValidationData> componentValidation(String vspId, Version version) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     Set<CompositionEntityValidationData> validationData = new HashSet<>();
     Collection<ComponentEntity> components =
@@ -578,8 +578,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   }
 
   String getVspQuestionnaireSchema(SchemaTemplateInput schemaInput) {
-    mdcDataDebugMessage.debugEntryMessage(null);
-    mdcDataDebugMessage.debugExitMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
     return SchemaGenerator
         .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput);
   }
@@ -606,7 +606,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     Map<String, List<ErrorMessage>> enrichErrors = enrichmentManager.enrich();
 
     if (MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, enrichErrors))) {
-      logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED
+      LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED
           + vendorSoftwareProductId);
     } else {
       enrichErrors.values().forEach(errorList ->
@@ -621,7 +621,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   }
 
   private Collection<ErrorCode> validateLicensingData(VspDetails vspDetails) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId());
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspDetails.getId());
 
     if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null
         || vspDetails.getLicenseAgreement() == null
@@ -629,7 +629,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       return null;
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspDetails.getId());
     return vendorLicenseFacade
         .validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(),
             vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups());
@@ -640,7 +640,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     try {
       validateUniqueName(VALIDATION_VSP_NAME);
     } catch (Exception ignored) {
-      logger.debug("", ignored);
+      LOGGER.debug("Ignored exception when validating unique VSP name", ignored);
       return VALIDATION_VSP_ID;
     }
     VspDetails validationVsp = new VspDetails();
@@ -659,7 +659,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   @Override
   public VspDetails createVsp(VspDetails vspDetails, String user) {
-    mdcDataDebugMessage.debugEntryMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
 
     validateUniqueName(vspDetails.getName());
 
@@ -679,13 +679,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     activityLogManager.addActionLog(activityLogEntity, user);
     String vspName = vspDetails.getName();
     createUniqueName(vspName);
-    mdcDataDebugMessage.debugExitMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
     return vspDetails;
   }
 
   @Override
   public List<VersionedVendorSoftwareProductInfo> listVsps(String versionFilter, String user) {
-    mdcDataDebugMessage.debugEntryMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(null);
 
     Map<String, VersionInfo> idToVersionsInfo = versioningManager.listEntitiesVersionInfo(
         VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, user,
@@ -714,25 +714,23 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
           vsps.add(new VersionedVendorSoftwareProductInfo(vsp, versionInfo));
         }
       } catch (RuntimeException rte) {
-        logger.debug("", rte);
-        logger.error(
+        LOGGER.error(
             "Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString
                 () + "] " +
-                "message:" + rte
-                .getMessage());
+                "message:" + rte.getMessage(), rte);
       }
     }
 
     sortVspListByModificationTimeDescOrder(vsps);
 
-    mdcDataDebugMessage.debugExitMessage(null);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage(null);
 
     return vsps;
   }
 
   @Override
   public void updateVsp(VspDetails vspDetails, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId());
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspDetails.getId());
 
     VspDetails retrieved = vspInfoDao.get(vspDetails);
     if (!Objects.equals(retrieved.getOnboardingMethod(), vspDetails.getOnboardingMethod())) {
@@ -756,7 +754,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     vspInfoDao.update(vspDetails);
     //vendorSoftwareProductDao.updateVspLatestModificationTime(vspDetails.getId(), activeVersion);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId());
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspDetails.getId());
   }
 
   private void updateDeploymentFlavor(VspDetails vspDetails, String user) {
@@ -785,7 +783,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   @Override
   public VspDetails getVsp(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version));
     if (vsp == null) {
@@ -803,7 +801,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       vsp.setNetworkPackageName("Upload File");
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return vsp;
   }
 
@@ -834,31 +832,30 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   public Version healAndAdvanceFinalVersion(String vspId, VspDetails vendorSoftwareProductInfo,
                                             String user) throws IOException {
 
-    Version checkoutFinalVersion = checkout(vspId, user);
-    autoHeal(vspId, checkoutFinalVersion, vendorSoftwareProductInfo, user);
-    Version checkinFinalVersion = checkin(vspId, user);
+    Version checkoutVersion = checkout(vspId, user);
+    autoHeal(vspId, checkoutVersion, vendorSoftwareProductInfo, user);
+    Version checkinVersion = checkin(vspId, user);
 
     ValidationResponse response = Objects.requireNonNull(submit(vspId, user),
         "Null response not expected");
 
     if (!response.isValid()) {
-      return checkout(vspId, user);
+      return checkinVersion;
     }
 
-    Version finalVersion = checkinFinalVersion.calculateNextFinal();
+    Version finalVersion = checkinVersion.calculateNextFinal();
     createPackage(vspId, finalVersion, user);
     return finalVersion;
-
   }
 
   @Override
   public void deleteVsp(String vspId, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
         LoggerTragetServiceName.DELETE_VSP, ErrorLevel.ERROR.name(),
         LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Unsupported operation");
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
 
     throw new UnsupportedOperationException(
         VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR);
@@ -866,7 +863,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   @Override
   public void heal(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user);
 
@@ -882,17 +879,17 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     vspDetails.setOldVersion(null);
     vspInfoDao.updateOldVersionIndication(vspDetails);
 
-    logger.audit("Healed VSP " + vspDetails.getId());
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    LOGGER.audit("Healed VSP " + vspDetails.getId());
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
 
-    if (errorMessages.isPresent()) {
+    errorMessages.ifPresent(s -> {
       throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR")
-          .withCategory(ErrorCategory.APPLICATION).withMessage(errorMessages.get()).build());
-    }
+              .withCategory(ErrorCategory.APPLICATION).withMessage(s).build());
+    });
   }
 
   private void autoHeal(String vspId, Version checkoutVersion, VspDetails vspDetails, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     checkoutVersion.setStatus(VersionStatus.Locked);
     Map<String, Object> healingParams = getHealingParamsAsMap(vspId, checkoutVersion, user);
@@ -903,13 +900,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     vspDetails.setOldVersion(null);
     vspInfoDao.updateOldVersionIndication(vspDetails);
 
-    logger.audit("Healed VSP " + vspDetails.getName());
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    LOGGER.audit("Healed VSP " + vspDetails.getName());
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
 
-    if (errorMessages.isPresent()) {
+    errorMessages.ifPresent(s -> {
       throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId("HEALING_ERROR")
-          .withCategory(ErrorCategory.APPLICATION).withMessage(errorMessages.get()).build());
-    }
+              .withCategory(ErrorCategory.APPLICATION).withMessage(s).build());
+    });
   }
 
   private Map<String, Object> getHealingParamsAsMap(String vspId, Version version, String user) {
@@ -929,7 +926,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   @Override
   public File getTranslatedFile(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
     String errorMessage;
     if (version == null) {
       errorMessage = "Package not found";
@@ -966,10 +963,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
     File translatedFile = new File(VendorSoftwareProductConstants.VSP_PACKAGE_ZIP);
 
-    try {
-      FileOutputStream fos = new FileOutputStream(translatedFile);
+    try (FileOutputStream fos = new FileOutputStream(translatedFile)) {
       fos.write(translatedFileBuffer.array());
-      fos.close();
     } catch (IOException exception) {
       errorMessage = "Can't create package";
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -979,7 +974,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
           exception);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
 
     return translatedFile;
   }
@@ -987,7 +982,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   @Override
 
   public byte[] getOrchestrationTemplateFile(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     UploadDataEntity uploadData = orchestrationTemplateDao.getOrchestrationTemplate(vspId, version);
     ByteBuffer contentData = uploadData.getContentData();
@@ -1008,13 +1003,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       throw new CoreException(new FileCreationErrorBuilder(vspId).build(), exception);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return baos.toByteArray();
   }
 
   @Override
   public PackageInfo createPackage(String vspId, Version version, String user) throws IOException {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     if (!version.isFinal()) {
       MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
@@ -1042,9 +1037,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
     packageInfoDao.create(packageInfo);
 
-    logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId);
+    LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return packageInfo;
   }
 
@@ -1065,7 +1060,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   @Override
 
   public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     VspQuestionnaireEntity retrieved = vspInfoDao.getQuestionnaire(vspId, version);
     VersioningUtil.validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version),
@@ -1077,7 +1072,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
     questionnaireResponse.setData(questionnaireData);
     questionnaireResponse.setSchema(getVspQuestionnaireSchema(null));
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
 
     return questionnaireResponse;
   }
@@ -1085,11 +1080,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
   @Override
   public void updateVspQuestionnaire(String vspId, Version version, String questionnaireData,
                                      String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
   }
 
 
@@ -1107,7 +1102,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
                 (vspDetails.getOnboardingOrigin()),
             uploadData.getContentData().array());
 
-    if (vspDetails.getOnboardingOrigin().equals(OnboardingTypesEnum.ZIP.name().toLowerCase())) {
+    if (CommonUtil.isFileOriginFromZip(vspDetails.getOnboardingOrigin())) {
       ValidationManager validationManager =
           ValidationManagerUtil.initValidationManager(fileContentMap);
       validationErrors.putAll(validationManager.validate());
@@ -1128,7 +1123,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
   private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version,
                                                               String onboardingMethod) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
 
     // The apis of CompositionEntityDataManager used here are stateful!
     // so, it must be re-created from scratch when it is used!
@@ -1174,18 +1169,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
           compositionEntityDataManager.getEntityListWithErrors();*/
       //Collection<CompositionEntityValidationData> roots = compositionEntityDataManager.getTrees();
 
-      mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+      MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
       return new QuestionnaireValidationResult(
           compositionEntityDataManager.getAllErrorsByVsp(vspId));
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return null;
   }
 
   @Override
   public File getInformationArtifact(String vspId, Version version, String user) {
-    mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP id", vspId);
     VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
 
     if (vspDetails == null) {
@@ -1202,14 +1197,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
       infoArtifactFile =
           new File(
               String.format(VendorSoftwareProductConstants.INFORMATION_ARTIFACT_NAME, vspName));
-      OutputStream out = new BufferedOutputStream(new FileOutputStream(infoArtifactFile));
-      out.write(infoArtifactAsByteBuffer.array());
-      out.close();
+      try (OutputStream out = new BufferedOutputStream(new FileOutputStream(infoArtifactFile))) {
+        out.write(infoArtifactAsByteBuffer.array());
+      }
+
     } catch (IOException ex) {
       throw new CoreException(new InformationArtifactCreationErrorBuilder(vspId).build(), ex);
     }
 
-    mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+    MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP id", vspId);
     return infoArtifactFile;
   }
 
@@ -1239,7 +1235,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
 
     errorList.forEach(errorMessage -> {
       if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
-        logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
+        LOGGER.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
             vspId));
       }
     });
index 53d3474..db0851c 100644 (file)
@@ -22,10 +22,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
-import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.ELIGBLE_FOLDERS;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.ELIGIBLE_FILES;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_MF_FILE_NAME;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME;
+
 public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
         implements OrchestrationTemplateFileHandler {
 
@@ -59,14 +62,22 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
     }
 
     private void validateManifest(UploadFileResponse uploadFileResponse, FileContentHandler contentMap) {
+
         if (!validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)){
             return;
         }
-        InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME);
-        OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
-        if (!onboardingManifest.isValid()){
-            onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
-                    SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
+
+        try (InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)) {
+
+            OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
+            if (!onboardingManifest.isValid()) {
+                onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
+                        SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
+            }
+
+        } catch (IOException e) {
+            // convert to runtime to keep the throws unchanged
+            throw new RuntimeException("Failed to validate manifest", e);
         }
     }
 
@@ -79,8 +90,6 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
                             SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
                                     getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(),
                                             unwantedFile))));
-
-          ;
         }
     }
 
@@ -97,14 +106,11 @@ public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateH
     }
     private boolean filterFiles(String inFileName) {
         boolean valid = ELIGIBLE_FILES.stream().anyMatch(fileName -> fileName.equals(inFileName));
-        if (valid){
-            return !valid;
-        }
-        return filterFolders(inFileName);
+        return !valid && filterFolders(inFileName);
     }
 
     private boolean filterFolders(String fileName) {
-        return !ELIGBLE_FOLDERS.stream().anyMatch(dirName -> fileName.startsWith(dirName));
+        return ELIGBLE_FOLDERS.stream().noneMatch(fileName::startsWith);
     }
 
     private boolean validateFileExist(UploadFileResponse uploadFileResponse, FileContentHandler contentMap, String fileName) {
index 85f9266..99b311e 100644 (file)
@@ -3,9 +3,12 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
 import org.openecomp.config.api.Configuration;
 import org.openecomp.config.api.ConfigurationManager;
 import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.OrchestrationTemplateFileExtensionErrorBuilder;
 
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 
 import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
@@ -22,7 +25,14 @@ public class OrchestrationUploadFactory {
     }
 
     public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String filePrefix) {
-        ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(filePrefix);
+        String fileExtension = filePrefix.toLowerCase();
+        ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(fileExtension);
+
+        if(Objects.isNull(orchestrationTemplateFileHandler)){
+            throw new CoreException(new OrchestrationTemplateFileExtensionErrorBuilder
+                ().build());
+        }
+
         return  CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(),
                         OrchestrationTemplateFileHandler.class);
     }
index db43e00..516d85c 100644 (file)
@@ -28,11 +28,11 @@ public class OrchestrationProcessFactory {
   }
 
   public static Optional<OrchestrationTemplateProcessHandler> getInstance(String filePrefix) {
-    filePrefix = filePrefix == null ? null : filePrefix.toLowerCase().trim();
     if (filePrefix == null) {
       return Optional.empty();
     }
 
+    filePrefix = filePrefix.toLowerCase().trim();
     OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(filePrefix);
     if (onboardingTypesEnum == null) {
       return Optional.empty();
index 3e42a23..b544d13 100644 (file)
@@ -49,6 +49,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Objects;
@@ -81,7 +82,7 @@ public class QuestionnaireDataServiceTest {
   @InjectMocks
   private OrchestrationTemplateCandidateManagerImpl candidateManager;
 
-  private UploadFileTest uploadFileTest = new UploadFileTest();
+  private final UploadFileTest uploadFileTest = new UploadFileTest();
 
   private static String vspId;
   private static Version vspActiveVersion;
@@ -93,7 +94,7 @@ public class QuestionnaireDataServiceTest {
   }
 
   // TODO: 3/15/2017 fix and enable   //@Test
-  public void testQuestionnaireDataAfterLegalUploadWithComposition() {
+  public void testQuestionnaireDataAfterLegalUploadWithComposition() throws IOException {
     InformationArtifactData informationArtifactData =
         uploadFileAndValidateInformationArtifactData("/fullComposition", 5);
 
@@ -102,16 +103,18 @@ public class QuestionnaireDataServiceTest {
 
 
   // TODO: 3/15/2017 fix and enable   //@Test
-  public void testQuestionnaireDataAfterLegalUploadEmptyComposition() {
+  public void testQuestionnaireDataAfterLegalUploadEmptyComposition() throws IOException {
     uploadFileAndValidateInformationArtifactData("/emptyComposition", 0);
   }
 
 
   // TODO: 3/15/2017 fix and enable   //@Test
-  public void testQuestionnaireDataAfterIllegalUpload() {
-    InputStream zipInputStream = uploadFileTest.getZipInputStream("/missingYml");
-    UploadFileResponse uploadFileResponse = candidateManager
-        .upload(vspId, VERSION, zipInputStream, USER1, "zip", "missingYml");
+  public void testQuestionnaireDataAfterIllegalUpload() throws IOException {
+
+    try (InputStream zipInputStream = uploadFileTest.getZipInputStream("/missingYml")) {
+      UploadFileResponse uploadFileResponse = candidateManager
+              .upload(vspId, VERSION, zipInputStream, USER1, "zip", "missingYml");
+    }
 
     InformationArtifactData informationArtifactData = questionnaireDataService
         .generateQuestionnaireDataForInformationArtifact(vspId, vspActiveVersion);
@@ -119,15 +122,18 @@ public class QuestionnaireDataServiceTest {
   }
 
   private InformationArtifactData uploadFileAndValidateInformationArtifactData(String filePath,
-                                                                               int listSizeToCheck) {
-    InputStream zipInputStream = uploadFileTest.getZipInputStream(filePath);
-    UploadFileResponse uploadFileResponse = candidateManager
-        .upload(vspId, VERSION,
-            zipInputStream, USER1,"zip", "file");
-    candidateManager.process(vspId, VERSION, USER1);
-
-    Assert.assertTrue(MapUtils.isEmpty(
-        MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors())));
+                                                                               int listSizeToCheck) throws IOException {
+
+    try (InputStream zipInputStream = uploadFileTest.getZipInputStream(filePath)) {
+      UploadFileResponse uploadFileResponse = candidateManager
+              .upload(vspId, VERSION,
+                      zipInputStream, USER1, "zip", "file");
+
+      candidateManager.process(vspId, VERSION, USER1);
+
+      Assert.assertTrue(MapUtils.isEmpty(
+              MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors())));
+    }
 
     InformationArtifactData informationArtifactData = questionnaireDataService
         .generateQuestionnaireDataForInformationArtifact(vspId, vspActiveVersion);
index e4dd39c..966e1f2 100644 (file)
@@ -5,8 +5,6 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.openecomp.core.enrichment.types.MonitoringUploadType;
 import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
@@ -20,6 +18,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.Optional;
+import java.util.function.Consumer;
 
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyObject;
@@ -29,25 +28,23 @@ import static org.mockito.Mockito.verify;
 
 public class MonitoringUploadsManagerImplTest {
 
-  private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
   private static final String USER1 = "ComponentsUploadTestUser";
   private static final String COMPONENT_ID = "COMPONENT_ID";
   private static final String VSP_ID = "vspId";
   private static final Version VERSION = new Version(0, 1);
-  private static final String trapFileName = "MMSC.zip";
-  private static final String pollFileName = "MNS OAM FW.zip";
-  private static final String vesFileName = "vesTest-yml_only.zip";
-  private static final String invalidVesFileName = "invalid_ves_file.zip";
-  private static final String notZipFileName = "notZipFile";
-  private static final String zipWithFoldersFileName = "zipFileWithFolder.zip";
-  private static final String emptyZipFileName = "emptyZip.zip";
+  private static final String TRAP_FILE_NAME = "MMSC.zip";
+  private static final String POLL_FILE_NAME = "MNS OAM FW.zip";
+  private static final String VES_FILE_NAME = "vesTest-yml_only.zip";
+  private static final String INVALID_VES_FILE_NAME = "invalid_ves_file.zip";
+  private static final String NOT_ZIP_FILE_NAME = "notZipFile";
+  private static final String ZIP_WITH_FOLDERS_FILE_NAME = "zipFileWithFolder.zip";
+  private static final String EMPTY_ZIP_FILE_NAME = "emptyZip.zip";
   private static final String ZIP_DIR = "/vspmanager/zips/";
 
   @Mock
   private ComponentArtifactDao componentArtifactDaoMock;
   @InjectMocks
-  private MonitoringUploadsManagerImpl moitoringUploadsManager;
+  private MonitoringUploadsManagerImpl monitoringUploadsManager;
 
   @BeforeMethod
   public void setUp() throws Exception {
@@ -56,51 +53,47 @@ public class MonitoringUploadsManagerImplTest {
 
   @Test(expectedExceptions = CoreException.class)
   public void testUploadEmptyZip() {
-    InputStream zis = getFileInputStream(ZIP_DIR + emptyZipFileName);
-    moitoringUploadsManager.upload(zis, emptyZipFileName, VSP_ID, VERSION, COMPONENT_ID,
-        MonitoringUploadType.SNMP_TRAP, USER1);
+    processFile(ZIP_DIR + EMPTY_ZIP_FILE_NAME, inputStream ->
+      monitoringUploadsManager.upload(inputStream, EMPTY_ZIP_FILE_NAME, VSP_ID, VERSION, COMPONENT_ID,
+          MonitoringUploadType.SNMP_TRAP, USER1));
   }
 
   @Test
   public void testUploadInvalidZip() {
-    URL url = this.getClass().getResource("/notZipFile");
+
     try {
-      moitoringUploadsManager
-          .upload(url.openStream(), notZipFileName, VSP_ID, VERSION, COMPONENT_ID,
-              MonitoringUploadType.VES_EVENTS, USER1);
+      processFile("/notZipFile", inputStream ->
+        monitoringUploadsManager
+            .upload(inputStream, NOT_ZIP_FILE_NAME, VSP_ID, VERSION, COMPONENT_ID,
+                    MonitoringUploadType.VES_EVENTS, USER1));
       Assert.fail();
     } catch (Exception exception) {
-      log.debug("",exception);
       Assert.assertEquals(exception.getMessage(), "Invalid zip file");
     }
   }
 
   @Test
   public void testUploadZipWithFolders() {
-    InputStream zis = getFileInputStream(ZIP_DIR + zipWithFoldersFileName);
 
     try {
-      moitoringUploadsManager
-          .upload(zis, zipWithFoldersFileName, VSP_ID, VERSION, COMPONENT_ID,
-              MonitoringUploadType.SNMP_TRAP, USER1);
+      processFile(ZIP_DIR + ZIP_WITH_FOLDERS_FILE_NAME, inputStream -> monitoringUploadsManager
+          .upload(inputStream, ZIP_WITH_FOLDERS_FILE_NAME, VSP_ID, VERSION, COMPONENT_ID,
+              MonitoringUploadType.SNMP_TRAP, USER1));
       Assert.fail();
     } catch (Exception exception) {
-      log.debug("",exception);
       Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders");
     }
   }
 
   @Test
   public void testUploadVEsEventZipWithNonYamlFiles() {
-    InputStream zis = getFileInputStream(ZIP_DIR + invalidVesFileName);
 
     try {
-      moitoringUploadsManager
-          .upload(zis, invalidVesFileName, VSP_ID, VERSION, COMPONENT_ID,
-              MonitoringUploadType.VES_EVENTS, USER1);
+      processFile(ZIP_DIR + INVALID_VES_FILE_NAME, inputStream -> monitoringUploadsManager
+          .upload(inputStream, INVALID_VES_FILE_NAME, VSP_ID, VERSION, COMPONENT_ID,
+              MonitoringUploadType.VES_EVENTS, USER1));
       Assert.fail();
     } catch (Exception exception) {
-      log.debug("",exception);
       Assert.assertEquals(exception.getMessage(),
           "Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML " +
               "files (using .yaml/.yml extensions)");
@@ -113,33 +106,33 @@ public class MonitoringUploadsManagerImplTest {
     ComponentMonitoringUploadEntity artifact1 =
         new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact1");
     artifact1.setType(MonitoringUploadType.SNMP_TRAP);
-    artifact1.setArtifactName(trapFileName);
+    artifact1.setArtifactName(TRAP_FILE_NAME);
 
     ComponentMonitoringUploadEntity artifact2 =
         new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact2");
     artifact2.setType(MonitoringUploadType.SNMP_POLL);
-    artifact2.setArtifactName(pollFileName);
+    artifact2.setArtifactName(POLL_FILE_NAME);
 
     ComponentMonitoringUploadEntity artifact3 =
         new ComponentMonitoringUploadEntity(VSP_ID, VERSION, COMPONENT_ID, "artifact3");
     artifact3.setType(MonitoringUploadType.VES_EVENTS);
-    artifact3.setArtifactName(vesFileName);
+    artifact3.setArtifactName(VES_FILE_NAME);
 
     doReturn(Arrays.asList(artifact1, artifact2, artifact3))
         .when(componentArtifactDaoMock).list(anyObject());
 
     MonitoringUploadStatus monitoringUploadStatus =
-        moitoringUploadsManager.listFilenames(VSP_ID, VERSION, COMPONENT_ID, USER1);
+        monitoringUploadsManager.listFilenames(VSP_ID, VERSION, COMPONENT_ID, USER1);
 
-    Assert.assertEquals(monitoringUploadStatus.getSnmpTrap(), trapFileName);
-    Assert.assertEquals(monitoringUploadStatus.getSnmpPoll(), pollFileName);
-    Assert.assertEquals(monitoringUploadStatus.getVesEvent(), vesFileName);
+    Assert.assertEquals(monitoringUploadStatus.getSnmpTrap(), TRAP_FILE_NAME);
+    Assert.assertEquals(monitoringUploadStatus.getSnmpPoll(), POLL_FILE_NAME);
+    Assert.assertEquals(monitoringUploadStatus.getVesEvent(), VES_FILE_NAME);
   }
 
   @Test (expectedExceptions = CoreException.class)
   public void testDeleteComponentMibWhenNone() {
     doReturn(Optional.empty()).when(componentArtifactDaoMock).getByType(any());
-    moitoringUploadsManager
+    monitoringUploadsManager
         .delete(VSP_ID, VERSION, COMPONENT_ID, MonitoringUploadType.SNMP_POLL, USER1);
 
     verify(componentArtifactDaoMock, never()).delete(anyObject());
@@ -152,20 +145,20 @@ public class MonitoringUploadsManagerImplTest {
         .when
             (componentArtifactDaoMock).getByType(anyObject());
 
-    moitoringUploadsManager
+    monitoringUploadsManager
         .delete(VSP_ID, VERSION, COMPONENT_ID, MonitoringUploadType.SNMP_POLL, USER1);
 
     verify(componentArtifactDaoMock).delete(anyObject());
   }
 
 
-  private InputStream getFileInputStream(String fileName) {
+  private void processFile(String fileName, Consumer<InputStream> processor) {
+
     URL url = this.getClass().getResource(fileName);
-    try {
-      return url.openStream();
-    } catch (IOException exception) {
-      log.debug("",exception);
-      return null;
+    try (InputStream inputStream = url.openStream()) {
+      processor.accept(inputStream);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to process file: " + fileName, e);
     }
   }
 }
index 77a847a..5199dfd 100644 (file)
@@ -104,12 +104,12 @@ import static org.mockito.Mockito.verify;
 
 public class VendorSoftwareProductManagerImplTest {
 
-  private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+  private static final Logger LOG = LoggerFactory.getLogger(VendorSoftwareProductManagerImplTest.class);
 
   private static final String INVALID_VERSION_MSG = "Invalid requested version.";
 
-  private static String VSP_ID = "vspId";
-  private static String VERSION_ID = "versionId";
+  private static final String VSP_ID = "vspId";
+  private static final String VERSION_ID = "versionId";
   public static final Version VERSION01 = new Version(0, 1);
   private static final Version VERSION10 = new Version(1, 0);
   private static final String USER1 = "vspTestUser1";
@@ -348,14 +348,14 @@ public class VendorSoftwareProductManagerImplTest {
     doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
             VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
             VersionableEntityAction.Write);
-    List<String> fgs = new ArrayList<String>();
+    List<String> fgs = new ArrayList<>();
     fgs.add("fg1"); fgs.add("fg2");
     VspDetails existingVsp =
             createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
                     "category",
                     "subCategory", "456", fgs);
 
-    List<String> updFgs = new ArrayList<String>();
+    List<String> updFgs = new ArrayList<>();
     updFgs.add("fg2");
     VspDetails updatedVsp =
             createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
@@ -372,7 +372,7 @@ public class VendorSoftwareProductManagerImplTest {
     flavor.setFeatureGroupId("fg1");
     dfEntity.setDeploymentFlavorCompositionData(flavor);
 
-    List<DeploymentFlavorEntity> dfList = new ArrayList<DeploymentFlavorEntity>();
+    List<DeploymentFlavorEntity> dfList = new ArrayList<>();
     dfList.add(dfEntity);
 
     doReturn(dfList).when(deploymentFlavorDaoMock).list(anyObject());
@@ -561,7 +561,7 @@ public class VendorSoftwareProductManagerImplTest {
     doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
     UploadDataEntity uploadData = new UploadDataEntity(VSP_ID, VERSION01);
     uploadData.setContentData(
-            ByteBuffer.wrap(FileUtils.toByteArray(getFileInputStream("/emptyComposition"))));
+            ByteBuffer.wrap(getBytes("/emptyComposition")));
     doReturn(uploadData).when(orchestrationTemplateDataDaoMock)
             .getOrchestrationTemplate(anyObject(), anyObject());
     doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(),
@@ -597,7 +597,7 @@ public class VendorSoftwareProductManagerImplTest {
     doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
     UploadDataEntity uploadData = new UploadDataEntity(VSP_ID, VERSION01);
     uploadData.setContentData(
-            ByteBuffer.wrap(FileUtils.toByteArray(getFileInputStream("/emptyComposition"))));
+            ByteBuffer.wrap(getBytes("/emptyComposition")));
     doReturn(uploadData).when(orchestrationTemplateDataDaoMock)
             .getOrchestrationTemplate(anyObject(), anyObject());
     doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(),
@@ -654,27 +654,28 @@ public class VendorSoftwareProductManagerImplTest {
 
   // TODO: 3/15/2017 fix and enable
   //@Test(dependsOnMethods = {"testListFinals"})
-  public void testUploadFileMissingFile() {
-    InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip");
+  public void testUploadFileMissingFile() throws IOException {
 
-    UploadFileResponse uploadFileResponse =
-            candidateManager.upload(VSP_ID, VERSION01, zis, USER1, "zip", "missingYml");
+    try (InputStream zis = this.getClass().getResourceAsStream("/vspmanager/zips/missingYml.zip")) {
+      UploadFileResponse uploadFileResponse =
+              candidateManager.upload(VSP_ID, VERSION01, zis, USER1, "zip", "missingYml");
 
-    Assert.assertEquals(uploadFileResponse.getErrors().size(), 0);
+      Assert.assertEquals(uploadFileResponse.getErrors().size(), 0);
+    }
   }
 
   // TODO: 3/15/2017 fix and enable
   //@Test(dependsOnMethods = {"testUploadFileMissingFile"})
   public void testUploadNotZipFile() throws IOException {
+
     URL url = this.getClass().getResource("/notZipFile");
 
-    try {
+    try (InputStream inputStream = url.openStream()) {
       candidateManager
               .upload(VSP_ID, VERSION01,
-                      url.openStream(), USER1, "zip", "notZipFile");
+                      inputStream, USER1, "zip", "notZipFile");
       candidateManager.process(VSP_ID, VERSION01, USER1);
     } catch (Exception ce) {
-      log.debug("",ce);
       Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
     }
 
@@ -692,11 +693,12 @@ public class VendorSoftwareProductManagerImplTest {
 
   private List<String> getFileNamesFromFolderInCsar(File csar, String folderName)
           throws IOException {
+
     List<String> fileNames = new ArrayList<>();
 
-    FileInputStream fileInputStream = new FileInputStream(csar);
-    try {
-      ZipInputStream zip = new ZipInputStream(fileInputStream);
+    try (FileInputStream fileInputStream = new FileInputStream(csar);
+         ZipInputStream zip = new ZipInputStream(fileInputStream)) {
+
       ZipEntry ze;
 
       while ((ze = zip.getNextEntry()) != null) {
@@ -705,8 +707,6 @@ public class VendorSoftwareProductManagerImplTest {
           fileNames.add(name);
         }
       }
-    }finally {
-      fileInputStream.close();
     }
 
     return fileNames;
@@ -718,10 +718,13 @@ public class VendorSoftwareProductManagerImplTest {
     checkinSubmitCreatePackage(vspId, user);
   }
 
-  private void uploadFileAndProcess(String vspId, String user, String filePath) {
+  private void uploadFileAndProcess(String vspId, String user, String filePath) throws IOException {
     vendorSoftwareProductManager.checkout(vspId, user);
-    candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user, "zip", "file");
-    candidateManager.process(vspId, VERSION01, user);
+
+    try (InputStream inputStream = this.getClass().getResourceAsStream(filePath)) {
+      candidateManager.upload(vspId, VERSION01, inputStream, user, "zip", "file");
+      candidateManager.process(vspId, VERSION01, user);
+    }
   }
 
   private void checkinSubmitCreatePackage(String vspId, String user) throws IOException {
@@ -792,13 +795,10 @@ public class VendorSoftwareProductManagerImplTest {
     capabilities.put(entryValueKey + "_" + key, value);
   }
 
-  public InputStream getFileInputStream(String fileName) {
+  private byte[] getBytes(String fileName) throws IOException {
     URL url = this.getClass().getResource(fileName);
-    try {
-      return url.openStream();
-    } catch (IOException exception) {
-      exception.printStackTrace();
-      return null;
+    try (InputStream inputStream = url.openStream()) {
+      return FileUtils.toByteArray(inputStream);
     }
   }
 
index 947f339..8f87c40 100644 (file)
@@ -21,8 +21,6 @@
 package org.openecomp.sdc.vendorsoftwareproduct.utils;
 
 import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
 import org.openecomp.sdc.versioning.dao.types.Version;
@@ -37,8 +35,6 @@ import java.util.zip.ZipOutputStream;
 
 public class VSPCommon {
 
-  private static final Logger log = (Logger) LoggerFactory.getLogger(VSPCommon.class.getName());
-
   public static VspDetails createVspDetails(String id, Version version, String name, String desc,
                                             String vendorName, String vlm, String icon,
                                             String category, String subCategory,
@@ -86,18 +82,18 @@ public class VSPCommon {
       }
     } else {
 
-      try {
         if (!path.isEmpty()) {
           path += File.separator;
         }
-        zos.putNextEntry(new ZipEntry(path + file.getName()));
-        InputStream is = new FileInputStream(file);
-        byte[] data = FileUtils.toByteArray(is);
-        zos.write(data);
-        zos.closeEntry();
-      } catch (IOException exception) {
-        log.debug("",exception);
-      }
+
+        try (InputStream is = new FileInputStream(file)) {
+          zos.putNextEntry(new ZipEntry(path + file.getName()));
+          byte[] data = FileUtils.toByteArray(is);
+          zos.write(data);
+          zos.closeEntry();
+        } catch (IOException exception) {
+          throw new RuntimeException("Failed to create Zip entry for file: " + file, exception);
+        }
     }
   }
 
index b2a6f2f..b5f57e9 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.openecomp.sdc.vendorsoftwareproduct.utils;
 
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -36,20 +33,20 @@ import java.util.zip.ZipOutputStream;
  * @since November 08, 2016
  */
 public class ZipFileUtils {
-  private static final Logger log = (Logger) LoggerFactory.getLogger(ZipFileUtils.class.getName());
+
   public InputStream getZipInputStream(String name) {
+
     URL url = getClass().getResource(name);
     File templateDir = new File(url.getFile());
 
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
+    try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+         ZipOutputStream zos = new ZipOutputStream(baos)) {
+
+      VSPCommon.zipDir(templateDir, "", zos, true);
+      return new ByteArrayInputStream(baos.toByteArray());
 
-    VSPCommon.zipDir(templateDir, "", zos, true);
-    try {
-      zos.close();
     } catch (IOException exception) {
-      log.debug("",exception);
+      throw new RuntimeException("Failed to read from Zip file: " + name, exception);
     }
-    return new ByteArrayInputStream(baos.toByteArray());
   }
 }
index 1c52930..72485d7 100644 (file)
@@ -42,6 +42,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
@@ -67,7 +68,7 @@ public class CommonUtil {
       throws IOException {
     Pair<FileContentHandler,List<String> > pair = getFileContentMapFromOrchestrationCandidateZip(uploadFileData);
 
-    if(type.equals(OnboardingTypesEnum.ZIP)) {
+    if(isFileOriginFromZip(type.toString())) {
       validateNoFolders(pair.getRight());
     }
 
@@ -133,7 +134,7 @@ public class CommonUtil {
     return -1;
   }
 
-  public static boolean validateFilesExtensions(Set<String> allowedExtensions, FileContentHandler
+  private static boolean validateFilesExtensions(Set<String> allowedExtensions, FileContentHandler
       files) {
     for (String fileName : files.getFileList()) {
       if (!allowedExtensions.contains(FilenameUtils.getExtension(fileName))) {
@@ -147,4 +148,9 @@ public class CommonUtil {
     Set<String> allowedExtensions = new HashSet<>(Arrays.asList("yml", "yaml"));
     return validateFilesExtensions(allowedExtensions, files);
   }
+
+  public static boolean isFileOriginFromZip(String fileOrigin){
+   return Objects.nonNull(fileOrigin)
+        && fileOrigin.toLowerCase().equals(OnboardingTypesEnum.ZIP.toString());
+  }
 }
index 8de222e..d5cd56e 100644 (file)
@@ -23,10 +23,13 @@ package org.openecomp.core.utilities.file;
 import org.apache.commons.collections4.MapUtils;
 
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
+import java.util.function.Function;
 
 public class FileContentHandler {
 
@@ -45,12 +48,31 @@ public class FileContentHandler {
       return null;
     }
 
-    ByteArrayInputStream is = new ByteArrayInputStream(content);
-    return is;
+    return new ByteArrayInputStream(content);
   }
 
-  public void addFile(String fileName, byte[] contect) {
-    files.put(fileName, contect);
+  /**
+   * Applies a business logic to a file's content while taking care of all retrieval logic.
+   *
+   * @param fileName name of a file inside this content handler.
+   * @param processor the business logic to work on the file's input stream, which may not be set
+   *                  (check the {@link Optional} if no such file can be found
+   * @param <T> return type, may be {@link java.lang.Void}
+   *
+   * @return result produced by the processor
+   */
+  public <T> T processFileContent(String fileName, Function<Optional<InputStream>, T> processor) {
+
+    // do not throw IOException to mimic the existing uses of getFileContent()
+    try (InputStream contentInputStream = getFileContent(fileName)) {
+      return processor.apply(Optional.ofNullable(contentInputStream));
+    } catch (IOException e) {
+      throw new ProcessingException("Failed to process file: " + fileName, e);
+    }
+  }
+
+  public void addFile(String fileName, byte[] content) {
+    files.put(fileName, content);
   }
 
   public void addFile(String fileName, InputStream is) {
@@ -94,4 +116,26 @@ public class FileContentHandler {
   public boolean containsFile(String fileName) {
     return files.containsKey(fileName);
   }
+
+  /**
+   * An application-specific runtime exception
+   */
+  private static class ProcessingException extends RuntimeException {
+
+    public ProcessingException() {
+      super();
+    }
+
+    public ProcessingException(String message) {
+      super(message);
+    }
+
+    public ProcessingException(Throwable cause) {
+      super(cause);
+    }
+
+    public ProcessingException(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+  }
 }
index 04e64c3..85fe305 100644 (file)
@@ -20,13 +20,11 @@ public enum OnboardingTypesEnum {
         if (inStr == null) {
             return null;
         }
+
         Optional<OnboardingTypesEnum>  onboardingTypesOptional =  asList(OnboardingTypesEnum.values()).stream()
-                .filter(onboardingTypesEnum -> onboardingTypesEnum.toString().equals(inStr)).findAny();
-       if( onboardingTypesOptional.isPresent()){
-          return onboardingTypesOptional.get();
-       }else {
-           return null;
-       }
+                .filter(onboardingTypesEnum -> onboardingTypesEnum.toString().equals(inStr.toLowerCase()))
+            .findAny();
+      return onboardingTypesOptional.orElse(null);
     }
 
 }
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java
new file mode 100644 (file)
index 0000000..527ba22
--- /dev/null
@@ -0,0 +1,53 @@
+package org.openecomp.core.utilities.file;
+
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Optional;
+
+import static org.testng.Assert.*;
+
+/**
+ * @author EVITALIY
+ * @since 24 Oct 17
+ */
+public class FileContentHandlerTest {
+
+    private static final String FILE_NAME = "test-file.txt";
+
+    @Test
+    public void testProcessFileContent() throws Exception {
+
+        final int size = 13;
+        FileContentHandler contentHandler = new FileContentHandler();
+        final byte[] content = new byte[size];
+        Arrays.fill(content, (byte) 44);
+        contentHandler.addFile(FILE_NAME, content);
+        assertEquals(contentHandler.processFileContent(FILE_NAME, optional -> {
+
+            try {
+                byte[] buffer = new byte[size];
+                assertTrue(optional.isPresent());
+                assertEquals(size, optional.get().read(buffer));
+                return buffer;
+            } catch (IOException e) {
+                throw new RuntimeException("Unexpected error", e);
+            }
+
+        }), content);
+    }
+
+    @Test
+    public void testProcessEmptyFileContent() throws Exception {
+        FileContentHandler contentHandler = new FileContentHandler();
+        contentHandler.addFile(FILE_NAME, new byte[0]);
+        assertFalse(contentHandler.processFileContent(FILE_NAME, Optional::isPresent));
+    }
+
+    @Test
+    public void testProcessNoFileContent() throws Exception {
+        FileContentHandler contentHandler = new FileContentHandler();
+        assertFalse(contentHandler.processFileContent("filename", Optional::isPresent));
+    }
+}
\ No newline at end of file
index fc01e2e..6312e5a 100644 (file)
@@ -23,16 +23,18 @@ package org.openecomp.sdc.heat.datatypes.model;
 import org.junit.Test;
 import org.openecomp.sdc.tosca.services.YamlUtil;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 public class EnvironmentTest {
 
   @Test
-  public void testYamlToServiceTemplateObj() {
+  public void testYamlToServiceTemplateObj() throws IOException {
     YamlUtil yamlUtil = new YamlUtil();
-    InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env");
-    Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class);
-    envVars.toString();
+    try (InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env")) {
+      Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class);
+      envVars.toString();
+    }
   }
 
   @Test
@@ -46,9 +48,8 @@ public class EnvironmentTest {
     if (heatResourceName.length() == lastIndexOfUnderscore) {
       System.out.println(heatResourceName);
     } else {
-      String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1);
+
       try {
-        int heatResourceNameSuffixInt = Integer.parseInt(heatResourceNameSuffix);
         System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore));
       } catch (NumberFormatException ignored) {
         System.out.println(heatResourceName);
index 3715b0f..dd8abdc 100644 (file)
@@ -26,6 +26,7 @@ import org.openecomp.sdc.logging.api.Logger;
 import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.tosca.services.YamlUtil;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -37,12 +38,13 @@ public class HeatOrchestrationTemplateTest {
   private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
 
   @Test
-  public void testYamlToServiceTemplateObj() {
+  public void testYamlToServiceTemplateObj() throws IOException {
     YamlUtil yamlUtil = new YamlUtil();
-    InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml");
-    HeatOrchestrationTemplate heatOrchestrationTemplate =
-        yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class);
-    heatOrchestrationTemplate.toString();
+    try (InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml")) {
+      HeatOrchestrationTemplate heatOrchestrationTemplate =
+              yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class);
+      heatOrchestrationTemplate.toString();
+    }
   }
 
   @Test
index a0034a3..ddbcaf7 100644 (file)
@@ -25,14 +25,12 @@ import org.openecomp.config.api.ConfigurationManager;
 import org.openecomp.core.utilities.CommonMethods;
 import org.openecomp.core.utilities.file.FileContentHandler;
 import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ErrorCode;
 import org.openecomp.sdc.common.utils.SdcCommon;
 import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
 import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile;
 import org.openecomp.sdc.heat.datatypes.model.Resource;
 import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
-import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
 import org.openecomp.sdc.tosca.services.ToscaUtil;
 import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslatedHeatResource;
@@ -42,6 +40,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
 import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants;
 import org.openecomp.sdc.translator.services.heattotosca.Constants;
 import org.openecomp.sdc.translator.services.heattotosca.NameExtractor;
+import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder;
 import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
 
 import java.io.InputStream;
@@ -385,10 +384,7 @@ public class TranslationContext {
     }
 
     if(nodeAbstractNodeTemplateIdMap.containsKey(originalNodeTemplateId)){
-      throw new CoreException((new ErrorCode.ErrorCodeBuilder())
-          .withMessage("Resource with id "
-              + originalNodeTemplateId + " occures more than once in different addOn files")
-          .build());
+      throw new CoreException(new DuplicateResourceIdsInDifferentFilesErrorBuilder(originalNodeTemplateId).build());
     }
     nodeAbstractNodeTemplateIdMap.put(originalNodeTemplateId, abstractNodeTemplateId);
     this.getUnifiedSubstitutionData().get(serviceTemplateFileName).setNodesRelatedAbstractNode(
index b86038d..5d1bb1c 100644 (file)
@@ -31,6 +31,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData;
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
+import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -154,10 +155,7 @@ public class ConsolidationDataUtil {
 
     if(isNestedResourceIdOccuresInDifferentNestedFiles(context, nestedHeatFileName,
         nestedNodeTemplateId)){
-      throw new CoreException((new ErrorCode.ErrorCodeBuilder())
-          .withMessage("Resource with id "
-              + nestedNodeTemplateId + " occures more than once in different addOn "
-              + "files").build());
+      throw new CoreException(new DuplicateResourceIdsInDifferentFilesErrorBuilder(nestedNodeTemplateId).build());
     }
 
     ConsolidationData consolidationData = context.getConsolidationData();
index 16a6301..d3f2a72 100644 (file)
@@ -24,6 +24,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.RequirementAssignmentData;
 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
+import org.openecomp.sdc.translator.services.heattotosca.errors.DuplicateResourceIdsInDifferentFilesErrorBuilder;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -637,20 +638,16 @@ public class ConsolidationService {
     NodeTemplate startingPortNodeTemplate = nodeTemplates.get(portNodeTemplateIdList.get(0));
 
     if (Objects.isNull(startingPortNodeTemplate)) {
-      throw new CoreException((new ErrorCode.ErrorCodeBuilder())
-          .withMessage("Resource with id "
-              + portNodeTemplateIdList.get(0) + " occures more than once in different addOn files")
-          .build());
+      throw new CoreException(
+          new DuplicateResourceIdsInDifferentFilesErrorBuilder(portNodeTemplateIdList.get(0)).build());
     }
 
     for (int i = 1; i < portNodeTemplateIdList.size(); i++) {
       NodeTemplate portNodeTemplate = nodeTemplates.get(portNodeTemplateIdList.get(i));
 
       if (Objects.isNull(portNodeTemplate)) {
-        throw new CoreException((new ErrorCode.ErrorCodeBuilder())
-            .withMessage("Resource with id "
-                + portNodeTemplateIdList.get(i) + " occures more than once in different addOn "
-                + "files").build());
+        throw new CoreException(
+            new DuplicateResourceIdsInDifferentFilesErrorBuilder(portNodeTemplateIdList.get(i)).build());
       }
 
       if (!isPropertySimilarBetweenNodeTemplates(propertyToCheck, portNodeTemplateIdList, nodeTemplates)) {
@@ -695,9 +692,8 @@ public class ConsolidationService {
     for (int i = 1; i < entityNodeTemplateIds.size(); i++) {
       NodeTemplate currentNodeTemplate = idToNodeTemplate.get(entityNodeTemplateIds.get(i));
       if (Objects.isNull(currentNodeTemplate)) {
-        throw new CoreException((new ErrorCode.ErrorCodeBuilder())
-            .withMessage("Resource with id "
-                + entityNodeTemplateIds.get(i) + " occures more than once in different addOn files").build());
+        throw new CoreException(
+            new DuplicateResourceIdsInDifferentFilesErrorBuilder(entityNodeTemplateIds.get(i)).build());
       }
       if(propertyExistCondition != isPropertyExistInNodeTemplate(propertyToCheck, currentNodeTemplate)){
         return false;
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/errors/DuplicateResourceIdsInDifferentFilesErrorBuilder.java
new file mode 100644 (file)
index 0000000..a75e8b3
--- /dev/null
@@ -0,0 +1,16 @@
+package org.openecomp.sdc.translator.services.heattotosca.errors;
+
+import org.openecomp.sdc.common.errors.BaseErrorBuilder;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+
+public final class DuplicateResourceIdsInDifferentFilesErrorBuilder extends BaseErrorBuilder {
+
+  private static final String DUPLICATE_RESOURCE_ID_MSG = "Resource with id %s occurs more than once in " +
+      "different addOn files";
+
+  public DuplicateResourceIdsInDifferentFilesErrorBuilder(String resourceId) {
+    getErrorCodeBuilder().withId(TranslatorErrorCodes.DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES)
+    .withCategory(ErrorCategory.APPLICATION)
+    .withMessage(String.format(DUPLICATE_RESOURCE_ID_MSG, resourceId));
+  }
+}
index bfcf834..5afb1ae 100644 (file)
@@ -29,4 +29,5 @@ public class TranslatorErrorCodes {
       "REFERENCE_TO_UNSUPPORTED_RESOURCE";
   public static final String NOT_IN_SYNC_NUMBER_OF_INTERFACES = "NOT_IN_SYNC_NUMBER_OF_INTERFACES";
   public static final String INVALID_PROPERTY_VALUE = "INVALID_PROPERTY_VALUE";
+  public static final String DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES = "DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES";
 }
index b1946b3..9399b91 100644 (file)
@@ -2,7 +2,10 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
 
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.logging.api.Logger;
 import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
@@ -19,6 +22,9 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes
     // do not delete this function. it prevents the superclass setup from running
   }
 
+  @Rule
+  public ExpectedException exception = ExpectedException.none();
+
   @Test
   public void testMixPatterns() throws IOException {
     inputFilesPath =
@@ -52,16 +58,13 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes
 
   @Test
   public void testDuplicateResourceIdsInDiffAddOnFiles() throws IOException {
+    exception.expect(CoreException.class);
+    exception.expectMessage("Resource with id lb_0_int_oam_int_0_port occurs more " +
+        "than once in different addOn files");
+
     inputFilesPath =
         "/mock/services/heattotosca/fulltest/mixPatterns/duplicateResourceIdsInDiffAddOnFiles/in";
-
-    try {
-      testTranslationWithInit();
-    }catch(Exception e){
-      log.debug("",e);
-      Assert.assertEquals(e.getMessage(), "Resource with id lb_0_int_oam_int_0_port occures more " +
-          "than once in different addOn files");
-    }
+    testTranslationWithInit();
   }
 
   @Test
index f7ca646..dd303c7 100644 (file)
@@ -53,7 +53,7 @@ public class HeatFileAnalyzerRowDataImpl implements HeatFileAnalyzer {
   private static final String DESCRIPTION = "DESCRIPTION";
   private static final String NESTED_PATTERN = "NESTED_PATTERN";
 
-  private Map<String, Pattern> patterns;
+  private final Map<String, Pattern> patterns;
 
   public HeatFileAnalyzerRowDataImpl() {
     patterns = new HashMap<>();
@@ -72,16 +72,17 @@ public class HeatFileAnalyzerRowDataImpl implements HeatFileAnalyzer {
       throws IOException {
     AnalyzedZipHeatFiles analyzedZipHeatFiles = new AnalyzedZipHeatFiles();
 
-    BufferedReader bfReader;
     for (Map.Entry<String, byte[]> fileData : files.entrySet()) {
       String fileName = fileData.getKey();
       if (!HeatFileAnalyzer.isYamlFile(fileName)) {
         analyzedZipHeatFiles.addOtherNonModuleFile(fileName);
         continue;
       }
+
       boolean foundHeatIdentifier = false;
-      try (InputStream is = new ByteArrayInputStream(fileData.getValue())) {
-        bfReader = new BufferedReader(new InputStreamReader(is));
+      try (InputStream is = new ByteArrayInputStream(fileData.getValue());
+           BufferedReader bfReader = new BufferedReader(new InputStreamReader(is))) {
+
         String line;
         boolean isResourcesSection = false;
         Set<String> nestedFilesNames = new HashSet<>();
@@ -108,11 +109,9 @@ public class HeatFileAnalyzerRowDataImpl implements HeatFileAnalyzer {
         }
         analyzedZipHeatFiles.addNestedFiles(fetchFileNamesToReturn(nestedFilesNames,
             foundHeatIdentifier));
-        if (Objects.nonNull(bfReader)) {
-          bfReader.close();
-        }
       }
     }
+
     return analyzedZipHeatFiles;
   }
 
index ca53293..41510ec 100644 (file)
@@ -38,6 +38,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.impl.HeatFileAnalyzerRow
 import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
 import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
@@ -45,8 +46,10 @@ import java.util.Objects;
 import java.util.Optional;
 
 public class CandidateEntityBuilder {
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
-  private CandidateService candidateService;
+
+  private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
+
+  private final CandidateService candidateService;
 
   public CandidateEntityBuilder(CandidateService candidateService) {
     this.candidateService = candidateService;
@@ -57,35 +60,28 @@ public class CandidateEntityBuilder {
       Map<String, List<ErrorMessage>> uploadErrors, String user) throws Exception {
     //mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
 
-    InputStream zipFileManifest = contentMap.getFileContent(SdcCommon.MANIFEST_NAME);
-    HeatFileAnalyzer heatFileAnalyzer = new HeatFileAnalyzerRowDataImpl();
-    AnalyzedZipHeatFiles analyzedZipHeatFiles =
-        heatFileAnalyzer.analyzeFilesNotEligibleForModulesFromFileAnalyzer(contentMap.getFiles());
-    HeatStructureTree tree = getHeatStructureTree(vspDetails, contentMap, analyzedZipHeatFiles);
+    try (InputStream zipFileManifest = contentMap.getFileContent(SdcCommon.MANIFEST_NAME)) {
+      HeatFileAnalyzer heatFileAnalyzer = new HeatFileAnalyzerRowDataImpl();
+      AnalyzedZipHeatFiles analyzedZipHeatFiles =
+              heatFileAnalyzer.analyzeFilesNotEligibleForModulesFromFileAnalyzer(contentMap.getFiles());
+      HeatStructureTree tree = getHeatStructureTree(vspDetails, contentMap, analyzedZipHeatFiles);
 
-    CandidateDataEntityTo candidateDataEntityTo =
-        new CandidateDataEntityTo(vspDetails.getId(), user, uploadedFileData, tree, contentMap,
-            vspDetails.getVersion());
-    candidateDataEntityTo.setErrors(uploadErrors);
-    OrchestrationTemplateCandidateData candidateDataEntity =
-        candidateService.createCandidateDataEntity(candidateDataEntityTo, zipFileManifest,
-            analyzedZipHeatFiles);
+      CandidateDataEntityTo candidateDataEntityTo =
+              new CandidateDataEntityTo(vspDetails.getId(), user, uploadedFileData, tree, contentMap,
+                      vspDetails.getVersion());
+      candidateDataEntityTo.setErrors(uploadErrors);
+      OrchestrationTemplateCandidateData candidateDataEntity =
+              candidateService.createCandidateDataEntity(candidateDataEntityTo, zipFileManifest,
+                      analyzedZipHeatFiles);
 
-    mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
-    return candidateDataEntity;
+      MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP Id", vspDetails.getId());
+      return candidateDataEntity;
+    }
   }
 
-//  public OrchestrationTemplateCandidateData buildOrchestrationTemplateFromCsar(VspDetails vspDetails,
-//                                                                               byte[] uploadedFileData,
-//                                                                               FileContentHandler contentMap,
-//                                                                               Map<String, List<ErrorMessage>> uploadErrors,
-//                                                                               String user){
-//
-//  }
-
   private HeatStructureTree getHeatStructureTree(VspDetails vspDetails,
                                                  FileContentHandler contentMap,
-                                                 AnalyzedZipHeatFiles analyzedZipHeatFiles) {
+                                                 AnalyzedZipHeatFiles analyzedZipHeatFiles) throws IOException {
     addManifestToFileContentMapIfNotExist(vspDetails, contentMap, analyzedZipHeatFiles);
     HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(contentMap);
     heatTreeManager.createTree();
@@ -94,22 +90,24 @@ public class CandidateEntityBuilder {
 
   private void addManifestToFileContentMapIfNotExist(VspDetails vspDetails,
                                                      FileContentHandler fileContentHandler,
-                                                     AnalyzedZipHeatFiles analyzedZipHeatFiles) {
-    mdcDataDebugMessage.debugEntryMessage("VSP Id", vspDetails.getId());
+                                                     AnalyzedZipHeatFiles analyzedZipHeatFiles) throws IOException {
+    MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("VSP Id", vspDetails.getId());
+
+    try (InputStream manifest = fileContentHandler.getFileContent(SdcCommon.MANIFEST_NAME)) {
 
-    InputStream manifest = fileContentHandler.getFileContent(SdcCommon.MANIFEST_NAME);
-    if (Objects.isNull(manifest)) {
-      Optional<ManifestContent> manifestContentOptional =
-          candidateService.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
-      if (!manifestContentOptional.isPresent()) {
-        throw new RuntimeException(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
+      if (Objects.isNull(manifest)) {
+        Optional<ManifestContent> manifestContentOptional =
+                candidateService.createManifest(vspDetails, fileContentHandler, analyzedZipHeatFiles);
+        if (!manifestContentOptional.isPresent()) {
+          throw new RuntimeException(Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
+        }
+        ManifestContent manifestContent = manifestContentOptional.get();
+        fileContentHandler.addFile(
+                SdcCommon.MANIFEST_NAME,
+                String.valueOf(JsonUtil.sbObject2Json(manifestContent)).getBytes());
       }
-      ManifestContent manifestContent = manifestContentOptional.get();
-      fileContentHandler.addFile(
-          SdcCommon.MANIFEST_NAME,
-          String.valueOf(JsonUtil.sbObject2Json(manifestContent)).getBytes());
+    } finally {
+      MDC_DATA_DEBUG_MESSAGE.debugExitMessage("VSP Id", vspDetails.getId());
     }
-
-    mdcDataDebugMessage.debugExitMessage("VSP Id", vspDetails.getId());
   }
 }
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/OrchestrationTemplateFileExtensionErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/OrchestrationTemplateFileExtensionErrorBuilder.java
new file mode 100644 (file)
index 0000000..6545ca1
--- /dev/null
@@ -0,0 +1,22 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_EXTENSION;
+
+public class OrchestrationTemplateFileExtensionErrorBuilder {
+  private static final String INVALID_EXTENSION_MSG = "Invalid file extension. Valid extensions " +
+      "are : zip, csar.";
+  private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+  public OrchestrationTemplateFileExtensionErrorBuilder(){
+    builder.withId(INVALID_EXTENSION);
+    builder.withCategory(ErrorCategory.APPLICATION);
+    builder.withMessage(String.format(INVALID_EXTENSION_MSG));
+  }
+
+  public ErrorCode build() {
+    return builder.build();
+  }
+}
index 348739e..9b694c5 100644 (file)
@@ -54,7 +54,8 @@ public class ToscaConverterImpl implements ToscaConverter {
                     break;
 
                 case externalFile:
-                    artifacts.addFile(fileEntry.getKey(), fileEntry.getValue());
+                    artifacts.addFile(
+                        getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue());
                     break;
 
                 case definitionsFile:
@@ -94,6 +95,17 @@ public class ToscaConverterImpl implements ToscaConverter {
         }
     }
 
+    private String getConcreteArtifactFileName(String fileName){
+        int artifactIndex = fileName.indexOf(CsarFileTypes.Artifacts.name());
+        if(artifactIndex < 0){
+            return fileName;
+        }
+
+        int artifactDirectoryIndex =
+            artifactIndex + CsarFileTypes.Artifacts.name().length() + 1;
+        return fileName.substring(artifactDirectoryIndex);
+    }
+
     private void updateToscaServiceModel(ToscaServiceModel toscaServiceModel,
                                          Map<String, ServiceTemplate> serviceTemplates,
                                          FileContentHandler externalFilesHandler,
index f29ca4a..471e389 100644 (file)
@@ -41,22 +41,18 @@ public class ToscaConverterImplTest {
   private static final String VIRTUAL_LINK = "virtualLink";
   private static final String UNBOUNDED = "UNBOUNDED";
 
-  private static String inputFilesPath;
-  private static String outputFilesPath;
-  private static Map<String, ServiceTemplate> expectedOutserviceTemplates;
-
 
   @Test
   public void testConvertMainSt() throws IOException {
-    inputFilesPath = "/mock/toscaConverter/convertMainSt/in";
-    outputFilesPath = "/mock/toscaConverter/convertMainSt/out";
+    String inputFilesPath = "/mock/toscaConverter/convertMainSt/in";
+    String outputFilesPath = "/mock/toscaConverter/convertMainSt/out";
 
     FileContentHandler fileContentHandler =
         createFileContentHandlerFromInput(inputFilesPath);
 
-    expectedOutserviceTemplates = new HashMap<>();
+    Map<String, ServiceTemplate> expectedOutserviceTemplates = new HashMap<>();
     loadServiceTemplates(outputFilesPath, new ToscaExtensionYamlUtil(),
-        expectedOutserviceTemplates);
+            expectedOutserviceTemplates);
 
     ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
     ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(mainStName);
@@ -201,18 +197,15 @@ public class ToscaConverterImplTest {
 
   private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
                                               File[] files,
-                                              ToscaExtensionYamlUtil toscaExtensionYamlUtil)
-      throws IOException {
+                                              ToscaExtensionYamlUtil toscaExtensionYamlUtil) throws IOException {
+
     for (File file : files) {
+
       try (InputStream yamlFile = new FileInputStream(file)) {
         ServiceTemplate serviceTemplateFromYaml =
             toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
         createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil);
         serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
-        try {
-          yamlFile.close();
-        } catch (IOException ignore) {
-        }
       }
     }
   }
index c7f4e3f..e8c9c60 100644 (file)
@@ -46,6 +46,7 @@ import org.openecomp.sdc.tosca.services.ToscaConstants;
 import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
 import org.openecomp.sdc.tosca.services.YamlUtil;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -271,27 +272,29 @@ public class ToscaModelTest {
 
 
   @Test
-  public void testYamlToServiceTemplateObj() {
-    InputStream yamlFile = new YamlUtil().loadYamlFileIs("/mock/model/serviceTemplate.yaml");
-    ServiceTemplate serviceTemplateFromYaml =
-        new YamlUtil().yamlToObject(yamlFile, ServiceTemplate.class);
-    Assert.assertNotNull(serviceTemplateFromYaml);
+  public void testYamlToServiceTemplateObj() throws IOException {
+    try (InputStream yamlFile = new YamlUtil().loadYamlFileIs("/mock/model/serviceTemplate.yaml")) {
+      ServiceTemplate serviceTemplateFromYaml =
+              new YamlUtil().yamlToObject(yamlFile, ServiceTemplate.class);
+      Assert.assertNotNull(serviceTemplateFromYaml);
+    }
   }
 
 
   @Test
-  public void testYamlToServiceTemplateIncludingHeatExtend() {
+  public void testYamlToServiceTemplateIncludingHeatExtend() throws IOException {
     ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-    InputStream yamlFile =
-        toscaExtensionYamlUtil.loadYamlFileIs("/mock/model/serviceTemplateHeatExtend.yaml");
-    ServiceTemplate serviceTemplateFromYaml =
-        toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
-    ParameterDefinitionExt parameterDefinitionExt =
-        (ParameterDefinitionExt) serviceTemplateFromYaml.getTopology_template().getInputs()
-            .get("inParam1");
-    Assert.assertNotNull(parameterDefinitionExt.getLabel());
-    String backToYamlString = toscaExtensionYamlUtil.objectToYaml(serviceTemplateFromYaml);
-    Assert.assertNotNull(backToYamlString);
+    try (InputStream yamlFile =
+        toscaExtensionYamlUtil.loadYamlFileIs("/mock/model/serviceTemplateHeatExtend.yaml")) {
+      ServiceTemplate serviceTemplateFromYaml =
+              toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+      ParameterDefinitionExt parameterDefinitionExt =
+              (ParameterDefinitionExt) serviceTemplateFromYaml.getTopology_template().getInputs()
+                      .get("inParam1");
+      Assert.assertNotNull(parameterDefinitionExt.getLabel());
+      String backToYamlString = toscaExtensionYamlUtil.objectToYaml(serviceTemplateFromYaml);
+      Assert.assertNotNull(backToYamlString);
+    }
   }
 
 }
index 7ae91ab..aad2163 100644 (file)
@@ -78,9 +78,9 @@ public class ToscaAnalyzerServiceImplTest {
   public ExpectedException thrown = ExpectedException.none();
 
   @Mock
-  NodeTemplate nodeTemplateMock;
+  private NodeTemplate nodeTemplateMock;
   @Mock
-  ToscaServiceModel toscaServiceModelMock;
+  private ToscaServiceModel toscaServiceModelMock;
 
   @BeforeClass
   public static void onlyOnceSetUp() throws IOException {
@@ -97,27 +97,29 @@ public class ToscaAnalyzerServiceImplTest {
   @Test
   public void testGetRequirements() throws Exception {
     ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-    InputStream yamlFile = toscaExtensionYamlUtil
-        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
-    ServiceTemplate
-        serviceTemplateFromYaml =
-        toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
-
-    NodeTemplate port_0 =
-        serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui_port_0");
-    List<RequirementAssignment> reqList =
-        toscaAnalyzerService.getRequirements(port_0, ToscaConstants.BINDING_REQUIREMENT_ID);
-    assertEquals(1, reqList.size());
-
-    reqList.clear();
-    NodeTemplate port_1 =
-        serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui1_port_1");
-    reqList = toscaAnalyzerService.getRequirements(port_1, ToscaConstants.LINK_REQUIREMENT_ID);
-    assertEquals(2, reqList.size());
-
-    reqList.clear();
-    reqList = toscaAnalyzerService.getRequirements(port_0, ToscaConstants.LINK_REQUIREMENT_ID);
-    assertEquals(0, reqList.size());
+    try (InputStream yamlFile = toscaExtensionYamlUtil
+        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml")) {
+
+      ServiceTemplate
+              serviceTemplateFromYaml =
+              toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+      NodeTemplate port_0 =
+              serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui_port_0");
+      List<RequirementAssignment> reqList =
+              toscaAnalyzerService.getRequirements(port_0, ToscaConstants.BINDING_REQUIREMENT_ID);
+      assertEquals(1, reqList.size());
+
+      reqList.clear();
+      NodeTemplate port_1 =
+              serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui1_port_1");
+      reqList = toscaAnalyzerService.getRequirements(port_1, ToscaConstants.LINK_REQUIREMENT_ID);
+      assertEquals(2, reqList.size());
+
+      reqList.clear();
+      reqList = toscaAnalyzerService.getRequirements(port_0, ToscaConstants.LINK_REQUIREMENT_ID);
+      assertEquals(0, reqList.size());
+    }
   }
 
   @Test
@@ -171,44 +173,45 @@ public class ToscaAnalyzerServiceImplTest {
         .getSubstituteServiceTemplateName("invalid1", invalidSubstitutableNodeTemplate1);
     assertEquals(false, substituteServiceTemplateName.isPresent());
 
-    if (substitutableNodeTemplate.isPresent()) {
-      NodeTemplate invalidSubstitutableNodeTemplate2 = substitutableNodeTemplate.get();
-      Object serviceTemplateFilter = invalidSubstitutableNodeTemplate2.getProperties()
-          .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
+    substitutableNodeTemplate.ifPresent(nodeTemplate -> {
+      Object serviceTemplateFilter = nodeTemplate.getProperties()
+              .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
       ((Map) serviceTemplateFilter).clear();
       toscaAnalyzerService
-          .getSubstituteServiceTemplateName("invalid2", invalidSubstitutableNodeTemplate2);
+              .getSubstituteServiceTemplateName("invalid2", nodeTemplate);
 
-    }
+    });
   }
 
 
   @Test
   public void testGetSubstitutableNodeTemplates() throws Exception {
     ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-    InputStream yamlFile = toscaExtensionYamlUtil
-        .loadYamlFileIs("/mock/analyzerService/ServiceTemplateSubstituteTest.yaml");
-    ServiceTemplate serviceTemplateFromYaml =
-        toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
-
-    Map<String, NodeTemplate> substitutableNodeTemplates =
-        toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
-    assertEquals(2, substitutableNodeTemplates.size());
-    assertNotNull(substitutableNodeTemplates.get("test_nested1"));
-    assertNotNull(substitutableNodeTemplates.get("test_nested2"));
+    try (InputStream yamlFile = toscaExtensionYamlUtil
+        .loadYamlFileIs("/mock/analyzerService/ServiceTemplateSubstituteTest.yaml")) {
+      ServiceTemplate serviceTemplateFromYaml =
+              toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+      Map<String, NodeTemplate> substitutableNodeTemplates =
+              toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
+      assertEquals(2, substitutableNodeTemplates.size());
+      assertNotNull(substitutableNodeTemplates.get("test_nested1"));
+      assertNotNull(substitutableNodeTemplates.get("test_nested2"));
+
+      ServiceTemplate emptyServiceTemplate = new ServiceTemplate();
+      emptyServiceTemplate.setTopology_template(new TopologyTemplate());
+      substitutableNodeTemplates =
+              toscaAnalyzerService.getSubstitutableNodeTemplates(emptyServiceTemplate);
+      assertEquals(0, substitutableNodeTemplates.size());
+    }
 
-    ServiceTemplate emptyServiceTemplate = new ServiceTemplate();
-    emptyServiceTemplate.setTopology_template(new TopologyTemplate());
-    substitutableNodeTemplates =
-        toscaAnalyzerService.getSubstitutableNodeTemplates(emptyServiceTemplate);
-    assertEquals(0, substitutableNodeTemplates.size());
-
-    yamlFile = toscaExtensionYamlUtil
-        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
-    serviceTemplateFromYaml = toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
-    substitutableNodeTemplates =
-        toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
-    assertEquals(0, substitutableNodeTemplates.size());
+    try (InputStream yamlFile = toscaExtensionYamlUtil
+              .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml")) {
+      ServiceTemplate serviceTemplateFromYaml = toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+      Map<String, NodeTemplate> substitutableNodeTemplates =
+              toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
+      assertEquals(0, substitutableNodeTemplates.size());
+    }
   }
 
   @Test
@@ -217,35 +220,36 @@ public class ToscaAnalyzerServiceImplTest {
     thrown.expectMessage(
         "Invalid Tosca model data, missing 'Node Template' entry for 'Node Template' id cmaui_port_9");
     ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-    InputStream yamlFile = toscaExtensionYamlUtil
-        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
-    ServiceTemplate nestedServiceTemplateFromYaml =
-        toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
-
-    Optional<Map.Entry<String, NodeTemplate>> mappedNodeTemplate = toscaAnalyzerService
-        .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
-            nestedServiceTemplateFromYaml, "local_storage_server_cmaui");
-    assertEquals(true, mappedNodeTemplate.isPresent());
-    if (mappedNodeTemplate.isPresent()) {
-      assertEquals("server_cmaui", mappedNodeTemplate.get().getKey());
-      assertNotNull(mappedNodeTemplate.get().getValue());
+    try (InputStream yamlFile = toscaExtensionYamlUtil
+        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml")) {
+      ServiceTemplate nestedServiceTemplateFromYaml =
+              toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+      Optional<Map.Entry<String, NodeTemplate>> mappedNodeTemplate = toscaAnalyzerService
+              .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+                      nestedServiceTemplateFromYaml, "local_storage_server_cmaui");
+      assertEquals(true, mappedNodeTemplate.isPresent());
+      mappedNodeTemplate.ifPresent(stringNodeTemplateEntry -> {
+        assertEquals("server_cmaui", stringNodeTemplateEntry.getKey());
+        assertNotNull(stringNodeTemplateEntry.getValue());
+      });
+
+      mappedNodeTemplate = toscaAnalyzerService
+              .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+                      nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
+      assertEquals(true, mappedNodeTemplate.isPresent());
+      mappedNodeTemplate.ifPresent(stringNodeTemplateEntry -> {
+        assertEquals("server_cmaui", stringNodeTemplateEntry.getKey());
+        assertNotNull(stringNodeTemplateEntry.getValue());
+      });
+
+      ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
+              .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
+      mappedNodeTemplate = toscaAnalyzerService.getSubstitutionMappedNodeTemplateByExposedReq(
+              toscaServiceModel.getEntryDefinitionServiceTemplate(), mainServiceTemplate,
+              "local_storage_server_cmaui");
+      assertEquals(false, mappedNodeTemplate.isPresent());
     }
-
-    mappedNodeTemplate = toscaAnalyzerService
-        .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
-            nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
-    assertEquals(true, mappedNodeTemplate.isPresent());
-    if (mappedNodeTemplate.isPresent()) {
-      assertEquals("server_cmaui", mappedNodeTemplate.get().getKey());
-      assertNotNull(mappedNodeTemplate.get().getValue());
-    }
-
-    ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
-        .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
-    mappedNodeTemplate = toscaAnalyzerService.getSubstitutionMappedNodeTemplateByExposedReq(
-        toscaServiceModel.getEntryDefinitionServiceTemplate(), mainServiceTemplate,
-        "local_storage_server_cmaui");
-    assertEquals(false, mappedNodeTemplate.isPresent());
   }
 
   @Test
@@ -283,14 +287,15 @@ public class ToscaAnalyzerServiceImplTest {
     thrown.expectMessage(
         "Invalid Tosca model data, missing 'Node Template' entry for 'Node Template' id cmaui_port_9");
     ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-    InputStream yamlFile = toscaExtensionYamlUtil
-        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
-    ServiceTemplate nestedServiceTemplateFromYaml =
-        toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+    try (InputStream yamlFile = toscaExtensionYamlUtil
+        .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml")) {
+      ServiceTemplate nestedServiceTemplateFromYaml =
+              toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
 
-    toscaAnalyzerService
-        .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
-            nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
+      toscaAnalyzerService
+              .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+                      nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
+    }
   }
 
   @Test
index 4d025e1..66dda12 100644 (file)
@@ -41,7 +41,7 @@ import java.util.zip.ZipFile;
 
 public class ToscaFileOutputServiceCsarImplTest {
 
-  private ToscaFileOutputServiceCsarImpl toscaFileOutputServiceCSARImpl =
+  private final ToscaFileOutputServiceCsarImpl toscaFileOutputServiceCSARImpl =
       new ToscaFileOutputServiceCsarImpl();
 
   @Test
@@ -112,21 +112,22 @@ public class ToscaFileOutputServiceCsarImplTest {
 
     String resultFileName = "resultFile.zip";
     File file = new File(resultFileName);
-    FileOutputStream fos = new FileOutputStream(file);
-    fos.write(csarFile);
-    fos.close();
+    try (FileOutputStream fos = new FileOutputStream(file)) {
+      fos.write(csarFile);
+    }
 
-    ZipFile zipFile = new ZipFile(resultFileName);
+    try (ZipFile zipFile = new ZipFile(resultFileName)) {
 
-    Enumeration<? extends ZipEntry> entries = zipFile.entries();
+      Enumeration<? extends ZipEntry> entries = zipFile.entries();
 
-    int count = 0;
-    while (entries.hasMoreElements()) {
-      count++;
-      entries.nextElement();
+      int count = 0;
+      while (entries.hasMoreElements()) {
+        count++;
+        entries.nextElement();
+      }
+      Assert.assertEquals(7, count);
     }
-    Assert.assertEquals(7, count);
-    zipFile.close();
+
     Files.delete(Paths.get(file.getPath()));
   }
 
@@ -150,21 +151,22 @@ public class ToscaFileOutputServiceCsarImplTest {
 
     String resultFileName = "resultFile.zip";
     File file = new File(resultFileName);
-    FileOutputStream fos = new FileOutputStream(file);
-    fos.write(csarFile);
-    fos.close();
+    try (FileOutputStream fos = new FileOutputStream(file)) {
+      fos.write(csarFile);
+    }
 
-    ZipFile zipFile = new ZipFile(resultFileName);
+    try (ZipFile zipFile = new ZipFile(resultFileName)) {
 
-    Enumeration<? extends ZipEntry> entries = zipFile.entries();
+      Enumeration<? extends ZipEntry> entries = zipFile.entries();
 
-    int count = 0;
-    while (entries.hasMoreElements()) {
-      count++;
-      entries.nextElement();
+      int count = 0;
+      while (entries.hasMoreElements()) {
+        count++;
+        entries.nextElement();
+      }
+      Assert.assertEquals(2, count);
     }
-    Assert.assertEquals(2, count);
-    zipFile.close();
+
     Files.delete(Paths.get(file.getPath()));
   }
 }
index fbfde74..1d9d2d9 100644 (file)
@@ -2,6 +2,7 @@ package org.openecomp.core.tools.store;
 
 import com.amdocs.zusammen.datatypes.Id;
 import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Info;
 import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
 import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
 import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
@@ -10,6 +11,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Objects;
 
 public class VspGeneralLoader {
 
@@ -114,16 +116,20 @@ public class VspGeneralLoader {
         if(changeRef!= null){
           subElementContext.setChangeRef(changeRef);
         }
-        Optional<ElementEntity> subElementEntity =
+        Optional<ElementEntity> subElementEntityOptional =
                 cassandraElementRepository.get(context, subElementContext,
                         new ElementEntity(subelementId));
-        if (subElementEntity.isPresent()) {
+        if (subElementEntityOptional.isPresent()) {
+          Info info = subElementEntityOptional.get().getInfo();
+          if (isValid(name, info)) {
+            return false;
+          }
           if (NAME.equals(name)) {
-            if (value.equals(subElementEntity.get().getInfo().getName())) {
+            if (value.equals(info.getName())) {
               return true;
             }
           }
-          if (value.equals(subElementEntity.get().getInfo().getProperty(name))) {
+          if (value.equals(info.getProperty(name))) {
             return true;
           }
         }
@@ -136,5 +142,9 @@ public class VspGeneralLoader {
 
   }
 
+  private static boolean isValid(String name, Info info) {
+    return Objects.isNull(info)|| Objects.isNull(info.getProperty(name));
+  }
+
 
 }
index f282046..4e7a1a1 100644 (file)
@@ -114,7 +114,9 @@ export class  GlobalModalView extends React.Component {
                                <Modal.Body>
                                        {ComponentToRender ?
                                                <ComponentToRender {...modalComponentProps}/> :
-                                               <div> {msg && msg.split('\n').map(txt => <span> {txt} <br/> </span>)} </div>
+                                               msg && typeof msg === 'string' ?
+                                                       <div> {msg.split('\n').map(txt => <span> {txt} <br/> </span>)} </div> :
+                                                       msg
                                        }
                                </Modal.Body>
                                {(onConfirmed || onDeclined || type !== typeEnum.DEFAULT) &&
index ae53a75..1eb6eeb 100644 (file)
@@ -44,7 +44,7 @@ const mapActionsToProps = (dispatch) => {
                        data:{
                                msg: i18n(`Are you sure you want to delete ${limit.name}?`),
                                confirmationButtonText: i18n('Delete'),
-                               title: i18n('Warning'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=> EntitlementPoolsActionHelper.deleteLimit(dispatch, {limit, entitlementPool: parent, licenseModelId, version}).then(() => 
                                        selectedLimit === limit.id && onCloseLimitEditor()
                                )
index 62c6663..fa21109 100644 (file)
@@ -43,8 +43,9 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
                onDeleteEntitlementPool: entitlementPool => dispatch({
                        type: globalMoadlActions.GLOBAL_MODAL_WARNING,
                        data:{
-                               msg: generateConfirmationMsg(entitlementPool),                          
-                               title: i18n('Warning'),                         
+                               msg: generateConfirmationMsg(entitlementPool),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=>EntitlementPoolsActionHelper.deleteEntitlementPool(dispatch, {
                                        licenseModelId,
                                        entitlementPoolId: entitlementPool.id,
index 83473a3..fc89238 100644 (file)
@@ -44,7 +44,8 @@ const mapActionsToProps = (dispatch, {licenseModelId}) => {
                        type: globalMoadlActions.GLOBAL_MODAL_WARNING,
                        data:{
                                msg: generateConfirmationMsg(featureGroup),
-                               title: i18n('Warning'),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=>FeatureGroupsActionHelper.deleteFeatureGroup(dispatch, {featureGroupId: featureGroup.id, licenseModelId, version})
                        }
                }),
index 72a99e2..92c2550 100644 (file)
@@ -45,7 +45,8 @@ const mapActionsToProps = (dispatch, {licenseModelId}) => {
                        type: globalMoadlActions.GLOBAL_MODAL_WARNING,
                        data:{
                                msg: i18n(`Are you sure you want to delete "${licenseAgreement.name}"?`),
-                               title: i18n('Warning'),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=>LicenseAgreementActionHelper.deleteLicenseAgreement(dispatch, {licenseModelId, licenseAgreementId: licenseAgreement.id, version})
                        }
                })
index 7745a12..0e20a6a 100644 (file)
@@ -45,7 +45,7 @@ const mapActionsToProps = (dispatch) => {
                        data:{
                                msg: i18n(`Are you sure you want to delete ${limit.name}?`),
                                confirmationButtonText: i18n('Delete'),
-                               title: i18n('Warning'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=> LicenseKeyGroupsActionHelper.deleteLimit(dispatch, {limit, licenseKeyGroup: parent, licenseModelId, version}).then(() => 
                                        selectedLimit === limit.id && onCloseLimitEditor()
                                )
index a8cf1eb..c1d9373 100644 (file)
@@ -42,8 +42,9 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
                onDeleteLicenseKeyGroupClick: licenseKeyGroup => dispatch({
                        type: globalMoadlActions.GLOBAL_MODAL_WARNING,
                        data:{
-                               msg: generateConfirmationMsg(licenseKeyGroup),                          
-                               title: i18n('Warning'),                         
+                               msg: generateConfirmationMsg(licenseKeyGroup),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=>LicenseKeyGroupsActionHelper.deleteLicenseKeyGroup(dispatch, {licenseModelId, licenseKeyGroupId:licenseKeyGroup.id, version})
                        }
                })
index 8262011..8c359db 100644 (file)
@@ -48,6 +48,8 @@ const mapActionsToProps = (dispatch, {componentId, softwareProductId}) => {
                        type: modalActionTypes.GLOBAL_MODAL_WARNING,
                        data:{
                                msg: i18n(`Are you sure you want to delete "${process.name}"?`),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=> SoftwareProductComponentProcessesActionHelper.deleteProcess(dispatch,
                                        {process, softwareProductId, version, componentId})
                        }
index afd6331..c704529 100644 (file)
@@ -43,6 +43,8 @@ const mapActionsToProps = (dispatch, {softwareProductId}) => {
                        type: modalActionTypes.GLOBAL_MODAL_WARNING,
                        data:{
                                msg: i18n(`Are you sure you want to delete "${process.name}"?`),
+                               confirmationButtonText: i18n('Delete'),
+                               title: i18n('Delete'),
                                onConfirmed: ()=> SoftwareProductProcessesActionHelper.deleteProcess(dispatch,
                                        {process, softwareProductId, version})
                        }
diff --git a/pom.xml b/pom.xml
index d188dac..b633606 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -34,8 +34,6 @@
 
                <!-- Elastic Search mapper (reference the elastic search version actually). -->
                <elastic-search.version>2.1.0</elastic-search.version>
-               <catalog-artifacts.version>1.0.0-SNAPSHOT</catalog-artifacts.version>
-               <catalog-builders.version>1.0.0-SNAPSHOT</catalog-builders.version>
                <jetty.version>9.2.10.v20150310</jetty.version>
 
                <!-- JSON and YAML Parsing -->
@@ -87,7 +85,7 @@
                <extentreports.version>3.0.3</extentreports.version>
                
                <!-- parser-->
-               <sdc-tosca-parser.version>1.1.14-SNAPSHOT</sdc-tosca-parser.version>
+               <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version>
                
                <!--JaCoCO -->
                <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
                                <artifact-generator-api.version>1710.0.0</artifact-generator-api.version>
                                <artifact-generator-core.version>1710.0.0</artifact-generator-core.version>
                                <dox-common-lib.version>1710.0.0</dox-common-lib.version>
-                               <sdc-tosca-parser.version>1.1.14</sdc-tosca-parser.version>
+                               <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version>
                        </properties>
                </profile>
 
index a19f7cf..1022a03 100644 (file)
@@ -17,7 +17,7 @@
             "private": "eth1"
         },
                "ECompP": {
-                   "ecomp_rest_url": "http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/auxapi",
+                   "ecomp_rest_url": "http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi",
             "ueb_url_list": "10.0.11.1,10.0.11.1", 
             "app_secret": "XftIATw9Jr3VzAcPqt3NnJOu", 
             "app_key": "x9UfO7JsDn8BESVX", 
index 009c86e..9fec52d 100644 (file)
                             <verbose>true</verbose>
                             <apiVersion>1.23</apiVersion>
                             <registry>nexus3.onap.org:10003</registry>
+                            <authConfig>
+                                <pull>
+                                       <username>docker</username>
+                                       <password>docker</password>
+                               </pull>
+                           </authConfig>
 
                             <images>
 
                                 <id>push-images</id>
                                 <phase>deploy</phase>
                                 <goals>
-                                    <goal>build</goal>
                                     <goal>push</goal>
                                 </goals>
                                 <configuration>
index 417db09..963b2fc 100755 (executable)
@@ -17,16 +17,16 @@ function cleanup {
 
 
 function dir_perms {
-       mkdir -p /data/logs/BE/ASDC/ASDC-BE
-       mkdir -p /data/logs/FE/ASDC/ASDC-FE
+       mkdir -p /data/logs/BE/SDC/SDC-BE
+       mkdir -p /data/logs/FE/SDC/SDC-FE
        chmod -R 777 /data/logs
 }
 
 function monitor_docker {
 
 echo monitor $1 Docker
-
-TIME_OUT=180
+sleep 5
+TIME_OUT=600
 INTERVAL=20
 TIME=0
 while [ "$TIME" -lt "$TIME_OUT" ]; do
@@ -201,9 +201,9 @@ echo -e ""
 
 /data/scripts/docker_health.sh
 
-if [ $? -ne 0 ]; then
-    exit 1
-fi
+#if [ $? -ne 0 ]; then
+#    exit 1
+#fi
 
 # sanityDocker
 echo "docker run sdc-frontend..."
index dd38726..e28a85d 100644 (file)
@@ -4,13 +4,15 @@ COPY chef-solo /root/chef-solo/
 
 COPY chef-repo/cookbooks/. /root/chef-solo/cookbooks/
 
-ADD onboarding-be-*.war        ${JETTY_BASE}/webapps/
+ADD onboarding-be-*.war    ${JETTY_BASE}/webapps/
 
-ADD catalog-be-*.war           ${JETTY_BASE}/webapps/
+ADD catalog-be-*.war       ${JETTY_BASE}/webapps/
 
-ADD api-docs.war              ${JETTY_BASE}/webapps/
+ADD api-docs.war           ${JETTY_BASE}/webapps/
 
-RUN chown -R jetty:jetty       ${JETTY_BASE}/webapps
+USER root
+
+RUN chown -R jetty:jetty   ${JETTY_BASE}/webapps
 
 COPY startup.sh /root/
 
index a05a283..220eee7 100644 (file)
     "recipe[sdc-catalog-be::BE_1_cleanup_jettydir]",
     "recipe[sdc-catalog-be::BE_2_setup_configuration]",
     "recipe[sdc-catalog-be::BE_3_locate_keystore]",
-    "recipe[sdc-catalog-be::BE_5_jetty_Modules]",
-    "recipe[sdc-catalog-be::BE_6_setup_elasticsearch]",
-    "recipe[sdc-catalog-be::BE_7_setup_portal_properties]",
-    "recipe[sdc-catalog-be::BE_8_logback]",
-    "recipe[sdc-catalog-be::BE_9_errors_config]"
+    "recipe[sdc-catalog-be::BE_4_jetty_Modules]",
+    "recipe[sdc-catalog-be::BE_5_setup_elasticsearch]",
+    "recipe[sdc-catalog-be::BE_6_setup_portal_properties]",
+    "recipe[sdc-catalog-be::BE_7_logback]",
+    "recipe[sdc-catalog-be::BE_8_errors_config]"
   ],
   "env_run_lists": {
   }
index 87f4ae6..8e5926c 100644 (file)
@@ -37,7 +37,9 @@ else
    chef-solo -c normatives.rb
 fi
 
+echo "###### DOCKER STARTED #####"
+
 while true; do sleep 2; done
 
-echo "###### DOCKER STARTED #####"
+
 
index 7f9207d..5039b08 100644 (file)
@@ -10,6 +10,8 @@ ADD onboarding*.war         ${JETTY_BASE}/webapps/
 
 ADD catalog-fe-*.war        ${JETTY_BASE}/webapps/
 
+USER root
+
 RUN chown -R jetty:jetty    ${JETTY_BASE}/webapps
 
 COPY startup.sh /root/
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vHSS.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vHSS.csar
new file mode 100644 (file)
index 0000000..ea5c128
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vHSS.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vMME.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vMME.csar
new file mode 100644 (file)
index 0000000..f921f46
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vMME.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar
new file mode 100644 (file)
index 0000000..6f997bc
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vPCRF_aligned_fixed.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vSPGW.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vSPGW.csar
new file mode 100644 (file)
index 0000000..8beae6e
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/Huawei_vSPGW.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar
new file mode 100644 (file)
index 0000000..0eacd74
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ZteEpcSpgwVf-csar.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/cscf_si_fixed.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/cscf_si_fixed.csar
new file mode 100644 (file)
index 0000000..bc8397a
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/cscf_si_fixed.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ntas.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ntas.csar
new file mode 100644 (file)
index 0000000..6b6f7c4
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/ntas.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar
new file mode 100644 (file)
index 0000000..bf0e775
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/resource-ZteEpcMmeVf-csar_fix.csar differ
index ea977be..347b8bc 100644 (file)
Binary files a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_aligned.csar and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_aligned.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_v3.0.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_v3.0.csar
new file mode 100644 (file)
index 0000000..1c52cca
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vCSCF_v3.0.csar differ
diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vSBC_aligned.csar b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vSBC_aligned.csar
new file mode 100644 (file)
index 0000000..ee60eed
Binary files /dev/null and b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vSBC_aligned.csar differ
index 690559a..c4323c2 100644 (file)
@@ -6,7 +6,7 @@ cwd "#{tests_base}"
 code <<-EOH
    cd "#{tests_base}"
    jar_file=`ls test-apis*-jar-with-dependencies.jar`
-   nohup ./startTest.sh $jar_file #{ci_test_suite} &
+   ./startTest.sh $jar_file #{ci_test_suite} > #{tests_base}/target/startTest.out 2>&1
    echo "return code from startTest.sh = [$?]"
 EOH
 timeout 72000
index d4316c3..e4edfc6 100644 (file)
@@ -14,7 +14,7 @@ rc=$?
 #   exit 0
 #fi
 
-while true; do sleep 2; done
+#while true; do sleep 2; done
 
 ##/docker-entrypoint.sh
 
index 875888f..d9c080d 100644 (file)
                        <artifactId>json</artifactId>
                        <version>20090211</version>
                </dependency>
-                <!-- <dependency>
-                   <groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
-                   <artifactId>sdc-tosca-parser</artifactId>
-       <version>${sdc-tosca-parser.version}</version>
-                   <scope>compile</scope>
-               </dependency> -->
                <dependency>
                    <groupId>org.openecomp.sdc.sdc-tosca</groupId>
                    <artifactId>sdc-tosca</artifactId>
-                       <version>1.1.32-SNAPSHOT</version>
+                       <version>${sdc-tosca-parser.version}</version>
                    <scope>compile</scope>
                </dependency>
        </dependencies>
index 6b0dc56..01fad09 100644 (file)
@@ -28,6 +28,7 @@ import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
 import com.thinkaurelius.titan.core.TitanVertex;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.ImmutableTriple;
 import org.apache.log4j.Logger;
@@ -48,6 +49,7 @@ import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
 import org.openecomp.sdc.ci.tests.utils.rest.*;
 import org.slf4j.LoggerFactory;
 import org.testng.ITestContext;
@@ -186,6 +188,10 @@ public abstract class ComponentBaseTest {
                
                performClean();
                shutdownTitanLogic();
+               String basePath = FileHandling.getBasePath();
+               String csarDir = FileHandling.getCreateDirByName("outputCsar");
+               FileUtils.cleanDirectory(new File(csarDir));
+
 
        }
 
index 44e386a..4db35a2 100644 (file)
@@ -24,8 +24,10 @@ package org.openecomp.sdc.ci.tests.sanity;
 
 
 
+import org.apache.http.HttpResponse;
 import org.junit.Rule;
 import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
 import org.openecomp.sdc.be.model.ComponentInstance;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.Service;
@@ -39,9 +41,14 @@ import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.CsarToscaTester;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Optional;
 import org.testng.annotations.Parameters;
@@ -52,9 +59,10 @@ import com.clearspring.analytics.util.Pair;
 
 import fj.data.Either;
 
-
-
-
+import java.io.File;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
 
 
 public class Onboard extends ComponentBaseTest {
@@ -68,6 +76,8 @@ public class Onboard extends ComponentBaseTest {
        }
 
        protected String makeDistributionValue;
+       protected ISdcCsarHelper fdntCsarHelper;
+       protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
 
 
 
@@ -115,12 +125,30 @@ public class Onboard extends ComponentBaseTest {
                ExtentTestActions.log(Status.INFO, String.format("Certify Service"));
                service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
 
+
 //             ExtentTestActions.log(Status.INFO, String.format("Distribute Service"));
 //             AtomicOperationUtils.distributeService(service, true);
-               
-               ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
-       }
+               try{
+//                     HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.SERVICES, service.getUUID());
+//                     InputStream inputStream = assetResponse.getEntity().getContent();
+                       File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, service.getUUID());
+
+                       ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object...");
+                       fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath());
+            CsarToscaTester.processCsar(fdntCsarHelper);
 
+                       ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR"));
 
+                       ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
+
+               }catch(Exception e){
+                       ExtentTestActions.log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object...");
+                       ExtentTestActions.log(Status.FAIL, e);
+
+               }
+
+
+
+       }
 
 }
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java
new file mode 100644 (file)
index 0000000..afdfa43
--- /dev/null
@@ -0,0 +1,137 @@
+package org.openecomp.sdc.ci.tests.utils;
+
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class CsarToscaTester {
+       public static void main(String[] args) throws Exception {
+               System.out.println("CsarToscaParser - path to CSAR's Directory is " + Arrays.toString(args));
+               SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
+
+               File folder = new File(args[0]);
+               File[] listOfFiles = folder.listFiles();
+               Date now = new Date();
+               SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss");
+               String time = dateFormat.format(now);
+               String csarsDir = args[1] + "/csar-reports-" + time;
+               File dir = new File(csarsDir);
+               dir.mkdir();
+
+
+               for (File file : listOfFiles) {
+                       if (file.isFile()) {  
+                               System.out.println("File  " + file.getAbsolutePath());
+                               String name = file.getName();
+                               String currentCsarDir = csarsDir+"/"+name+"-"+time;
+                               dir = new File(currentCsarDir);
+                               dir.mkdir();
+                               try {
+                                       processCsar(factory, file);
+                               } catch (SdcToscaParserException e){
+                                       System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage());
+                               }
+                               List<String> notAnalyzedReport = ThreadLocalsHolder.getCollector().getNotAnalyzedExceptionsReport();
+                               System.out.println("NOT ANALYZED during CSAR parsing are: " + (notAnalyzedReport != null ? notAnalyzedReport.toString() : "none"));
+                               List<String> warningsReport = ThreadLocalsHolder.getCollector().getWarningsReport();
+                               //System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none"));
+                               List<String> criticalsReport = ThreadLocalsHolder.getCollector().getCriticalsReport();
+                               System.out.println("CRITICALS during CSAR parsing are: " + (criticalsReport != null ? criticalsReport.toString() : "none"));
+
+                               try {
+                                       generateReport(time, name, currentCsarDir, criticalsReport, "critical");
+                                       generateReport(time, name, currentCsarDir, warningsReport, "warning");
+                                       generateReport(time, name, currentCsarDir, notAnalyzedReport, "notAnalyzed");
+
+                               } catch (IOException ex) {
+                                       ex.printStackTrace();
+                               }
+                       }
+
+               }               
+       }
+
+       public static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException {
+               ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath());
+               processCsarImpl(sdcCsarHelper);
+               
+       }
+
+       public static void processCsar(ISdcCsarHelper sdcCsarHelper) throws SdcToscaParserException {
+               processCsarImpl(sdcCsarHelper);
+
+       }
+
+       private static void processCsarImpl(ISdcCsarHelper sdcCsarHelper) {
+
+               //Service level
+               System.out.println("Invoking sdc-tosca methods on this CSAR....");
+               String conformanceLevel = sdcCsarHelper.getConformanceLevel();
+               System.out.println("getConformanceLevel() - conformance level is "+conformanceLevel);
+               String serviceSubstitutionMappingsTypeName = sdcCsarHelper.getServiceSubstitutionMappingsTypeName();
+               System.out.println("serviceSubstitutionMappingsTypeName() - subst mappings type of service is "+serviceSubstitutionMappingsTypeName);
+               List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
+               System.out.println("getServiceInputs() - service inputs are "+serviceInputs);
+               Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata();
+               System.out.println("getServiceMetadata() - service metadata is "+serviceMetadata);
+               Map<String, Object> serviceMetadataProperties = sdcCsarHelper.getServiceMetadataProperties();
+               System.out.println("getServiceMetadataProperties() - service metadata properties is "+serviceMetadataProperties);
+               List<NodeTemplate> allottedResources = sdcCsarHelper.getAllottedResources();
+               System.out.println("getAllottedResources() - service allotted resources are "+allottedResources);
+               List<NodeTemplate> serviceVfList = sdcCsarHelper.getServiceVfList();
+               System.out.println("getServiceVfList() - VF list is "+serviceVfList);
+               List<NodeTemplate> serviceNodeTemplateBySdcType = sdcCsarHelper.getServiceNodeTemplateBySdcType(SdcTypes.VF);
+               System.out.println("getServiceNodeTemplateBySdcType() - VF list is "+serviceNodeTemplateBySdcType);
+               List<NodeTemplate> serviceNodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
+               System.out.println("getServiceNodeTemplates() - all node templates list of service is "+serviceNodeTemplates);
+
+               serviceVfList.forEach(x -> {
+                       String nodeTemplateCustomizationUuid = sdcCsarHelper.getNodeTemplateCustomizationUuid(x);
+                       System.out.println("getNodeTemplateCustomizationUuid() - VF ID is "+nodeTemplateCustomizationUuid);
+                       String typeOfNodeTemplate = sdcCsarHelper.getTypeOfNodeTemplate(x);
+                       System.out.println("getTypeOfNodeTemplate() - VF tosca type is "+typeOfNodeTemplate);
+                       List<Group> vfModulesByVf = sdcCsarHelper.getVfModulesByVf(nodeTemplateCustomizationUuid);
+                       System.out.println("getVfModulesByVf() - VF modules list is "+vfModulesByVf);
+                       vfModulesByVf.forEach(y -> {
+                               List<NodeTemplate> membersOfVfModule = sdcCsarHelper.getMembersOfVfModule(x, y);
+                               System.out.println("getMembersOfVfModule() - members of VfModule are "+membersOfVfModule);
+                       });
+                       List<NodeTemplate> vfcListByVf = sdcCsarHelper.getVfcListByVf(nodeTemplateCustomizationUuid);
+                       System.out.println("getVfcListByVf() - VFC list is "+vfcListByVf);
+                       vfcListByVf.forEach(z -> {
+                               List<NodeTemplate> nodeTemplateBySdcType = sdcCsarHelper.getNodeTemplateBySdcType(z, SdcTypes.CP);
+                               System.out.println("getNodeTemplateBySdcType() - CP children node templates of this VFC are "+nodeTemplateBySdcType);
+                               Map<String, Map<String, Object>> cpPropertiesFromVfcAsObject = sdcCsarHelper.getCpPropertiesFromVfcAsObject(z);
+                               System.out.println("getCpPropertiesFromVfcAsObject() - consolidated CP properties for this VFC are "+cpPropertiesFromVfcAsObject);
+                               boolean hasTopology = sdcCsarHelper.hasTopology(z);
+                               System.out.println("hasTopology() - this VFC is "+(hasTopology ? "nested" : "not nested"));
+                       });
+               });
+       }
+
+       private static void generateReport(String time, String name, String currentCsarDir, List<String> criticalsReport, String type)
+                       throws IOException {
+               FileWriter fw;
+               fw = new FileWriter(new File(currentCsarDir + "/" + criticalsReport.size() + "-"+type+"-" + name +"-"+time + ".txt"));
+               for (String exception : criticalsReport) {
+                       fw.write(exception);
+                       fw.write("\r\n");
+               }
+               fw.close();
+       }
+}
index c8f9ee4..2c5d985 100644 (file)
@@ -390,6 +390,15 @@ public class FileHandling {
 //
 //             }
 //     }
+
+       public static String getCreateDirByName(String dirName) {
+               File dir = new File(dirName);
+               dir.mkdir();
+               if(!dir.exists()) {
+               }
+
+               return dir.getPath();
+       }
        
        public static boolean isFileDownloaded(String downloadPath, String fileName) {
                boolean flag = false;
index 13a5641..7bcf338 100644 (file)
@@ -26,10 +26,7 @@ import static org.testng.AssertJUnit.assertTrue;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
 
 import org.apache.http.HttpEntity;
@@ -62,6 +59,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
 import org.openecomp.sdc.ci.tests.utils.Utils;
 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -105,7 +103,9 @@ public class AssetRestUtils extends BaseRestUtils {
                String url = String.format(Urls.GET_TOSCA_MODEL, config.getCatalogBeHost(), config.getCatalogBePort(),
                                assetType.getValue(), uuid);
                HttpGet httpGet = new HttpGet(url);
-               File myFile = new File("tmpCSAR");
+
+               String csarDir = FileHandling.getCreateDirByName("outputCsar");
+               File myFile = new File(csarDir+ File.separator + "tmpCSAR" + getShortUUID()+".csar");
 
                
                httpGet.addHeader(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
@@ -123,7 +123,9 @@ public class AssetRestUtils extends BaseRestUtils {
            }
                return myFile;
        }
-       
+
+
+
        public static RestResponse getRestResponseComponentToscaModel(AssetTypeEnum assetType, String uuid) throws IOException {
                Config config = Utils.getConfig();
                
@@ -622,5 +624,8 @@ public class AssetRestUtils extends BaseRestUtils {
                }
                return null;
        }
+       private static String getShortUUID() {
+               return UUID.randomUUID().toString().split("-")[0];
+       }
        
 }
index c075f10..1d5bc4b 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="2" data-provider-thread-count="2">
+<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="1" data-provider-thread-count="1">
        <test name="ExternalApis"> 
                <classes>       
                        
index f0ead6d..1d6afa9 100644 (file)
                                                        </descriptorRefs>
                                                </configuration>
                                        </execution>
-                                       
-                                       <!---->
-                                       <!--<execution>-->
-                                               <!--<id>tarball</id>-->
-                                               <!--<phase>package</phase>-->
-                                               <!--<goals>-->
-                                                       <!--<goal>single</goal>-->
-                                               <!--</goals>-->
-                                               <!--<configuration>-->
-                                                       <!--<finalName>${project.artifactId}-${full.release.version}${build.type}</finalName>-->
-                                                       <!--<appendAssemblyId>false</appendAssemblyId>-->
-                                                       <!--<descriptor>${project.basedir}/tarball.xml</descriptor>-->
-                                                       <!--<attach>false</attach>-->
-                                               <!--</configuration>-->
-                                       <!--</execution>-->
                                </executions>
                        </plugin>
 
index d418d46..e1a415f 100644 (file)
@@ -8,10 +8,12 @@ RUN cp ${JETTY_HOME}/resources/log4j.properties ${JETTY_BASE}/resources/log4j.pr
 
 ADD WSSimulator*.war                           ${JETTY_BASE}/webapps/
 
+USER root
+
 RUN chown -R jetty:jetty                               ${JETTY_BASE}/webapps
 
 COPY startup.sh /root/
 
-RUN chmod 770 /root/startup.sh
+RUN chmod 777 /root/startup.sh
 
 ENTRYPOINT [ "/root/startup.sh" ]