aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-tests
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
committerMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
commited64b5edff15e702493df21aa3230b81593e6133 (patch)
treea4cb01fdaccc34930a8db403a3097c0d1e40914b /asdc-tests
parent280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff)
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'asdc-tests')
-rw-r--r--asdc-tests/pom.xml248
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java (renamed from asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/SdcTest.java)24
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java223
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java22
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java29
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java3
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceAssetStructure.java18
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java18
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java105
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java16
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java80
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ArtifactTypeEnum.java7
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AssocType.java7
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AuditEnum.java16
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/DistributionNotificationStatusEnum.java52
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/MandatoryResourceArtifactTypeEnum.java6
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/NormativeTypesEnum.java18
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/OriginTypeEnum.java74
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java5
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/RespJsonKeysEnum.java28
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/SearchCriteriaEnum.java38
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceApiArtifactEnum.java7
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java5
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java31
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java27
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java8
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java165
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java362
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java331
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java12
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java9
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsFromUI.java444
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java29
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java14
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java4044
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java173
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java5
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/OpsRejectDistribution.java68
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/SearchFilterCategoryExternalAPI.java344
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/VFCMTExternalAPI.java390
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ValidateConformanceLevel.java78
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java102
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java70
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java131
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/LifeCycleExternalAPI.java270
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/UserAPIs.java473
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java115
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java66
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java350
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java544
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java345
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java27
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java296
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java1512
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java184
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/ServiceCertWithoutDeploymentArtifacts.java65
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java17
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java778
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java46
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java3
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java6
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java782
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java12
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java24
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CustomizationUUIDTest.java433
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java10
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java22
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java104
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java93
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java875
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java346
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java186
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java246
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java43
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/CommonMigrationUtils.java19
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/postupgrade/AttKeyPropertiesRenameTest.java71
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/preupgrade/AttKeyPropertiesBeforeRenameTest.java49
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/rules/MyTestWatcher.java10
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/ExtentReporterNG.java94
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java60
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java26
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java159
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java17
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java5
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/users/UserResponseMessageEnum.java19
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/ArtifactUtils.java25
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java45
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java166
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java435
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java49
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java30
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java97
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java43
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java147
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java9
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java9
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/graph/GraphFileUtils.java39
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java769
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java65
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java9
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java34
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java38
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java8
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java87
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java39
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java127
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java84
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java31
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java122
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java218
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java64
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java123
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java49
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java23
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java7
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java86
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java1
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java3
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java58
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java86
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java15
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java10
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java6
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/TestYamlParser.java94
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java10
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java33
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java24
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/post/Install.java5
-rw-r--r--asdc-tests/src/main/resources/ci/conf/attsdc-packages.yaml (renamed from asdc-tests/src/main/resources/ci/conf/sdc-packages.yaml)0
-rw-r--r--asdc-tests/src/main/resources/ci/conf/attsdc.yaml (renamed from asdc-tests/src/main/resources/ci/conf/sdc.yaml)11
-rw-r--r--asdc-tests/src/main/resources/ci/conf/titan.properties2
-rw-r--r--asdc-tests/src/main/resources/ci/scripts/startTest.sh2
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/CRUDArtifacts.xml40
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/SearchExternalAPI.xml23
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/ciFull.xml2
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/externalApis.xml3
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/resource.xml24
-rw-r--r--asdc-tests/src/main/resources/ci/testSuites/sanity.xml14
-rw-r--r--asdc-tests/src/test/resources/CI/configuration.yaml34
-rw-r--r--asdc-tests/src/test/resources/CI/csars/FCGI_with_inputs.csarbin35433 -> 35433 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC.csarbin0 -> 57082 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC_empty.csarbin0 -> 30674 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/LDSA1_with_inputs.csarbin28243 -> 28284 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/ToscaTemplateCsar.csarbin0 -> 6175 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csarbin36440 -> 36439 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_a.csarbin36440 -> 36439 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csarbin36444 -> 36443 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_a.csarbin35874 -> 35872 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_add_update.csarbin35854 -> 35852 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_delete_update.csarbin35852 -> 35851 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/jsonPropertyTypeTest.csarbin24762 -> 24750 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2G.csarbin38900 -> 38917 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2GV001.csarbin38994 -> 39002 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2GV001_a.csarbin38994 -> 39002 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2GV006-remove-all-nested-artifacts.csarbin38993 -> 39000 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2GV008-change-nested-oam-fileContent.csarbin39005 -> 39013 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2G_a.csarbin38900 -> 38917 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/orig2G_updated.csarbin38775 -> 38791 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vf_relate_by_cap_name.csarbin25963 -> 25918 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csarbin1548 -> 1548 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csarbin1546 -> 1546 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vfc_artifacts.csarbin0 -> 48225 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vfc_artifacts_delete_all.csarbin0 -> 26179 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vfc_artifacts_update.csarbin0 -> 48245 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csarbin35606 -> 35467 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/LAN_Connector/LAN_Connector.zipbin530 -> 493 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF/VNF.zipbin449 -> 411 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF_Container/VNF_Container.zipbin394 -> 357 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/WAN_Connector/WAN_Connector.zipbin505 -> 467 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/capabilityTypesWanLan.zipbin269 -> 231 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/connector/connector.zipbin423 -> 384 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/root/root.zipbin242 -> 205 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/demoResourcesWanLan/router/router.zipbin455 -> 418 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/error-configuration.yaml20
-rw-r--r--asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF .yml.old29
-rw-r--r--asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.Cinder/asdc.nodes.network.Cinder.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.OAM/asdc.nodes.network.OAM.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/VCE_Brocade_Tosca.yaml40
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/capabilityTypes.zipbin1158 -> 1065 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector.zipbin805 -> 805 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector.zipbin795 -> 795 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector.zipbin796 -> 796 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP/org.openecomp.resource.nfv.CP.zipbin339 -> 339 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.zipbin395 -> 395 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU.zipbin1751 -> 1751 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU/org.openecomp.resource.nfv.VDU.zipbin344 -> 344 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.zipbin480 -> 442 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.zipbin475 -> 440 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU.zipbin489 -> 453 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.zipbin550 -> 515 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU.zipbin538 -> 502 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VL/org.openecomp.resource.nfv.VL.zipbin310 -> 310 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.zipbin592 -> 592 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.json2
-rw-r--r--asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.zipbin309 -> 309 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/Derived_VFC.json26
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.yml5
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.zipbin0 -> 322 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/empty_contact/normative-types-new-empty_contact.zipbin445 -> 409 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/empty_resource_name/normative-types-new-empty_resource_name.zipbin456 -> 420 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/empty_tag/normative-types-new-empty_tag.zipbin436 -> 400 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4test/normative-types-new-importResource4test.zipbin630 -> 596 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testCP/normative-types-new-importResource4testCP.zipbin637 -> 603 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testMissingNameSpace/normative-types-new-importResource4testMissingNameSpace.zipbin662 -> 628 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUnknown/normative-types-new-importResource4testUnknown.zipbin651 -> 616 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateVendorNameAndCategory/normative-types-new-importResource4testUpdateVendorNameAndCategory.zipbin447 -> 411 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateWithoutReqCap/normative-types-new-importResource4testUpdateWithoutReqCap.zipbin460 -> 422 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVF/normative-types-new-importResource4testVF.zipbin637 -> 603 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVFC/normative-types-new-importResource4testVFC.zipbin641 -> 607 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVL/normative-types-new-importResource4testVL.zipbin637 -> 603 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_category/normative-types-new-missing_category.zipbin450 -> 414 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_contact/normative-types-new-missing_contact.zipbin449 -> 413 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_desc/normative-types-new-missing_desc.zipbin442 -> 406 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_icon/normative-types-new-missing_icon.zipbin442 -> 406 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_payloadName/normative-types-new-missing_payloadName.zipbin456 -> 420 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_resource_name/normative-types-new-missing_resource_name.zipbin460 -> 424 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/missing_tags/normative-types-new-missing_tags.zipbin442 -> 406 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/userCompute/normative-types-new-userCompute.zipbin610 -> 610 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/userUpdateCompute/normative-types-new-userUpdateCompute.zipbin580 -> 580 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueInit/normative-types-new-validateProporties_typeBoolean_valueInit.zipbin578 -> 542 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueString/normative-types-new-validateProporties_typeBoolean_valueString.zipbin579 -> 542 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueBoolean/normative-types-new-validateProporties_typeFloat_valueBoolean.zipbin575 -> 539 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueString/normative-types-new-validateProporties_typeFloat_valueString.zipbin574 -> 538 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueBoolean/normative-types-new-validateProporties_typeInit_valueBoolean.zipbin574 -> 538 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueFloat/normative-types-new-validateProporties_typeInit_valueFloat.zipbin572 -> 536 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueString/normative-types-new-validateProporties_typeInit_valueString.zipbin572 -> 536 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeList_valueUrlCredential/normative-types-new-validateProporties_typeList_valueUrlCredential.zipbin717 -> 685 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeMap_valueUrlCredential/normative-types-new-validateProporties_typeMap_valueUrlCredential.zipbin628 -> 593 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeMap.zipbin638 -> 0 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeTestDataType.zipbin0 -> 608 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack1/myHeatStack1.zipbin401 -> 400 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack2/myHeatStack2.zipbin386 -> 423 bytes
-rw-r--r--asdc-tests/src/test/resources/CI/tests/importToscaResourceByCreateUrl/CPWithAttributes.yml9
-rw-r--r--asdc-tests/tarball.xml71
267 files changed, 14534 insertions, 6006 deletions
diff --git a/asdc-tests/pom.xml b/asdc-tests/pom.xml
index 50b7f65d92..0c0e9a2598 100644
--- a/asdc-tests/pom.xml
+++ b/asdc-tests/pom.xml
@@ -4,23 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>asdc-tests</artifactId>
-
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>sdc-main</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
-
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${lang3.version}</version>
- <scope>compile</scope>
- </dependency>
+ <dependencies>
<dependency>
<groupId>com.google.guava</groupId>
@@ -28,89 +19,90 @@
<version>${guava.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
+ <version>${junit.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>6.9.10</version>
+ <version>${testng.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.0</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>com.jcraft.jsch</groupId>
<artifactId>com.springsource.com.jcraft.jsch</artifactId>
<version>0.1.41</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>common-app-api</artifactId>
- <version>${common-app-api.version}</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>common-be</artifactId>
- <version>${common-be.version}</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
-
+
<!-- CHECK CATLOG MODEL -->
<dependency>
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>catalog-model</artifactId>
- <version>${catalog-model.version}</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
-
+
<!-- catalog dao -->
<dependency>
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>catalog-dao</artifactId>
- <version>${catalog-dao.version}</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
-
+ <!-- functional java -->
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava</artifactId>
+ <version>${functionaljava.version}</version>
<scope>compile</scope>
</dependency>
<!-- CASSANDRA -->
@@ -121,107 +113,104 @@
<scope>compile</scope>
</dependency>
<!-- CASSANDRA END -->
-
-
+
<!-- slf4j + logback -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
+ <version>${slf4j-api.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
+ <version>${logback.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>${logback.version}</version>
+ <version>${logback.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
+ <version>${json-simple.version}</version>
<scope>compile</scope>
</dependency>
<!-- File changes listener -->
-
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jci-core</artifactId>
+ <version>${commons-jci-core.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>2.0-SNAPSHOT</version>
+ <version>${commons-codec}</version>
<scope>compile</scope>
</dependency>
-
- <!-- Gson -->
+ <!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
- <version>2.3.1</version>
+ <version>${gson.version}</version>
<scope>compile</scope>
</dependency>
-
+
<!-- Snake Yaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.14</version>
+ <version>${snakeyaml.version}</version>
<scope>compile</scope>
</dependency>
-
-
<!-- http client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
+ <version>${httpclient.version}</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
- <version>${httpclient.version}</version>
+ <version>${httpclient.version}</version>
<scope>compile</scope>
- </dependency>
-
+ </dependency>
+
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.2.1-SNAPSHOT</version>
+ <version>${commons-logging}</version>
<scope>compile</scope>
</dependency>
-
+
<!-- http core -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
- <version>${httpcore.version}</version>
+ <version>${httpcore.version}</version>
<scope>compile</scope>
</dependency>
-
+
<!-- TITAN -->
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
@@ -235,7 +224,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-cassandra</artifactId>
@@ -248,7 +237,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
@@ -259,50 +248,75 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <!--<version>2.3.1</version>-->
<version>${jackson.version}</version>
+ <!--<version>2.3.1</version>-->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <!--<version>2.3.1</version>-->
<version>${jackson.version}</version>
+ <!--<version>2.3.1</version>-->
<scope>compile</scope>
</dependency>
-
+
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-distribution-client</artifactId>
- <version>1.0.0</version>
+ <version>1.1.9-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>ecompFW</artifactId>
- <version>1.0.0</version>
+ <version>${ecomp.version}</version>
<scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
+ <exclusions>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
</dependencies>
-
-
+
<build>
<plugins>
-
+
+ <!-- ============================================= -->
+ <!-- Get the next build number -->
+ <!-- ============================================= -->
+ <!--<plugin>-->
+ <!--<groupId>org.codehaus.mojo</groupId>-->
+ <!--<artifactId>properties-maven-plugin</artifactId>-->
+ <!--<version>1.0-alpha-1</version>-->
+ <!--<inherited>false</inherited>-->
+
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<id>tests</id>-->
+ <!--<phase>initialize</phase>-->
+ <!--<goals>-->
+ <!--<goal>read-project-properties</goal>-->
+ <!--</goals>-->
+
+ <!--<configuration>-->
+ <!--<files>-->
+ <!--<file>../target/FullReleaseVersion.properties</file>-->
+ <!--</files>-->
+ <!--</configuration>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--</plugin>-->
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
@@ -312,16 +326,16 @@
</configuration>
</plugin>
- <!-- ============================================= -->
- <!-- Create the JAR file with its dependencies -->
- <!-- ============================================= -->
+ <!-- ============================================= -->
+ <!-- Create the JAR file with its dependencies -->
+ <!-- ============================================= -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.5.5</version>
+ <version>2.5.5</version>
<executions>
<execution>
- <id>create.jar.with.dependencies</id>
+ <id>create.jar.with.dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
@@ -339,53 +353,33 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <configuration>
- <finalName>${project.artifactId}</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptor>${project.basedir}/tarball.xml</descriptor>
- </configuration>
- <id>assemble-file</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>3.0.2</version>
+ </plugins>
+ </build>
- <executions>
- <execution>
- <id>copy-asdc-tests</id>
- <phase>install</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
+ <profiles>
+ <profile>
+ <id>Fortify</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+
+ <build>
+ <plugins>
+ <!-- =========================== -->
+ <!-- HP Fortifay scanner -->
+ <!-- =========================== -->
+ <plugin>
+ <groupId>com.fortify.ps.maven.plugin</groupId>
+ <artifactId>sca-maven-plugin</artifactId>
+ <version>4.30</version>
<configuration>
- <outputDirectory>${project.parent.basedir}/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default</outputDirectory>
- <resources>
- <resource>
- <directory>./target</directory>
- <includes>
- <include>asdc-tests.tar</include>
- </includes>
- </resource>
- </resources>
+ <scanEnabled>false</scanEnabled>
+ <skip>true</skip>
</configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/SdcTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java
index ebad749097..6c0b96e15c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/SdcTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/AttSdcTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.ci.tests.api;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -36,17 +38,18 @@ import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.rules.TestWatcher;
import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.execute.artifacts.CrudArt;
import org.openecomp.sdc.ci.tests.rules.MyTestWatcher;
import org.openecomp.sdc.ci.tests.run.StartTest;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-public abstract class SdcTest {
+public abstract class AttSdcTest {
public static StringBuilder doc = new StringBuilder();
public static String file = null;
@@ -55,17 +58,17 @@ public abstract class SdcTest {
protected Gson prettyGson = new GsonBuilder().setPrettyPrinting().create();
protected TestName testName = null;
- protected Logger logger = null;
protected static boolean displayException = false;
-
- public SdcTest(TestName testName, String className) {
+ static Logger logger = LoggerFactory.getLogger(CrudArt.class.getName());
+
+
+ public AttSdcTest(TestName testName, String className) {
super();
StartTest.enableLogger();
this.testName = testName;
- this.logger = LoggerFactory.getLogger(className);
String displayEx = System.getProperty("displayException");
if (displayEx != null && Boolean.valueOf(displayEx).booleanValue()) {
@@ -108,6 +111,7 @@ public abstract class SdcTest {
@AfterClass
public static void afterClass() {
doc.append("<table>");
+ // writeToFile("./" + ConfigAttOdlIt.REPORT_FILE , doc.toString());
FileUtils.writeToFile(
Config.instance().getOutputFolder() + File.separator + file + StartTest.timeOfTest + ".html",
doc.toString());
@@ -120,13 +124,13 @@ public abstract class SdcTest {
config = Utils.getConfig();
assertTrue(config != null);
- // logger.info("Start running test " + testName.getMethodName());
+ logger.info("Start running test {}", testName.getMethodName());
}
@After
public void afterTest() throws FileNotFoundException {
- // logger.info("Finish running test " + testName.getMethodName());
+ logger.info("Finish running test {}", testName.getMethodName());
}
public void addTestSummary(String testName, boolean isSuccess) {
@@ -161,9 +165,9 @@ public abstract class SdcTest {
doc.append("</tr>");
if (isSuccess) {
- logger.debug("Test {} succeeded.", testName);
+ logger.debug("Test {} {}", testName, (isSuccess ? " SUCCEEDED " : " FAILED with error " + message));
} else {
- logger.error("Test {} failed with error: {}", testName, message);
+ logger.error("Test {} {}", testName, (isSuccess ? " SUCCEEDED " : " FAILED with error " + message));
}
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
index 370c195f53..0f85cc792d 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
@@ -27,10 +27,14 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
-import com.thinkaurelius.titan.core.TitanGraphQuery;
+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;
@@ -39,17 +43,27 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Product;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
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.Utils;
import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,6 +76,7 @@ import org.testng.annotations.BeforeSuite;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
+import com.relevantcodes.extentreports.NetworkMode;
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanVertex;
@@ -99,7 +114,7 @@ public abstract class ComponentBaseTest {
}
@BeforeSuite(alwaysRun = true)
- public static void openTitan() throws FileNotFoundException {
+ public static void openTitan() throws Exception {
File dir = new File(REPORT_FOLDER);
try {
@@ -107,19 +122,36 @@ public abstract class ComponentBaseTest {
} catch (IOException e) {
}
extentReport = new ExtentReports(REPORT_FOLDER + REPORT_FILE_NAME);
+ // extentReport = new ExtentReports(REPORT_FOLDER +
+ // REPORT_FILE_NAME,true , NetworkMode.ONLINE);
+ // extentReport.x();
+ openTitanLogic();
+ }
+
+ protected static void openTitanLogic() throws Exception {
+ initGraph();
+ cleanComponents();
+ // DbUtils.deleteFromEsDbByPattern("_all");
+ CassandraUtils.truncateAllKeyspaces();
+ }
+
+ protected static void initGraph() throws FileNotFoundException {
myconfig = Utils.getConfig();
config = Utils.getConfig();
logger.trace(config.toString());
String titanConfigFilePath = myconfig.getTitanPropertiesFile();
- System.out.println("titan configuration path:\n"+titanConfigFilePath);
titanGraph = TitanFactory.open(titanConfigFilePath);
- System.out.println("is open:\n"+titanGraph.isOpen());
assertNotNull(titanGraph);
}
@AfterSuite(alwaysRun = true)
- public static void shutdownTitan() {
+ public static void shutdownTitan() throws Exception {
+ shutdownTitanLogic();
+ extentReport.flush();
+ }
+
+ protected static void shutdownTitanLogic() {
if (titanGraph.isOpen()) {
titanGraph.close();
}
@@ -129,8 +161,9 @@ public abstract class ComponentBaseTest {
@BeforeMethod(alwaysRun = true)
public void beforeState(java.lang.reflect.Method method) throws Exception {
- cleanComponents();
- CassandraUtils.truncateAllKeyspaces();
+ // deleteCreatedComponents(getCatalogAsMap());
+
+ performeClean();
extendTest = extentReport.startTest(method.getName());
extendTest.log(LogStatus.INFO, "Test started");
@@ -138,8 +171,7 @@ public abstract class ComponentBaseTest {
@AfterMethod(alwaysRun = true)
public void afterState(ITestResult result) throws Exception {
- cleanComponents();
- CassandraUtils.truncateAllKeyspaces();
+ performeClean();
if (result.isSuccess()) {
extendTest.log(LogStatus.PASS, "Test Result : <span class='label success'>Success</span>");
@@ -150,17 +182,21 @@ public abstract class ComponentBaseTest {
}
extentReport.endTest(extendTest);
- extentReport.flush();
}
+ protected void performeClean() throws Exception, FileNotFoundException {
+ cleanComponents();
+ CassandraUtils.truncateAllKeyspaces();
+ }
+
public void verifyErrorCode(RestResponse response, String action, int expectedCode) {
assertNotNull("check response object is not null after " + action, response);
assertNotNull("check error code exists in response after " + action, response.getErrorCode());
assertEquals("Check response code after + action" + action, expectedCode, response.getErrorCode().intValue());
}
- private void cleanComponents() throws Exception {
+ private static void cleanComponents() throws Exception {
// Components to delete
List<String> vfResourcesToDelete = new ArrayList<String>();
@@ -179,10 +215,8 @@ public abstract class ComponentBaseTest {
List<String> resourcesNotToDelete = config.getResourcesNotToDelete();
List<String> resourceCategoriesNotToDelete = config.getResourceCategoriesNotToDelete();
List<String> serviceCategoriesNotToDelete = config.getServiceCategoriesNotToDelete();
- TitanGraphQuery<? extends TitanGraphQuery> query = titanGraph.query();
- query = query.has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName());
- Iterable<TitanVertex> vertices=query.vertices();
-// Iterable<TitanVertex> vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName()).vertices();
+
+ Iterable<TitanVertex> vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName()).vertices();
if (vertices != null) {
Iterator<TitanVertex> iter = vertices.iterator();
while (iter.hasNext()) {
@@ -195,13 +229,13 @@ public abstract class ComponentBaseTest {
if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && !version.equals("1.0"))) {
String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
String resourceType = vertex.value(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty());
- // if (name.startsWith("ci")) {
- if (resourceType.equals(ResourceTypeEnum.VF.name())) {
- vfResourcesToDelete.add(id);
- } else {
- nonVfResourcesToDelete.add(id);
+ if (name.startsWith("ci")) {
+ if (resourceType.equals(ResourceTypeEnum.VF.name())) {
+ vfResourcesToDelete.add(id);
+ } else {
+ nonVfResourcesToDelete.add(id);
+ }
}
- // }
} else if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && version.equals("1.0"))) {
if ((boolean) vertex.value(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) == false) {
vertex.property(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
@@ -217,9 +251,9 @@ public abstract class ComponentBaseTest {
Vertex vertex = iter.next();
String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
- // if (name.startsWith("ci")){
- servicesToDelete.add(id);
- // }
+ if (name.startsWith("ci")) {
+ servicesToDelete.add(id);
+ }
}
}
@@ -230,9 +264,9 @@ public abstract class ComponentBaseTest {
Vertex vertex = iter.next();
String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
- //if (name.startsWith("ci")) {
+ if (name.startsWith("Ci")) {
productsToDelete.add(id);
- //}
+ }
}
}
@@ -345,4 +379,141 @@ public abstract class ComponentBaseTest {
}
+ private void deleteCreatedComponents(Map<String, List<Component>> convertCatalogResponseToJavaObject) throws IOException {
+ final String userId = UserRoleEnum.DESIGNER.getUserId();
+ List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
+
+ // List<String> collect = resourcesArrayList.stream().filter(s ->
+ // s.getName().startsWith("ci")).map(e ->
+ // e.getUniqueId()).collect(Collectors.toList());
+
+ // List<Map<String, String>> collect =
+ // resourcesArrayList.stream().filter(s ->
+ // s.getName().startsWith("ci")).map(e ->
+ // e.getAllVersions()).collect(Collectors.toList());
+ /*
+ * List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) .flatMap(e -> e.getAllVersions().values().stream()).collect(Collectors.toList());
+ */
+
+ if (!CollectionUtils.isEmpty(resourcesArrayList)) {
+ List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+ for (String uId : collect) {
+ ResourceRestUtils.deleteResource(uId, userId);
+ }
+ }
+
+ resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
+ if (resourcesArrayList.size() > 0) {
+ List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+ for (String uId : collect) {
+ ServiceRestUtils.deleteServiceById(uId, userId);
+ }
+ }
+ resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.PRODUCT_PARAM_NAME);
+ if (resourcesArrayList.size() > 0) {
+ List<String> collect = buildCollectionUniqueId(resourcesArrayList);
+ for (String uId : collect) {
+ ProductRestUtils.deleteProduct(uId, userId);
+ }
+ }
+
+ }
+
+ private void deleteCollection(List<Component> componentArrayList, Consumer<String> deleteHandler) {
+
+ if (componentArrayList.size() > 0) {
+ List<String> collect = buildCollectionUniqueId(componentArrayList);
+ for (String uId : collect) {
+ deleteHandler.accept(uId);
+ // ProductRestUtils.deleteProduct(uId, userId);
+ }
+ }
+ }
+
+ private List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
+
+ // Stream<String> flatMap = resourcesArrayList.stream().filter(s ->
+ // s.getName().startsWith("ci")).map(e -> e.getAllVersions()).map( e ->
+ // e.values()).flatMap( e -> e.stream());
+
+ // List<String> collect = resourcesArrayList.stream()
+ // //
+ // .filter(s -> s.getName().startsWith("ci") )
+ // //
+ // .map(e -> e.getUniqueId())
+
+ // .map( e -> e.values())
+ // .filter(out -> out!=null )
+ // .flatMap( e -> e.stream())
+ // .collect(Collectors.toList());
+
+ // List<String> collect = resourcesArrayList.stream().filter(s ->
+ // s.getName().startsWith("ci"))
+ // .flatMap(e ->
+ // e.getAllVersions().values().stream()).collect(Collectors.toList());
+ ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
+
+ List<String> genericCollection = new ArrayList<String>();
+ resourcesArrayList.stream().filter(s -> s.getName().toLowerCase().startsWith("ci")).map(e -> e.getUniqueId()).collect(Collectors.toList()).forEach((i) -> {
+ try {
+ switch (componentTypeEnum) {
+ case RESOURCE:
+ RestResponse resource = ResourceRestUtils.getResource(i);
+ Resource convertResourceResponseToJavaObject = ResponseParser.convertResourceResponseToJavaObject(resource.getResponse());
+ Map<String, String> allVersions = convertResourceResponseToJavaObject.getAllVersions();
+ Collection<String> values = allVersions.values();
+ genericCollection.addAll(values);
+
+ break;
+ case SERVICE:
+ RestResponse service = ServiceRestUtils.getService(i);
+ Service convertServiceResponseToJavaObject = ResponseParser.convertServiceResponseToJavaObject(service.getResponse());
+ allVersions = convertServiceResponseToJavaObject.getAllVersions();
+ values = allVersions.values();
+ genericCollection.addAll(values);
+
+ break;
+
+
+ case PRODUCT:
+ RestResponse product = ProductRestUtils.getProduct(i);
+ Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());
+ allVersions = convertProductResponseToJavaObject.getAllVersions();
+ values = allVersions.values();
+ genericCollection.addAll(values);
+
+ break;
+
+ // default:
+ // break;
+ }
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ });
+ //
+
+ // List<String> collect =
+ // genericCollection.stream().collect(Collectors.toList());
+
+ return genericCollection;
+ }
+
+ private Map<String, List<Component>> getCatalogAsMap() throws Exception {
+ RestResponse catalog = CatalogRestUtils.getCatalog(UserRoleEnum.DESIGNER.getUserId());
+ Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser.convertCatalogResponseToJavaObject(catalog.getResponse());
+ return convertCatalogResponseToJavaObject;
+ }
+ protected Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
+ // create new resource from Csar
+ ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
+
+ resourceDetails.setCsarUUID(csarId);
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
+ return createdResource;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
index 2b0a35d472..9428a9b695 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java
@@ -326,6 +326,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest {
if (resourceRequirements == null) {
resourceRequirements = new HashMap<>();
}
+
Function<Entry<String, List<RequirementDefinition>>, List<RequirementDefinition>> requirementDefinitionMapper = e -> new ArrayList<>(e.getValue().stream().map(item -> new RequirementDefinition(item)).collect(Collectors.toList()));
Map<String, List<RequirementDefinition>> reqCopy = resourceRequirements.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), requirementDefinitionMapper));
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index 5aceb4fae3..a8342f8879 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -184,8 +184,15 @@ public interface Urls {
// ***********************************External API's
// (AssetData)****************************************
+
+ final String DELETE_EXTRNAL_API_DELETE_ARTIFACT_OF_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/artifacts/%s";
+ final String DELETE_EXTRNAL_API_DELETE_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/resourceInstances/%s/artifacts/%s";
+ final String POST_EXTERNAL_API_UPDATE_ARTIFACT_OF_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/artifacts/%s";
+ final String POST_EXTERNAL_API_UPDATE_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/resourceInstances/%s/artifacts/%s";
+
final String POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/artifacts";
+ final String POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET = "http://%s:%s/asdc/v1/catalog/%s/%s/resourceInstances/%s/artifacts";
final String GET_DOWNLOAD_RESOURCE_ARTIFACT_OF_ASSET = "http://%s:%s/asdc/v1/catalog/resources/%s/artifacts/%s";
final String GET_DOWNLOAD_SERVICE_ARTIFACT_OF_ASSET = "http://%s:%s/asdc/v1/catalog/services/%s/artifacts/%s";
@@ -202,6 +209,11 @@ public interface Urls {
final String POST_AUTHORIZATION = "http://%s:%s/sdc2/rest/v1/consumers";
final String GET_DOWNLOAD_SERVICE_RI_ARTIFACT = "http://%s:%s/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s";
final String GET_DOWNLOAD_SERVICE_ARTIFACT = "http://%s:%s/asdc/v1/catalog/services/%s/artifacts/%s";
+
+ final String POST_EXTERNAL_API_CREATE_RESOURCE = "http://%s:%s/asdc/v1/catalog/resources";
+
+ final String CHANGE_RESOURCE_LIFECYCLE_STATE_EXTERNAL_API = "http://%s:%s/asdc/v1/catalog/resources/%s/lifecycleState/%s";
+ final String CHANGE_SERVICE_LIFECYCLE_STATE_EXTERNAL_API = "http://%s:%s/asdc/v1/catalog/services/%s/lifecycleState/%s";
// *****************************************************************************************************
@@ -243,6 +255,7 @@ public interface Urls {
// *****************************************************************************************************
final String VALIDATE_RESOURCE_NAME = "http://%s:%s/sdc2/rest/v1/catalog/resources/validate-name/%s";
+ final String VALIDATE_CONFORMANCE_LEVEL = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/conformanceLevelValidation";
final String CREATE_SERVICE = "http://%s:%s/sdc2/rest/v1/catalog/services";
final String DELETE_SERVICE = "http://%s:%s/sdc2/rest/v1/catalog/services/%s";
@@ -255,14 +268,16 @@ public interface Urls {
final String DELETE_COMPONENT_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/%s";
final String UPDATE_COMPONENT_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/%s";
final String GET_COMPONENT_INSTANCES = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/componentInstances";
+ //{containerComponentType}/{containerComponentId}/componentInstances/{componentInstanceUniqueId}/properties
+ final String GET_COMPONENT_INSTANCE_PROPERTIES_BY_ID = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/componentInstances/%s/properties";
// Tal New API
final String UPDATE_MULTIPLE_COMPONENT_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/multipleComponentInstance";
- final String CHANGE__RESOURCE_INSTANCE_VERSION = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/%s/changeVersion";
+ final String CHANGE_RESOURCE_INSTANCE_VERSION = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/%s/changeVersion";
final String CREATE_AND_ASSOCIATE_RESOURCE_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/resourceInstance/createAndAssociate";
- final String ASSOCIATE__RESOURCE_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/associate";
- final String DISSOCIATE__RESOURCE_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/dissociate";
+ final String ASSOCIATE_RESOURCE_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/associate";
+ final String DISSOCIATE_RESOURCE_INSTANCE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/resourceInstance/dissociate";
final String DISTRIBUTION_INIT = "http://%s:%s/init";
final String DISTRIBUTION_INIT_RESET = "http://%s:%s/initReset";
@@ -270,6 +285,7 @@ public interface Urls {
final String REJECT_DISTRIBUTION = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution-state/reject";
final String DISTRIBUTION_DOWNLOAD_ARTIFACT = "http://%s:%s/download";
final String ACTIVATE_DISTRIBUTION = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/activate";
+ final String DISTRIBUTION_SERVICE_LIST = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution";
final String DEPLOY_SERVICE = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/markDeployed";
final String UPDATE_SERVICE_METADATA = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/metadata";
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
index ce025715fd..0675dc11ba 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java
@@ -31,7 +31,7 @@ import org.yaml.snakeyaml.Yaml;
public class Config {
- private static String WINDOWS_CONFIG_FILE = "src/main/resources/ci/conf/sdc.yaml";
+ private static String WINDOWS_CONFIG_FILE = "src/main/resources/ci/conf/attsdc.yaml";
String catalogBeHost;
String esHost;
@@ -40,6 +40,8 @@ public class Config {
String neoPort;
String disributionClientHost;
String disributionClientPort;
+ Boolean isDistributionClientRunning;
+
String errorConfigurationFile;
String resourceConfigDir;
@@ -47,6 +49,7 @@ public class Config {
String importResourceConfigDir;
String importResourceTestsConfigDir;
String importTypesConfigDir;
+
String testSuites;
String catalogFeHost;
@@ -70,6 +73,7 @@ public class Config {
private String url;
private String remoteTestingMachineIP;
private String remoteTestingMachinePort;
+ private String webSealSimulatorUrl;
private boolean remoteTesting;
private String cassandraHost;
@@ -86,6 +90,7 @@ public class Config {
private static Yaml yaml = new Yaml();
+
private Config() {
super();
}
@@ -168,6 +173,10 @@ public class Config {
}
}
+ // JsonReader jsonReader = new JsonReader(new FileReader(configFile));
+ // Config configAttOdlIt = new Gson().fromJson(jsonReader,
+ // Config.class);
+
return config;
}
@@ -175,7 +184,7 @@ public class Config {
int separator = Math.max(path.lastIndexOf("\\"), path.lastIndexOf("/"));
String dirPath = path.substring(0, separator + 1);
- String packagesFile = dirPath + File.separator + "sdc-packages.yaml";
+ String packagesFile = dirPath + File.separator + "attsdc-packages.yaml";
File file = new File(packagesFile);
if (false == file.exists()) {
throw new RuntimeException("The config file " + packagesFile + " cannot be found.");
@@ -232,6 +241,14 @@ public class Config {
this.configurationFile = configurationFile;
}
+ public Boolean getIsDistributionClientRunning() {
+ return isDistributionClientRunning;
+ }
+
+ public void setIsDistributionClientRunning(Boolean isDistributionClientRunning) {
+ this.isDistributionClientRunning = isDistributionClientRunning;
+ }
+
public String getCatalogBePort() {
return catalogBePort;
}
@@ -497,6 +514,14 @@ public class Config {
+ outputFolder + ", reportName=" + reportName + ", configurationFile=" + configurationFile + "]";
}
+ public String getWebSealSimulatorUrl() {
+ return webSealSimulatorUrl;
+ }
+
+ public void setWebSealSimulatorUrl(String webSealSimulatorUrl) {
+ this.webSealSimulatorUrl = webSealSimulatorUrl;
+ }
+
public boolean isRemoteTesting() {
return remoteTesting;
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
index 28606af14d..489f229c61 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes;
import java.util.List;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
public class ArtifactReqDetails {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
index 0089eec5a7..638ece8c6d 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java
@@ -32,9 +32,12 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jettison.json.JSONArray;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceAssetStructure.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceAssetStructure.java
index d429d05a51..62f5e0c8f0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceAssetStructure.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceAssetStructure.java
@@ -24,6 +24,8 @@ public class ResourceAssetStructure extends AssetStructure {
private String subCategory;
private String resourceType;
+ protected String lastUpdaterFullName;
+ protected String toscaResourceName;
public ResourceAssetStructure() {
super();
@@ -38,6 +40,22 @@ public class ResourceAssetStructure extends AssetStructure {
public String toString() {
return "ResourceAssetStructure [subCategory=" + subCategory + ", resourceType=" + resourceType + "]";
}
+
+ public String getLastUpdaterFullName() {
+ return lastUpdaterFullName;
+ }
+
+ public void setLastUpdaterFullName(String lastUpdaterFullName) {
+ this.lastUpdaterFullName = lastUpdaterFullName;
+ }
+
+ public String getToscaResourceName() {
+ return toscaResourceName;
+ }
+
+ public void setToscaResourceName(String toscaResourceName) {
+ this.toscaResourceName = toscaResourceName;
+ }
public String getSubCategory() {
return subCategory;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java
index 737343f24c..b521b4bf08 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java
@@ -24,8 +24,6 @@ import java.util.List;
public class ResourceDetailedAssetStructure extends ResourceAssetStructure {
- private String lastUpdaterFullName;
- private String toscaResourceName;
private List<ResourceInstanceAssetStructure> resources;
private List<ArtifactAssetStructure> artifacts;
@@ -42,22 +40,6 @@ public class ResourceDetailedAssetStructure extends ResourceAssetStructure {
this.artifacts = artifacts;
}
- public String getLastUpdaterFullName() {
- return lastUpdaterFullName;
- }
-
- public void setLastUpdaterFullName(String lastUpdaterFullName) {
- this.lastUpdaterFullName = lastUpdaterFullName;
- }
-
- public String getToscaResourceName() {
- return toscaResourceName;
- }
-
- public void setToscaResourceName(String toscaResourceName) {
- this.toscaResourceName = toscaResourceName;
- }
-
public List<ResourceInstanceAssetStructure> getResources() {
return resources;
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java
new file mode 100644
index 0000000000..a5132e8bf6
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Resource;
+
+public class ResourceExternalReqDetails extends ComponentReqDetails {
+ String vendorName;
+ String vendorRelease;
+ String category;
+ String subcategory;
+
+ private String resourceType = ResourceTypeEnum.VFC.toString(); // Default
+ // value
+ public ResourceExternalReqDetails() {
+ super();
+ }
+
+
+ public ResourceExternalReqDetails(String resourceName, String description, List<String> tags,
+ String vendorName, String vendorRelease, String contactId, String icon,
+ String resourceType, String resourceCategory, String resourceSubcategory) {
+ super();
+ this.resourceType = resourceType;
+ this.name = resourceName;
+ this.description = description;
+ this.tags = tags;
+ this.vendorName = vendorName;
+ this.vendorRelease = vendorRelease;
+ this.contactId = contactId;
+ this.icon = icon;
+ this.category = resourceCategory;
+ this.subcategory = resourceSubcategory;
+ }
+
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
+
+ public String getVendorRelease() {
+ return vendorRelease;
+ }
+
+ public void setVendorRelease(String vendorRelease) {
+ this.vendorRelease = vendorRelease;
+ }
+
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getSubcategory() {
+ return subcategory;
+ }
+
+ public void setSubcategory(String subcategory) {
+ this.subcategory = subcategory;
+ }
+
+
+ @Override
+ public String toString() {
+ return "ResourceReqDetails [name=" + name + ", vendorName=" + vendorName
+ + ", vendorRelease=" + vendorRelease + ", version=" + version
+ + ", resourceType=" + resourceType + ", category=" + category + ", subcategory=" + subcategory +"]";
+ }
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java
index 9172b8a632..6a69120a05 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java
@@ -28,7 +28,7 @@ public class ResourceInstanceAssetStructure {
String resourceName;
String resourceInvariantUUID;
String resourceVersion;
- String resourceType;
+ String resoucreType;
String resourceUUID;
List<ArtifactAssetStructure> artifacts;
@@ -37,14 +37,14 @@ public class ResourceInstanceAssetStructure {
}
public ResourceInstanceAssetStructure(String resourceInstanceName, String resourceName,
- String resourceInvariantUUID, String resourceVersion, String resourceType, String resourceUUID,
+ String resourceInvariantUUID, String resourceVersion, String resoucreType, String resourceUUID,
List<ArtifactAssetStructure> artifacts) {
super();
this.resourceInstanceName = resourceInstanceName;
this.resourceName = resourceName;
this.resourceInvariantUUID = resourceInvariantUUID;
this.resourceVersion = resourceVersion;
- this.resourceType = resourceType;
+ this.resoucreType = resoucreType;
this.resourceUUID = resourceUUID;
this.artifacts = artifacts;
}
@@ -81,12 +81,12 @@ public class ResourceInstanceAssetStructure {
this.resourceVersion = resourceVersion;
}
- public String getResourceType() {
- return resourceType;
+ public String getResoucreType() {
+ return resoucreType;
}
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
+ public void setResoucreType(String resoucreType) {
+ this.resoucreType = resoucreType;
}
public String getResourceUUID() {
@@ -109,7 +109,7 @@ public class ResourceInstanceAssetStructure {
public String toString() {
return "ResourceInstanceAssetStructure [resourceInstanceName=" + resourceInstanceName + ", resourceName="
+ resourceName + ", resourceInvariantUUID=" + resourceInvariantUUID + ", resourceVersion="
- + resourceVersion + ", resourceType=" + resourceType + ", resourceUUID=" + resourceUUID + ", artifacts="
+ + resourceVersion + ", resoucreType=" + resoucreType + ", resourceUUID=" + resourceUUID + ", artifacts="
+ artifacts + "]";
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java
new file mode 100644
index 0000000000..dde1f27cca
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public class ServiceDistributionStatus {
+
+ private String distributionID;
+ private String timestamp;
+ private String userId;
+ private String deployementStatus;
+
+ public ServiceDistributionStatus() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public ServiceDistributionStatus(String distributionID, String timestamp, String userId, String deployementStatus) {
+ super();
+ this.distributionID = distributionID;
+ this.timestamp = timestamp;
+ this.userId = userId;
+ this.deployementStatus = deployementStatus;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceDistributionStatus [distributionID=" + distributionID + ", timestamp=" + timestamp + ", userId=" + userId + ", deployementStatus=" + deployementStatus + "]";
+ }
+
+ public String getDistributionID() {
+ return distributionID;
+ }
+
+ public void setDistributionID(String distributionID) {
+ this.distributionID = distributionID;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getDeployementStatus() {
+ return deployementStatus;
+ }
+
+ public void setDeployementStatus(String deployementStatus) {
+ this.deployementStatus = deployementStatus;
+ }
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ArtifactTypeEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ArtifactTypeEnum.java
index 1e6b06a6c8..eafdf80a0a 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ArtifactTypeEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ArtifactTypeEnum.java
@@ -32,13 +32,16 @@ public enum ArtifactTypeEnum {
HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"), HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"),
TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), VENDOR_LICENSE("VENDOR_LICENSE"),
MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"),
- HEAT_ARTIFACT("HEAT_ARTIFACT"), VF_MODULES_METADATA("VF_MODULES_METADATA"),
+ HEAT_ARTIFACT("HEAT_ARTIFACT"), VF_MODULES_METADATA("VF_MODULES_METADATA"), LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"),
+ VES_EVENTS("VES_EVENTS"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"),
// DCAE Artifacts
DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"),
DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"), DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"),
DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
// AAI Artifacts
- AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL")
+ AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
+ // MIB artifacts
+ SNMP_POLL ("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE")
;
ArtifactTypeEnum(String type) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AssocType.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AssocType.java
index b0da1f987d..82e9a36780 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AssocType.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AssocType.java
@@ -22,11 +22,8 @@ package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum AssocType {
- BINDABLE("tosca.capabilities.network.Bindable"),
- HOSTEDON("tosca.relationships.HostedOn"),
- LINKABLE("tosca.capabilities.network.Linkable"),
- CONTAINER("tosca.capabilities.Container"),
- NODE("tosca.capabilities.Node");
+ BINDABLE("tosca.capabilities.network.Bindable"), HOSTEDON("tosca.relationships.HostedOn"), LINKABLE("tosca.capabilities.network.Linkable"),
+ CONTAINER("tosca.capabilities.Container"), NODE("tosca.capabilities.Node");
private String assocType;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AuditEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AuditEnum.java
index a73cff9373..a713d5089f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AuditEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/AuditEnum.java
@@ -22,20 +22,8 @@ package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum AuditEnum {
- ACTION("ACTION"),
- RESOURCE_NAME("RESOURCE_NAME"),
- RESOURCE_TYPE("RESOURCE_TYPE"),
- PREV_VERSION("PREV_VERSION"),
- CURR_VERSION("CURR_VERSION"),
- MODIFIER("MODIFIER"),
- PREV_STATE("PREV_STATE"),
- CURR_STATE("CURR_STATE"),
- STATUS("STATUS-Type"),
- DESC("DESC"),
- URL("URL"),
- USER("USER"),
- AUTH_STATUS("AUTH_STATUS"),
- REALM("REALM");
+ ACTION("ACTION"), RESOURCE_NAME("RESOURCE_NAME"), RESOURCE_TYPE("RESOURCE_TYPE"), PREV_VERSION("PREV_VERSION"), CURR_VERSION("CURR_VERSION"), MODIFIER("MODIFIER"), PREV_STATE("PREV_STATE"),
+ CURR_STATE("CURR_STATE"), STATUS("STATUS-Type"), DESC("DESC"), URL("URL"), USER("USER"), AUTH_STATUS("AUTH_STATUS"), REALM("REALM");
String value;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/DistributionNotificationStatusEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/DistributionNotificationStatusEnum.java
new file mode 100644
index 0000000000..7042a954e7
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/DistributionNotificationStatusEnum.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes.enums;
+
+public enum DistributionNotificationStatusEnum {
+
+
+ DEPLOY_OK("DEPLOY_OK"),
+ DOWNLOAD_OK("DOWNLOAD_OK"),
+ NOTIFIED("NOTIFIED"),
+ NOT_NOTIFIED("NOT_NOTIFIED");
+
+ private String value;
+
+ private DistributionNotificationStatusEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public static DistributionNotificationStatusEnum findState(String state) {
+
+ for (DistributionNotificationStatusEnum distributionStatus : DistributionNotificationStatusEnum.values()) {
+ if (distributionStatus.name().equalsIgnoreCase(state)
+ || distributionStatus.getValue().equalsIgnoreCase(state)) {
+ return distributionStatus;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java
index 7c330a3d10..9edfb9aced 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.ci.tests.datatypes.enums;
+import java.util.List;
+
public enum LifeCycleStatesEnum {
CHECKOUT("checkout", "NOT_CERTIFIED_CHECKOUT"),
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/MandatoryResourceArtifactTypeEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/MandatoryResourceArtifactTypeEnum.java
index 7769d19802..58892439b0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/MandatoryResourceArtifactTypeEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/MandatoryResourceArtifactTypeEnum.java
@@ -24,11 +24,7 @@ import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
public enum MandatoryResourceArtifactTypeEnum {
- TEST_SCRIPTS(null, "testscripts"),
- FEATURES(null, "features"),
- CAPACITY(null, "capacity"),
- VENDOR_TEST_RESULT(null,"vendortestresult"),
- CLOUD_QUESTIONNAIRE(null, "cloudquestionnaire");
+ TEST_SCRIPTS(null, "testscripts"), FEATURES(null, "features"), CAPACITY(null, "capacity"), VENDOR_TEST_RESULT(null, "vendortestresult"), CLOUD_QUESTIONNAIRE(null, "cloudQuestionnaire");
String artifactName;
String logicalName;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/NormativeTypesEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/NormativeTypesEnum.java
index f1cfcf0c98..389b962f1c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/NormativeTypesEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/NormativeTypesEnum.java
@@ -21,20 +21,10 @@
package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum NormativeTypesEnum {
- ROOT("tosca.nodes.Root", "root"),
- COMPUTE("tosca.nodes.Compute", "compute"),
- BLOCK_STORAGE("tosca.nodes.BlockStorage", "blockStorage"),
- CONTAINER_APPLICATION("tosca.nodes.Container.Application", "containerApplication"),
- CONTAINER_RUNTIME("tosca.nodes.Container.Runtime", "containerRuntime"),
- DATABASE("tosca.nodes.Database", "database"),
- DBMS("tosca.nodes.DBMS", "DBMS"),
- LOAD_BALANCER("tosca.nodes.LoadBalancer", "loadBalancer"),
- OBJECT_STORAGE("tosca.nodes.ObjectStorage", "objectStorage"),
- NETWORK("tosca.nodes.network.Network", "network"),
- PORT("tosca.nodes.network.Port", "port"),
- SOFTWARE_COMPONENT("tosca.nodes.SoftwareComponent", "softwareComponent"),
- WEB_APPLICATION("tosca.nodes.webapplication", "webApplication"),
- WEB_SERVER("tosca.nodes.WebServer", "webServer");
+ ROOT("tosca.nodes.Root", "root"), COMPUTE("tosca.nodes.Compute", "compute"), BLOCK_STORAGE("tosca.nodes.BlockStorage", "blockStorage"), CONTAINER_APPLICATION("tosca.nodes.Container.Application", "containerApplication"),
+ CONTAINER_RUNTIME("tosca.nodes.Container.Runtime","containerRuntime"), DATABASE("tosca.nodes.Database", "database"), DBMS("tosca.nodes.DBMS", "DBMS"), LOAD_BALANCER("tosca.nodes.LoadBalancer", "loadBalancer"),
+ OBJECT_STORAGE("tosca.nodes.ObjectStorage", "objectStorage"), NETWORK("tosca.nodes.network.Network", "network"), PORT("tosca.nodes.network.Port", "port"), SOFTWARE_COMPONENT("tosca.nodes.SoftwareComponent", "softwareComponent"),
+ WEB_APPLICATION("tosca.nodes.webapplication","webApplication"), WEB_SERVER("tosca.nodes.WebServer", "webServer");
public String normativeName;
private String folderName;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/OriginTypeEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/OriginTypeEnum.java
new file mode 100644
index 0000000000..d85a496241
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/OriginTypeEnum.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes.enums;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+
+public enum OriginTypeEnum {
+ PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT),
+ SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE),
+ VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE),
+ VFC("VFC", "VFC (Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE),
+ CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE),
+ VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE),
+ VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE),
+ VFi("VFi", "VFi (Virtual Function Instance)", "resource instance", ComponentTypeEnum.RESOURCE_INSTANCE);
+
+
+ private String value;
+ private String displayValue;
+ private String instanceType;
+ private ComponentTypeEnum componentType;
+
+ private OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType) {
+ this.value = value;
+ this.displayValue = displayValue;
+ this.instanceType = instanceType;
+ this.componentType = componentType;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getDisplayValue() {
+ return displayValue;
+ }
+
+ public String getInstanceType() {
+ return instanceType;
+ }
+
+ public ComponentTypeEnum getComponentType() {
+ return componentType;
+ }
+
+ public static OriginTypeEnum findByValue(String value) {
+ OriginTypeEnum ret = null;
+ for (OriginTypeEnum curr : OriginTypeEnum.values()) {
+ if (curr.getValue().equals(value)) {
+ ret = curr;
+ break;
+ }
+ }
+ return ret;
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java
index 5dac326c70..76296acf82 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.ci.tests.datatypes.enums;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
@@ -27,7 +28,8 @@ import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
public enum PropertyTypeEnum {
INTEGER("defaultIntegerPropName1", "integer", "125", "default integer type property description", null),
STRING("defaultStringPropName1", "string", "string", "default string type property description", null),
- BOOLEAN("defaultBooleanPropName1", "boolean", "true", "default boolean type property description", null),
+ BOOLEAN("defaultBooleanPropName1", "boolean", "true", "default boolean type property description", null),
+ FLOAT("defaultFloatPropName1", "float", "12.34", "default f;oat type property description", null),
STRING_LIST("defaultStringListPropName", "list", "[a,b]", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())),
INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())),
BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())),
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
index 3ece77b8ec..47123a61e7 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java
@@ -27,8 +27,9 @@ public enum ResourceCategoryEnum {
APPLICATION_L4_APP_SERVER("Application L4+", "Application Server"), APPLICATION_L4_WEB_SERVERS("Application L4+", "Web Server"), APPLICATION_L4_CALL_CONTROL("Application L4+","Call Control"),
APPLICATION_L4_MEDIA_SERVER("Application L4+", "Media Servers"), APPLICATION_L4_LOAD_BALANCER("Application L4+", "Load Balancer"), APPLICATION_L4_DATABASE("Application L4+","Database"),
APPLICATION_L4_FIREWALL("Application L4+", "Firewall"), GENERIC_INFRASTRUCTURE("Generic", "Infrastructure"), GENERIC_ABSTRACT("Generic", "Abstract"), GENERIC_NETWORK_ELEMENTS("Generic","Network Elements"),
- GENERIC_DATABASE("Generic", "Database"), NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points"), NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links");
-
+ GENERIC_DATABASE("Generic", "Database"), NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points"), NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links"),
+ TEMPLATE_MONITORING_TEMPLATE("Template", "Monitoring Template"), ALLOTTED_RESOURCE("Allotted Resource", "Allotted Resource");
+
private String category;
private String subCategory;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/RespJsonKeysEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/RespJsonKeysEnum.java
index 4350cba105..2f2af97fd8 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/RespJsonKeysEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/RespJsonKeysEnum.java
@@ -22,30 +22,10 @@ package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum RespJsonKeysEnum {
- IS_ABSTRACT("abstract"),
- UNIQUE_ID("uniqueId"),
- RESOURCE_NAME("name"),
- RESOURCE_VERSION("version"),
- TAGS("tags"),
- LIFE_CYCLE_STATE("lifecycleState"),
- DERIVED_FROM("derivedFrom"),
- RESOURCE_DESC("description"),
- VENDOR_NAME("vendorName"),
- VENDOR_RELEASE("vendorRelease"),
- CONTACT_ID("contactId"),
- ICON("icon"),
- HIGHEST_VERSION("highestVersion"),
- CREATOR_USER_ID("creatorUserId"),
- CREATOR_FULL_NAME("creatorFullName"),
- LAST_UPDATER_ATT_UID("lastUpdaterUserId"),
- LAST_UPDATER_FULL_NAME("lastUpdaterFullName"),
- ARTIFACTS("artifacts"),
- DESCRIPTION("description"),
- UUID("uuid"),
- COST("cost"),
- LICENSE_TYPE("licenseType"),
- RESOURCE_TYPE("resourceType"),
- CATEGORIES("categories");
+ IS_ABSTRACT("abstract"), UNIQUE_ID("uniqueId"), RESOURCE_NAME("name"), RESOURCE_VERSION("version"), TAGS("tags"), LIFE_CYCLE_STATE("lifecycleState"), DERIVED_FROM("derivedFrom"), RESOURCE_DESC("description"),
+ VENDOR_NAME("vendorName"), VENDOR_RELEASE("vendorRelease"), CONTACT_ID("contactId"), ICON("icon"), HIGHEST_VERSION("highestVersion"), CREATOR_USER_ID("creatorUserId"), CREATOR_FULL_NAME("creatorFullName"),
+ LAST_UPDATER_USER_ID("lastUpdaterUserId"), LAST_UPDATER_FULL_NAME("lastUpdaterFullName"), ARTIFACTS("artifacts"), DESCRIPTION("description"), UUID("uuid"), COST("cost"), LICENSE_TYPE("licenseType"),
+ RESOURCE_TYPE("resourceType"), CATEGORIES("categories");
private String respJsonKeyName;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/SearchCriteriaEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/SearchCriteriaEnum.java
new file mode 100644
index 0000000000..f26423a35d
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/SearchCriteriaEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.datatypes.enums;
+
+
+
+public enum SearchCriteriaEnum {
+
+ RESOURCE_TYPE("resourceType"), CATEGORY("category"), SUBCATEGORY("subCategory");
+
+ private String value;
+
+ private SearchCriteriaEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceApiArtifactEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceApiArtifactEnum.java
index 675e1d7502..4cfcc8a558 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceApiArtifactEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceApiArtifactEnum.java
@@ -21,12 +21,7 @@
package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum ServiceApiArtifactEnum {
- CONFIGURATION("Configuration".toLowerCase()),
- INSTANTIATION("Instantiation".toLowerCase()),
- MONITORING("Monitoring".toLowerCase()),
- REPORTING("Reporting".toLowerCase()),
- LOGGING("Logging".toLowerCase()),
- TESTING("Testing".toLowerCase());
+ CONFIGURATION("Configuration".toLowerCase()), INSTANTIATION("Instantiation".toLowerCase()), MONITORING("Monitoring".toLowerCase()), REPORTING("Reporting".toLowerCase()), LOGGING("Logging".toLowerCase()), TESTING("Testing".toLowerCase());
String logicalName;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
index f8479e912c..b8635b3bda 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ToscaKeysEnum.java
@@ -22,10 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum ToscaKeysEnum {
- TOSCA_DEFINITION_VERSION("tosca_definitions_version"),
- METADATA("metadata"), IMPORTS("imports"),
- NODE_TYPES("node_types"),
- TOPOLOGY_TEMPLATE("topology_template");
+ TOSCA_DEFINITION_VERSION("tosca_definitions_version"), METADATA("metadata"), IMPORTS("imports"), NODE_TYPES("node_types"), TOPOLOGY_TEMPLATE("topology_template");
private String toscaKey;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java
index 399779fefe..fb04f6a68b 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java
@@ -21,35 +21,39 @@
package org.openecomp.sdc.ci.tests.datatypes.enums;
public enum UserRoleEnum {
-
- ADMIN("jh0003","Jimmy", "Hendrix"), DESIGNER("cs0008","Carlos", "Santana"), DESIGNER2("me0009","Melissa", "Etheridge"), TESTER("jm0007","Joni", "Mitchell"),ADMIN4("km2000","Kot", "May"), GOVERNOR("gv0001","David", "Shadmi"),
- OPS("op0001","Steve", "Regev"),PRODUCT_STRATEGIST1("ps0001","Eden", "Rozin"),PRODUCT_STRATEGIST2("ps0002","Ella", "Kvetny"),PRODUCT_STRATEGIST3("ps0003","Geva", "Alon"), PRODUCT_MANAGER1("pm0001","Teddy", "Isashar"),
- PRODUCT_MANAGER2("pm0002","Sarah", "Bettens");
-
- private String userId;
- private String firstName;
- private String lastName;
- private String userName;
+
+ ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"),
+ GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Steve", "Regev"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"),
+ PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens");
+ private String userId;
+ private String firstName;
+ private String lastName;
+ private String userName;
+
private UserRoleEnum(String userId, String userName) {
this.userId = userId;
this.userName = userName;
}
-
+
private UserRoleEnum(String userId, String firstName, String lastName) {
this.userId = userId;
- this.firstName =firstName;
+ this.firstName = firstName;
this.lastName = lastName;
- this.userName = firstName+" " + lastName;
+ this.userName = firstName + " " + lastName;
}
+
public String getUserId() {
return userId;
}
+
public void setUserId(String userId) {
this.userId = userId;
}
+
public String getUserName() {
return userName;
}
+
public void setUserName(String userName) {
this.userName = userName;
}
@@ -69,8 +73,5 @@ public enum UserRoleEnum {
public void setLastName(String lastName) {
this.lastName = lastName;
}
-
}
-
-
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
index 7c2830ec5f..5801536973 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java
@@ -92,7 +92,6 @@ public class HttpRequest {
response.append(result);
} catch (Exception e) {
- // logger.error("Error during getting input stream: ",e);
}
try {
@@ -101,7 +100,6 @@ public class HttpRequest {
response.append(result);
} catch (Exception e) {
- // logger.error("Error during getting error stream: ",e);
}
logger.debug("Response body: {}", response);
@@ -155,7 +153,7 @@ public class HttpRequest {
}
in.close();
} catch (Exception e) {
- logger.debug("response body is null");
+ logger.debug("response body is null", e);
}
String result;
@@ -190,7 +188,8 @@ public class HttpRequest {
return restResponse;
}
- public RestResponse httpSendByMethod(String url, String method, String body, Map<String, String> headers) throws IOException {
+ public RestResponse httpSendByMethod(String url, String method, String body, Map<String, String> headers)
+ throws IOException {
RestResponse restResponse = new RestResponse();
URL obj = new URL(url);
@@ -234,7 +233,7 @@ public class HttpRequest {
in.close();
} catch (Exception e) {
// response = null;
- logger.debug("response body is null");
+ logger.debug("response body is null", e);
}
String result;
@@ -353,7 +352,8 @@ public class HttpRequest {
return httpSendPost(url, body, headers, "PUT");
}
- public RestResponse httpSendPost(String url, String body, Map<String, String> headers, String methodType) throws IOException {
+ public RestResponse httpSendPost(String url, String body, Map<String, String> headers, String methodType)
+ throws IOException {
RestResponse restResponse = new RestResponse();
URL obj = new URL(url);
@@ -428,7 +428,8 @@ public class HttpRequest {
}
- public RestResponse httpSendDeleteWithBody2(String url, String body, Map<String, String> headers) throws ClientProtocolException, IOException {
+ public RestResponse httpSendDeleteWithBody2(String url, String body, Map<String, String> headers)
+ throws ClientProtocolException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
RestResponse restResponse = new RestResponse();
@@ -455,7 +456,8 @@ public class HttpRequest {
return restResponse;
}
- public RestResponse httpSendDeleteWithBody(String url, String body, Map<String, String> headers) throws IOException {
+ public RestResponse httpSendDeleteWithBody(String url, String body, Map<String, String> headers)
+ throws IOException {
RestResponse restResponse = new RestResponse();
URL obj = new URL(url);
@@ -600,7 +602,8 @@ public class HttpRequest {
}
- public RestResponse httpSendPostMultipart(String url, Map<String, String> headers, String jsonLocation, String zipLocation) throws IOException {
+ public RestResponse httpSendPostMultipart(String url, Map<String, String> headers, String jsonLocation,
+ String zipLocation) throws IOException {
Gson gson = new Gson();
String gsonToSend = null;
@@ -665,7 +668,8 @@ public class HttpRequest {
}
- public RestResponse httpSendPostWithAuth(String url, String body, Map<String, String> headers, String username, String password) throws IOException {
+ public RestResponse httpSendPostWithAuth(String url, String body, Map<String, String> headers, String username,
+ String password) throws IOException {
String userPassword = username + ":" + password;
String encoding = Base64.encodeBase64String(userPassword.getBytes());
@@ -799,7 +803,8 @@ public class HttpRequest {
return restResponse;
}
- public static RestResponse sendHttpPostWithEntity(HttpEntity requestEntity, String url, Map<String, String> headers) throws IOException, ClientProtocolException {
+ public static RestResponse sendHttpPostWithEntity(HttpEntity requestEntity, String url, Map<String, String> headers)
+ throws IOException, ClientProtocolException {
CloseableHttpResponse response = null;
CloseableHttpClient client = HttpClients.createDefault();
try {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
index 3af40c5bb8..71e75c9a1e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java
@@ -20,6 +20,9 @@
package org.openecomp.sdc.ci.tests.execute.TODO;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+import org.testng.AssertJUnit;
import java.io.File;
import java.io.IOException;
@@ -33,11 +36,8 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
-import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState;
import org.openecomp.sdc.ci.tests.utils.Utils;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
+import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState;
import fj.data.Either;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
index cd0647d8b1..7e363202bb 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
@@ -61,8 +61,10 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
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.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
index b3c3f3f5b6..28c346efc9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/CrudArt.java
@@ -170,7 +170,7 @@ public class CrudArt extends ComponentBaseTest {
heatArtifactDetails.setPayload(payload);
RestResponse addInformationalArtifactToResource = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails1, vfResourceDetails.getUniqueId());
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
// certified resource
@@ -313,7 +313,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "dcae inv tosca label";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.DCAE_INVENTORY_TOSCA;
RestResponse addArtifactToResourceInstanceResponse = addArtifactToResourceInstanceAndCertify(artifactFileName, artifactName, artifactLabel, artifactType);
- logger.debug("addInformationalArtifactToResource response: {}", addArtifactToResourceInstanceResponse.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addArtifactToResourceInstanceResponse.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addArtifactToResourceInstanceResponse.getErrorCode(), addArtifactToResourceInstanceResponse.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
// Get the artifact from VF instance and change his description.
@@ -333,7 +333,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = heatSuccessFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
@@ -352,7 +352,7 @@ public class CrudArt extends ComponentBaseTest {
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
// Add HEAT
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
heatArtifactDetails.setPayload(payload);
@@ -589,17 +589,8 @@ public class CrudArt extends ComponentBaseTest {
// ---------------------------------Service
// success--------------------------------
@Test()
- public void addAllTypesDepArtifactToService() throws Exception, Exception {
-
- // String fileName = heatSuccessFile;
- // List<String> listFileName =
- // FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- // logger.debug("listFileName: {}", listFileName.toString());
-
- // String payload = FileUtils.loadPayloadFile(listFileName, fileName,
- // true);
+ public void addAllTypesDepArtifactToService() throws Exception {
ArtifactReqDetails otherArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.OTHER.getType());
- // otherArtifactDetails.setPayload(payload);
RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(otherArtifactDetails, sdncDesignerDetails1, serviceDetails.getUniqueId());
logger.debug("addInformationalArtifactToService response: {}", addInformationalArtifactToService.getResponseMessage());
@@ -618,7 +609,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = muranoFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.MURANO_PKG.getType());
@@ -627,7 +618,7 @@ public class CrudArt extends ComponentBaseTest {
heatArtifactDetails.setArtifactLabel("Label");
RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(heatArtifactDetails, sdncDesignerDetails1, serviceDetails.getUniqueId());
- logger.debug("addInformationalArtifactToService response: {}", addInformationalArtifactToService.getResponseMessage());
+ logger.debug("addInformationalArtifactToService response: {}", addInformationalArtifactToService.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToService.getErrorCode(), addInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
}
@@ -679,7 +670,7 @@ public class CrudArt extends ComponentBaseTest {
// update
heatArtifactDetails.setPayloadData(payload);
RestResponse updateInformationalArtifactToService = ArtifactRestUtils.updateInformationalArtifactOfServiceByMethod(heatArtifactDetails, serviceDetails.getUniqueId(), sdncDesignerDetails1, "POST");
- logger.debug("updateInformationalArtifactToService response: {}", updateInformationalArtifactToService.getResponseMessage());
+ logger.debug("updateInformationalArtifactToService response: {}", updateInformationalArtifactToService.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + updateInformationalArtifactToService.getErrorCode(), updateInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
}
@@ -716,7 +707,7 @@ public class CrudArt extends ComponentBaseTest {
String filename1 = heatSuccessFile;
// String filename2 = heatSuccessMiniFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, filename1, true);
@@ -753,7 +744,7 @@ public class CrudArt extends ComponentBaseTest {
String filename1 = heatSuccessFile;
String filename2 = heatSuccessMiniFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, filename1, true);
heatTypeArtifactDetails.setPayload(payload);
@@ -782,7 +773,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = heatInvalidFormat;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
heatTypeArtifactDetails.setPayload(payload);
@@ -803,7 +794,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = yamlInvalidFormat;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
heatTypeArtifactDetails.setPayload(payload);
@@ -824,7 +815,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = yangFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
@@ -847,7 +838,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = heatSuccessFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
heatTypeArtifactDetails.setPayload(payload);
@@ -892,7 +883,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName1 = heatSuccessFile;
String fileName2 = heatSuccessMiniFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName1, true);
ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.OTHER.getType());
@@ -925,7 +916,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = heatInvalidFormat;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
@@ -943,13 +934,12 @@ public class CrudArt extends ComponentBaseTest {
}
- // TODO Andrey Obsolete
@Test(enabled = false)
public void addHeatArtifactInvalidYamlFormatToService() throws Exception, Exception {
String fileName = yamlInvalidFormat;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
@@ -957,7 +947,7 @@ public class CrudArt extends ComponentBaseTest {
heatArtifactDetails.setPayload(payload);
RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(heatArtifactDetails, sdncDesignerDetails1, serviceDetails.getUniqueId());
- logger.debug("addInformationalArtifactToService response: {}", addInformationalArtifactToService.getResponseMessage());
+ logger.debug("addInformationalArtifactToService response: {} ", addInformationalArtifactToService.getResponseMessage());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_YAML.name());
assertEquals("Check response code after adding artifact", errorInfo.getCode(), addInformationalArtifactToService.getErrorCode());
@@ -972,7 +962,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = muranoFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
@@ -981,7 +971,7 @@ public class CrudArt extends ComponentBaseTest {
heatArtifactDetails.setArtifactName(fileName);
RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(heatArtifactDetails, sdncDesignerDetails1, serviceDetails.getUniqueId());
- logger.debug("addInformationalArtifactToService response: {}", addInformationalArtifactToService.getResponseMessage());
+ logger.debug("addInformationalArtifactToService response: {} ", addInformationalArtifactToService.getResponseMessage());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.WRONG_ARTIFACT_FILE_EXTENSION.name());
assertEquals("Check response code after adding artifact", errorInfo.getCode(), addInformationalArtifactToService.getErrorCode());
@@ -1019,7 +1009,7 @@ public class CrudArt extends ComponentBaseTest {
String fileName = heatSuccessFile;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, fileName, true);
@@ -1063,7 +1053,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1083,7 +1073,7 @@ public class CrudArt extends ComponentBaseTest {
artifactLabel = "Label3";
artifactType = ArtifactTypeEnum.VENDOR_LICENSE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1094,7 +1084,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1105,7 +1095,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1116,7 +1106,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.APPC_CONFIG;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1128,12 +1118,61 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.APPC_CONFIG;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
ArtifactValidationUtils.validateArtifactsNumberInComponent(resource, ArtifactGroupTypeEnum.DEPLOYMENT, artifactType, 2);
+
+ //MIB artifacts: SNMP_POLL, SNMP_TRAP
+ fileName = jsonFile;
+ artifactName = "artifact8.json";
+ artifactLabel = "Label8";
+ artifactType = ArtifactTypeEnum.SNMP_POLL;
+ addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
+ resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
+ ArtifactValidationUtils.validateArtifactsNumberInComponent(resource, ArtifactGroupTypeEnum.DEPLOYMENT, artifactType, 1);
+
+ fileName = jsonFile;
+ artifactName = "artifact9.json";
+ artifactLabel = "Label9";
+ artifactType = ArtifactTypeEnum.SNMP_TRAP;
+
+ addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
+ resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
+ ArtifactValidationUtils.validateArtifactsNumberInComponent(resource, ArtifactGroupTypeEnum.DEPLOYMENT, artifactType, 1);
+
+ //MIB artifacts: SNMP_POLL, SNMP_TRAP
+ fileName = jsonFile;
+ artifactName = "artifact8.json";
+ artifactLabel = "Label8";
+ artifactType = ArtifactTypeEnum.SNMP_POLL;
+
+ addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
+ resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
+ ArtifactValidationUtils.validateArtifactsNumberInComponent(resource, ArtifactGroupTypeEnum.DEPLOYMENT, artifactType, 1);
+
+ fileName = jsonFile;
+ artifactName = "artifact9.json";
+ artifactLabel = "Label9";
+ artifactType = ArtifactTypeEnum.SNMP_TRAP;
+
+ addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
+ resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
+ ArtifactValidationUtils.validateArtifactsNumberInComponent(resource, ArtifactGroupTypeEnum.DEPLOYMENT, artifactType, 1);
}
@Test
@@ -1145,7 +1184,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1156,7 +1195,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.VF_LICENSE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1167,7 +1206,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.VENDOR_LICENSE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1178,7 +1217,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1189,7 +1228,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1249,7 +1288,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label2";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VF_LICENSE;
RestResponse addDeploymentArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vlResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addDeploymentArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addDeploymentArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addDeploymentArtifactToResource.getErrorCode(), addDeploymentArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vlResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1272,7 +1311,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label2";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VF_LICENSE;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1281,7 +1320,7 @@ public class CrudArt extends ComponentBaseTest {
artifactLabel = "Label3";
artifactType = ArtifactTypeEnum.VENDOR_LICENSE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1451,7 +1490,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label1";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1462,7 +1501,7 @@ public class CrudArt extends ComponentBaseTest {
artifactLabel = "Label2";
artifactType = ArtifactTypeEnum.APPC_CONFIG;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1473,7 +1512,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1484,7 +1523,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1516,7 +1555,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label7";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.APPC_CONFIG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code 400, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_INVALID_CONTENT);
ArrayList<String> variables = new ArrayList<>();
variables.add(artifactName);
@@ -1535,7 +1574,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label7";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.APPC_CONFIG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, cpResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code 400, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_INVALID_CONTENT);
ArrayList<String> variables = new ArrayList<>();
variables.add(artifactName);
@@ -1554,7 +1593,7 @@ public class CrudArt extends ComponentBaseTest {
String artifactLabel = "Label7";
ArtifactTypeEnum artifactType = ArtifactTypeEnum.APPC_CONFIG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vlResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code 400, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_INVALID_CONTENT);
ArrayList<String> variables = new ArrayList<>();
variables.add(artifactName);
@@ -1585,7 +1624,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.APPC_CONFIG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is 400, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_INVALID_CONTENT);
ArrayList<String> variables = new ArrayList<>();
@@ -1607,7 +1646,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, cpResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(cpResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1618,7 +1657,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, cpResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(cpResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1629,7 +1668,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, cpResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(cpResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1645,7 +1684,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vlResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vlResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1656,7 +1695,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vlResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vlResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1667,7 +1706,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vlResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vlResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1683,7 +1722,7 @@ public class CrudArt extends ComponentBaseTest {
ArtifactTypeEnum artifactType = ArtifactTypeEnum.VNF_CATALOG;
RestResponse addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1694,7 +1733,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_INVENTORY_PROFILE;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1705,7 +1744,7 @@ public class CrudArt extends ComponentBaseTest {
artifactType = ArtifactTypeEnum.MODEL_QUERY_SPEC;
addInformationalArtifactToResource = addDeploymentArtifactToResource(fileName, artifactName, artifactLabel, artifactType, vfcResourceDetails);
- logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {}", addInformationalArtifactToResource.getResponseMessage());
assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToResource.getErrorCode(), addInformationalArtifactToResource.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
getResource = ResourceRestUtils.getResource(vfcResourceDetails.getUniqueId());
resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
@@ -1736,7 +1775,7 @@ public class CrudArt extends ComponentBaseTest {
private ArtifactReqDetails buildArtifactReqDetailsObject(String filesPath, String artifactFileName, String artifactName, String artifactLabel, ArtifactTypeEnum artifactType) throws IOException, Exception {
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(filesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}", listFileName);
String payload = FileUtils.loadPayloadFile(listFileName, artifactFileName, true);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
index 0ae975207b..5ec4a86977 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
@@ -91,7 +91,6 @@ import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -108,229 +107,226 @@ public class DownloadComponentArt extends ComponentBaseTest {
protected String contentTypeHeaderData = "application/json";
protected String acceptHeaderDate = "application/json";
+
+
protected Gson gson = new Gson();
protected JSONParser jsonParser = new JSONParser();
+
protected String serviceVersion;
protected ResourceReqDetails resourceDetails;
protected User sdncUserDetails;
protected ServiceReqDetails serviceDetails;
+
@BeforeMethod
- public void init() throws Exception {
+ public void init() throws Exception{
sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- Resource resourceObj = AtomicOperationUtils
- .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
+ Resource resourceObj = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
Service serviceObj = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
-
- resourceDetails = new ResourceReqDetails(resourceObj);
+
+
+ resourceDetails = new ResourceReqDetails(resourceObj);
serviceDetails = new ServiceReqDetails(serviceObj);
}
-
- @Rule
+
+ @Rule
public static TestName name = new TestName();
public DownloadComponentArt() {
super(name, DownloadComponentArt.class.getName());
}
+
+
// External API - Download artifact for resource
@Test
public void downloadArtifactFromResourceViaExternalAPI() throws Exception {
Resource resourceDetailsVF;
- Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(
- ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE,
- UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
resourceDetailsVF = createdResource.left().value();
- ArtifactDefinition heatArtifact = AtomicOperationUtils
- .uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF, UserRoleEnum.DESIGNER, true, true)
- .left().value();
- resourceDetails = new ResourceReqDetails(resourceDetailsVF);
-
+ ArtifactDefinition heatArtifact = AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF, UserRoleEnum.DESIGNER, true, true).left().value();
+ resourceDetails = new ResourceReqDetails(resourceDetailsVF);
+
String resourceUUID = resourceDetailsVF.getUUID();
String artifactUUID = heatArtifact.getArtifactUUID();
-
+
System.out.println("Resource UUID: " + resourceUUID);
System.out.println("Artifact UUID: " + artifactUUID);
-
- RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID,
- artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Resource");
-
+
+ RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Resource");
+
Integer responseCode = restResponse.getErrorCode();
Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
-
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
+
String response = restResponse.getResponse();
-
+
String payloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
String decodedPaypload = Decoder.decode(payloadData);
-
+
Assert.assertEquals(response, decodedPaypload, "Response deployment artifact not correct.");
-
- String auditAction = "ArtifactDownload";
-
+
+ String auditAction = "DownloadArtifact";
+
ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName());
expectedResourceAuditJavaObject.setResourceType("Resource");
expectedResourceAuditJavaObject.setStatus("200");
expectedResourceAuditJavaObject.setDesc("OK");
-
+
expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
String resource_url = String.format("/asdc/v1/catalog/resources/%s/artifacts/%s", resourceUUID, artifactUUID);
expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-
- AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null,
- false);
+
+ AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
}
-
+
+
// External API - Download artifact for resource - negative test
@Test
public void downloadArtifactFromResourceViaExternalAPINegativeTest() throws Exception {
Resource resourceDetailsVF;
- Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(
- ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE,
- UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
resourceDetailsVF = createdResource.left().value();
- ArtifactDefinition heatArtifact = AtomicOperationUtils
- .uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF, UserRoleEnum.DESIGNER, true, true)
- .left().value();
- resourceDetails = new ResourceReqDetails(resourceDetailsVF);
-
+ ArtifactDefinition heatArtifact = AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF, UserRoleEnum.DESIGNER, true, true).left().value();
+ resourceDetails = new ResourceReqDetails(resourceDetailsVF);
+
String resourceUUID = resourceDetailsVF.getUUID();
String artifactUUID = heatArtifact.getArtifactUUID();
-
+
System.out.println("Resource UUID: " + resourceUUID);
System.out.println("Artifact UUID: " + artifactUUID);
-
- RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID,
- "dfsgfdsg324", ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Resource");
-
+
+ RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, "dfsgfdsg324", ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Resource");
+
Integer responseCode = restResponse.getErrorCode();
Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
}
-
+
+
+
+
+
// External API - Download artifact for service - negative test
@Test
public void downloadArtifactFromServiceViaExternalAPI() throws Exception {
-
+
Service resourceDetailsService;
- Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER,
- true);
+ Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
resourceDetailsService = createdResource.left().value();
-
- ArtifactDefinition heatArtifact = AtomicOperationUtils
- .uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsService, UserRoleEnum.DESIGNER, true, true)
- .left().value();
+
+ ArtifactDefinition heatArtifact = AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsService, UserRoleEnum.DESIGNER, true, true).left().value();
String resourceUUID = resourceDetailsService.getUUID();
String artifactUUID = heatArtifact.getArtifactUUID();
-
+
System.out.println("Resource UUID: " + resourceUUID);
System.out.println("Artifact UUID: " + artifactUUID);
-
- RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID,
- artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Service");
-
+
+ RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Service");
+
Integer responseCode = restResponse.getErrorCode();
Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
-
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
+
String response = restResponse.getResponse();
-
+
String payloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
String decodedPaypload = Decoder.decode(payloadData);
-
+
Assert.assertEquals(response, decodedPaypload, "Response deployment artifact not correct.");
-
- String auditAction = "ArtifactDownload";
-
+
+ String auditAction = "DownloadArtifact";
+
ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setResourceName(resourceDetailsService.getName());
expectedResourceAuditJavaObject.setResourceType("Service");
expectedResourceAuditJavaObject.setStatus("200");
expectedResourceAuditJavaObject.setDesc("OK");
-
+
expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
String resource_url = String.format("/asdc/v1/catalog/services/%s/artifacts/%s", resourceUUID, artifactUUID);
expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-
- AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null,
- false);
+
+ AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
}
-
- // External API - Download ComponentInstance artifact of service - negative
- // test
+
+
+
+
+
+
+ // External API - Download ComponentInstance artifact of service - negative test
@Test
public void downloadArtifactOfComponentInstanceFromServiceViaExternalAPI() throws Exception {
-
- Either<Resource, RestResponse> resourceDetailsVF_01e = AtomicOperationUtils
- .createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT,
- ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
+
+ Either<Resource, RestResponse> resourceDetailsVF_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
Component resourceDetailsVF_01 = resourceDetailsVF_01e.left().value();
- ArtifactDefinition heatArtifact = AtomicOperationUtils
- .uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true)
- .left().value();
-
- resourceDetailsVF_01 = AtomicOperationUtils
- .changeComponentState(resourceDetailsVF_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true)
- .getLeft();
+ ArtifactDefinition heatArtifact = AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true).left().value();
+ resourceDetailsVF_01 = AtomicOperationUtils.changeComponentState(resourceDetailsVF_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+
Service resourceDetailsService;
- Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER,
- true);
+ Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
resourceDetailsService = createdResource.left().value();
-
- ComponentInstance resourceDetailsVF1ins_01 = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(resourceDetailsVF_01, resourceDetailsService,
- UserRoleEnum.DESIGNER, true)
- .left().value();
-
+
+
+ ComponentInstance resourceDetailsVF1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVF_01, resourceDetailsService, UserRoleEnum.DESIGNER, true).left().value();
+
+
System.out.println("-----");
-
+
+
String resourceUUID = resourceDetailsService.getUUID();
- String componentInstanceUID = resourceDetailsVF1ins_01.getUniqueId();
+ String componentNormalizedName = resourceDetailsVF1ins_01.getNormalizedName();
String artifactUUID = heatArtifact.getArtifactUUID();
-
+
System.out.println("Resource UUID: " + resourceUUID);
- System.out.println("Component instance UID: " + componentInstanceUID);
+ System.out.println("Component NormalizedName: " + componentNormalizedName);
System.out.println("Artifact UUID: " + artifactUUID);
-
- RestResponse restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(resourceUUID,
- componentInstanceUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Service");
- //
+
+ RestResponse restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(resourceUUID, componentNormalizedName, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Service");
+//
Integer responseCode = restResponse.getErrorCode();
Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
-
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
+
String response = restResponse.getResponse();
-
+
String payloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
String decodedPaypload = Decoder.decode(payloadData);
-
+
Assert.assertEquals(response, decodedPaypload, "Response deployment artifact not correct.");
-
- String auditAction = "ArtifactDownload";
-
+
+ String auditAction = "DownloadArtifact";
+
ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setResourceName(resourceDetailsVF1ins_01.getName());
expectedResourceAuditJavaObject.setResourceType("Service");
expectedResourceAuditJavaObject.setStatus("200");
expectedResourceAuditJavaObject.setDesc("OK");
-
+
expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
- String resource_url = String.format("/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s",
- resourceUUID, componentInstanceUID, artifactUUID);
+ String resource_url = String.format("/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s", resourceUUID, componentNormalizedName, artifactUUID);
expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
-
- AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null,
- false);
+
+ AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
}
-
+
+
+
+
+
+
+
+
+
@Test
public void downloadArtifactFromResourceTest() throws Exception {
@@ -339,8 +335,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
String jsonBody = createUploadArtifactBodyJson();
String resourceId = resourceDetails.getUniqueId();
- String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(),
- config.getCatalogBePort(), resourceId);
+ String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
HttpPost httppost = createPostAddArtifactRequeast(jsonBody, url, true);
HttpResponse response = httpclient.execute(httppost);
int status = response.getStatusLine().getStatusCode();
@@ -349,25 +344,21 @@ public class DownloadComponentArt extends ComponentBaseTest {
ArtifactDefinition origArtifact = getArtifactDataFromJson(jsonBody);
addArtifactDataFromResponse(response, origArtifact);
String artifactId = origArtifact.getUniqueId();
-
- url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(),
- config.getCatalogBePort(), resourceId, artifactId);
+
+ url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId, artifactId);
HttpGet httpGet = createGetRequest(url);
response = httpclient.execute(httpGet);
status = response.getStatusLine().getStatusCode();
AssertJUnit.assertEquals("failed to download artifact", 200, status);
-
+
InputStream inputStream = response.getEntity().getContent();
ArtifactUiDownloadData artifactUiDownloadData = getArtifactUiDownloadData(IOUtils.toString(inputStream));
- AssertJUnit.assertEquals("Downloaded payload is different from uploaded one", UPLOAD_ARTIFACT_PAYLOAD,
- artifactUiDownloadData.getBase64Contents());
- AssertJUnit.assertEquals("Downloaded artifact name is different from uploaded one", UPLOAD_ARTIFACT_NAME,
- artifactUiDownloadData.getArtifactName());
+ AssertJUnit.assertEquals("Downloaded payload is different from uploaded one", UPLOAD_ARTIFACT_PAYLOAD, artifactUiDownloadData.getBase64Contents());
+ AssertJUnit.assertEquals("Downloaded artifact name is different from uploaded one", UPLOAD_ARTIFACT_NAME, artifactUiDownloadData.getArtifactName());
// validate audit
-
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
- .constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), sdncUserDetails);
+
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), sdncUserDetails);
String auditAction = "ArtifactDownload";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setPrevState("");
@@ -379,7 +370,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
expectedResourceAuditJavaObject.setPrevArtifactUuid("");
AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
-
+
} finally {
httpclient.close();
}
@@ -395,8 +386,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
String jsonStr = createUploadArtifactBodyJson();
- String url = String.format(Urls.ADD_ARTIFACT_TO_SERVICE, config.getCatalogBeHost(),
- config.getCatalogBePort(), serviceDetails.getUniqueId());
+ String url = String.format(Urls.ADD_ARTIFACT_TO_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), serviceDetails.getUniqueId());
HttpPost httpPost = createPostAddArtifactRequeast(jsonStr, url, true);
CloseableHttpResponse result = httpclient.execute(httpPost);
int status = result.getStatusLine().getStatusCode();
@@ -406,22 +396,18 @@ public class DownloadComponentArt extends ComponentBaseTest {
addArtifactDataFromResponse(result, origArtifact);
String artifactId = origArtifact.getUniqueId();
- url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(),
- serviceDetails.getUniqueId(), artifactId);
+ url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceDetails.getUniqueId(), artifactId);
HttpGet httpGet = createGetRequest(url);
CloseableHttpResponse response2 = httpclient.execute(httpGet);
status = response2.getStatusLine().getStatusCode();
AssertJUnit.assertEquals("failed to download artifact", 200, status);
InputStream inputStream = response2.getEntity().getContent();
ArtifactUiDownloadData artifactUiDownloadData = getArtifactUiDownloadData(IOUtils.toString(inputStream));
- AssertJUnit.assertEquals("Downloaded payload is different from uploaded one", UPLOAD_ARTIFACT_PAYLOAD,
- artifactUiDownloadData.getBase64Contents());
- AssertJUnit.assertEquals("Downloaded artifact name is different from uploaded one", UPLOAD_ARTIFACT_NAME,
- artifactUiDownloadData.getArtifactName());
+ AssertJUnit.assertEquals("Downloaded payload is different from uploaded one", UPLOAD_ARTIFACT_PAYLOAD, artifactUiDownloadData.getBase64Contents());
+ AssertJUnit.assertEquals("Downloaded artifact name is different from uploaded one", UPLOAD_ARTIFACT_NAME, artifactUiDownloadData.getArtifactName());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = AuditValidationUtils
- .constructFieldsForAuditValidation(serviceDetails, serviceDetails.getVersion(), sdncUserDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = AuditValidationUtils.constructFieldsForAuditValidation(serviceDetails, serviceDetails.getVersion(), sdncUserDetails);
String auditAction = "ArtifactDownload";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setPrevState("");
@@ -432,14 +418,12 @@ public class DownloadComponentArt extends ComponentBaseTest {
expectedResourceAuditJavaObject.setArtifactData(AuditValidationUtils.buildArtifactDataAudit(origArtifact));
expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
expectedResourceAuditJavaObject.setPrevArtifactUuid("");
-
+
AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null, false);
} finally {
- // RestResponse response =
- // ServiceRestUtils.deleteService(serviceDetails, serviceVersion,
- // sdncUserDetails );
- // checkDeleteResponse(response);
+// RestResponse response = ServiceRestUtils.deleteService(serviceDetails, serviceVersion, sdncUserDetails );
+// checkDeleteResponse(response);
httpclient.close();
}
}
@@ -455,9 +439,8 @@ public class DownloadComponentArt extends ComponentBaseTest {
ArtifactDefinition origArtifact = new ArtifactDefinition();
origArtifact.setUniqueId(artifactIdNotFound);
-
- String url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(),
- config.getCatalogBePort(), resourceId, artifactIdNotFound);
+
+ String url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId, artifactIdNotFound);
HttpGet httpGet = createGetRequest(url);
CloseableHttpResponse response = httpclient.execute(httpGet);
int status = response.getStatusLine().getStatusCode();
@@ -465,8 +448,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
// validate audit
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
- .constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), sdncUserDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), sdncUserDetails);
String auditAction = "ArtifactDownload";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setPrevState("");
@@ -495,8 +477,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
ArtifactDefinition origArtifact = new ArtifactDefinition();
origArtifact.setUniqueId(artifactIdNotFound);
- String url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(),
- config.getCatalogBePort(), serviceDetails.getUniqueId(), artifactIdNotFound);
+ String url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceDetails.getUniqueId(), artifactIdNotFound);
HttpGet httpGet = createGetRequest(url);
CloseableHttpResponse response2 = httpclient.execute(httpGet);
int status = response2.getStatusLine().getStatusCode();
@@ -504,8 +485,7 @@ public class DownloadComponentArt extends ComponentBaseTest {
// validate audit
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ServiceValidationUtils
- .constructFieldsForAuditValidation(serviceDetails, serviceDetails.getVersion(), sdncUserDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails, serviceDetails.getVersion(), sdncUserDetails);
String auditAction = "ArtifactDownload";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setPrevState("");
@@ -529,11 +509,9 @@ public class DownloadComponentArt extends ComponentBaseTest {
ArtifactReqDetails defaultArtifact = ElementFactory.getDefaultArtifact();
- RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(defaultArtifact, sdncUserDetails,
- resourceDetails.getUniqueId());
+ RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(defaultArtifact, sdncUserDetails, resourceDetails.getUniqueId());
int status = response.getErrorCode();
- AssertJUnit.assertEquals("add informational artifact request returned status: " + response.getErrorCode(), 200,
- status);
+ AssertJUnit.assertEquals("add informational artifact request returned status: " + response.getErrorCode(), 200, status);
RestResponse resourceResp = ResourceRestUtils.getResource(resourceDetails.getUniqueId());
Resource resource = ResponseParser.convertResourceResponseToJavaObject(resourceResp.getResponse());
@@ -549,7 +527,8 @@ public class DownloadComponentArt extends ComponentBaseTest {
}
AssertJUnit.assertTrue(isExist);
}
-
+
+
protected String createUploadArtifactBodyJson() {
Map<String, Object> jsonBody = new HashMap<String, Object>();
jsonBody.put("artifactName", UPLOAD_ARTIFACT_NAME);
@@ -561,12 +540,12 @@ public class DownloadComponentArt extends ComponentBaseTest {
jsonBody.put("artifactLabel", "configure");
return gson.toJson(jsonBody);
}
-
+
protected ArtifactDefinition getArtifactDataFromJson(String json) {
Gson gson = new Gson();
JsonObject jsonElement = new JsonObject();
jsonElement = gson.fromJson(json, jsonElement.getClass());
- ArtifactDefinition artifact = new ArtifactDefinition();
+ ArtifactDefinition artifact = new ArtifactDefinition();
String payload = null;
JsonElement artifactPayload = jsonElement.get(Constants.ARTIFACT_PAYLOAD_DATA);
if (artifactPayload != null && !artifactPayload.isJsonNull()) {
@@ -575,18 +554,17 @@ public class DownloadComponentArt extends ComponentBaseTest {
jsonElement.remove(Constants.ARTIFACT_PAYLOAD_DATA);
artifact = gson.fromJson(jsonElement, ArtifactDefinition.class);
artifact.setPayloadData(payload);
-
- /*
- * atifact.setArtifactName(UPLOAD_ARTIFACT_NAME);
- * artifact.setArtifactDisplayName("configure");
- * artifact.setArtifactType("SHELL"); artifact.setMandatory(false);
- * artifact.setDescription("ff");
- * artifact.setPayloadData(UPLOAD_ARTIFACT_PAYLOAD);
- * artifact.setArtifactLabel("configure");
- */
+
+ /*atifact.setArtifactName(UPLOAD_ARTIFACT_NAME);
+artifact.setArtifactDisplayName("configure");
+artifact.setArtifactType("SHELL");
+artifact.setMandatory(false);
+artifact.setDescription("ff");
+artifact.setPayloadData(UPLOAD_ARTIFACT_PAYLOAD);
+artifact.setArtifactLabel("configure");*/
return artifact;
}
-
+
protected HttpGet createGetRequest(String url) {
HttpGet httpGet = new HttpGet(url);
httpGet.addHeader(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
@@ -594,53 +572,49 @@ public class DownloadComponentArt extends ComponentBaseTest {
httpGet.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
return httpGet;
}
-
+
protected String getArtifactUid(HttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
String artifactId = (String) responseMap.get("uniqueId");
return artifactId;
}
-
+
protected String getArtifactEsId(HttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
String esId = (String) responseMap.get("EsId");
return esId;
}
-
- protected ArtifactDefinition addArtifactDataFromResponse(HttpResponse response, ArtifactDefinition artifact)
- throws HttpResponseException, IOException, ParseException {
- // String responseString = new
- // BasicResponseHandler().handleResponse(response);
+
+ protected ArtifactDefinition addArtifactDataFromResponse(HttpResponse response, ArtifactDefinition artifact) throws HttpResponseException, IOException, ParseException {
+ //String responseString = new BasicResponseHandler().handleResponse(response);
HttpEntity entity = response.getEntity();
- String responseString = EntityUtils.toString(entity);
+ String responseString = EntityUtils.toString(entity);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
- artifact.setEsId((String) responseMap.get("esId"));
+ artifact.setEsId((String)responseMap.get("esId"));
artifact.setUniqueId((String) responseMap.get("uniqueId"));
artifact.setArtifactGroupType(ArtifactGroupTypeEnum.findType((String) responseMap.get("artifactGroupType")));
artifact.setTimeout(((Long) responseMap.get("timeout")).intValue());
return artifact;
}
-
- protected String getLifecycleArtifactUid(CloseableHttpResponse response)
- throws HttpResponseException, IOException, ParseException {
+
+ protected String getLifecycleArtifactUid(CloseableHttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
responseMap = (JSONObject) responseMap.get("implementation");
String artifactId = (String) responseMap.get("uniqueId");
return artifactId;
}
-
+
protected HttpDelete createDeleteArtifactRequest(String url) {
HttpDelete httpDelete = new HttpDelete(url);
httpDelete.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
httpDelete.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
return httpDelete;
}
-
- protected HttpPost createPostAddArtifactRequeast(String jsonBody, String url, boolean addMd5Header)
- throws UnsupportedEncodingException {
+
+ protected HttpPost createPostAddArtifactRequeast(String jsonBody, String url, boolean addMd5Header) throws UnsupportedEncodingException {
HttpPost httppost = new HttpPost(url);
httppost.addHeader(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
@@ -651,10 +625,10 @@ public class DownloadComponentArt extends ComponentBaseTest {
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
httppost.setEntity(input);
- log.debug("Executing request {}", httppost.getRequestLine());
+ log.debug("Executing request {}" , httppost.getRequestLine());
return httppost;
}
-
+
protected String createLoadArtifactBody() {
Map<String, Object> json = new HashMap<String, Object>();
json.put("artifactName", "install_apache2.sh");
@@ -662,21 +636,20 @@ public class DownloadComponentArt extends ComponentBaseTest {
json.put("description", "ddd");
json.put("payloadData", "UEsDBAoAAAAIAAeLb0bDQz");
json.put("artifactLabel", "name123");
-
+
String jsonStr = gson.toJson(json);
return jsonStr;
}
-
+
protected void checkDeleteResponse(RestResponse response) {
BaseRestUtils.checkStatusCode(response, "delete request failed", false, 204, 404);
}
-
+
protected ArtifactUiDownloadData getArtifactUiDownloadData(String artifactUiDownloadDataStr) throws Exception {
-
+
ObjectMapper mapper = new ObjectMapper();
try {
- ArtifactUiDownloadData artifactUiDownloadData = mapper.readValue(artifactUiDownloadDataStr,
- ArtifactUiDownloadData.class);
+ ArtifactUiDownloadData artifactUiDownloadData = mapper.readValue(artifactUiDownloadDataStr, ArtifactUiDownloadData.class);
return artifactUiDownloadData;
} catch (Exception e) {
e.printStackTrace();
@@ -684,4 +657,5 @@ public class DownloadComponentArt extends ComponentBaseTest {
return null;
}
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
new file mode 100644
index 0000000000..2ca09b36f3
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
@@ -0,0 +1,331 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.artifacts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.HeatParameterDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.heat.HeatParameterType;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+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.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
+
+import com.google.gson.Gson;
+
+public class HeatEnvArtifact extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public HeatEnvArtifact() {
+ super(name, HeatEnvArtifact.class.getName());
+ }
+
+ @Test(enabled = true)
+ public void heatEnvOnResourceFormatTest() throws Exception {
+
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csarHeatEnv.csar");
+ assertNotNull(createdResource);
+
+ RestResponse certifyState = LifecycleRestUtils.changeComponentState(createdResource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(certifyState);
+
+ Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(certifyState.getResponse(), Resource.class);
+
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+
+ // 2 create service
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // 3 create vf instance in service
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(certifiedResource);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+
+ ComponentInstance vfi = componentInstances.get(0);
+ Map<String, ArtifactDefinition> deploymentArtifacts = vfi.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+ assertEquals(4, deploymentArtifacts.size());
+ ArtifactDefinition heatEnv = deploymentArtifacts.get("heat0env");
+ assertNotNull(heatEnv);
+
+ Map<String, Object> yaml = downloadComponentInstanceYamlFile(service.getUniqueId(), vfi.getUniqueId(), sdncModifierDetails, heatEnv.getUniqueId());
+ assertNotNull(yaml);
+ Map<String, Object> paramters = (Map<String, Object>) yaml.get("parameters");
+ assertNotNull(paramters);
+ assertEquals(8, paramters.size());
+ assertEquals(null, paramters.get("param8"));
+ List<HeatParameterDefinition> heatParameters = heatEnv.getListHeatParameters();
+ heatParameters.forEach(p -> {
+ assertEquals(p.getCurrentValue(), paramters.get(p.getName()));
+ });
+ }
+
+ @Test(enabled = true)
+ public void noHeatEnvOnResourceFormatTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csarHeatNoEnv.csar");
+ assertNotNull(createdResource);
+
+ RestResponse certifyState = LifecycleRestUtils.changeComponentState(createdResource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(certifyState);
+
+ Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(certifyState.getResponse(), Resource.class);
+
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+
+ // 2 create service
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // 3 create vf instance in service
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(certifiedResource);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+
+ ComponentInstance vfi = componentInstances.get(0);
+ Map<String, ArtifactDefinition> deploymentArtifacts = vfi.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+ assertEquals(4, deploymentArtifacts.size());
+ ArtifactDefinition heatEnv = deploymentArtifacts.get("heat0env");
+ assertNotNull(heatEnv);
+
+ Map<String, Object> yaml = downloadComponentInstanceYamlFile(service.getUniqueId(), vfi.getUniqueId(), sdncModifierDetails, heatEnv.getUniqueId());
+ assertNotNull(yaml);
+ Map<String, Object> paramters = (Map<String, Object>) yaml.get("parameters");
+ assertNotNull(paramters);
+ assertEquals(8, paramters.size());
+ assertEquals(null, paramters.get("param1"));
+ assertEquals(null, paramters.get("param2"));
+ assertEquals(null, paramters.get("param4"));
+ assertEquals(null, paramters.get("param5"));
+ assertEquals(null, paramters.get("param7"));
+ assertEquals(null, paramters.get("param8"));
+ List<HeatParameterDefinition> heatParameters = heatEnv.getListHeatParameters();
+ heatParameters.forEach(p -> {
+ assertEquals(p.getCurrentValue(), paramters.get(p.getName()));
+ });
+
+ }
+
+ @DataProvider(name = "vfModuleCsar")
+ public static Object[][] csarNames() {
+ return new Object[][] { { "VSPPackage" }, { "csar_1" }, { "csarHeatEnv.csar" } };
+ }
+
+ @Test(dataProvider = "vfModuleCsar")
+ public void heatEnvOnVfDownloadNoChangesTest(String vfName) throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ System.out.println("Run for vf " + vfName);
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, vfName);
+ assertNotNull(createdResource);
+ Map<String, ArtifactDefinition> deploymentArtifacts = createdResource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+
+ for (ArtifactDefinition artifact : deploymentArtifacts.values()) {
+ if (artifact.getArtifactType().equals("HEAT")) {
+
+ ArtifactDefinition heatArtifact = artifact;
+ assertNotNull(heatArtifact);
+
+ ArtifactDefinition heatEnvArtifact = deploymentArtifacts.get(artifact.getArtifactLabel() + "env");
+ assertNotNull(heatEnvArtifact);
+
+ String heatEnvId = heatEnvArtifact.getUniqueId();
+ downloadHeatEnvAndValidate(sdncModifierDetails, createdResource, heatArtifact, heatEnvId);
+ }
+ }
+ System.out.println("Finished for vf " + vfName);
+
+ }
+
+ private void downloadHeatEnvAndValidate(User sdncModifierDetails, Resource createdResource, ArtifactDefinition heatArtifact, String heatEnvId) throws Exception {
+ RestResponse downloadResult = ArtifactRestUtils.downloadResourceArtifactInternalApi(createdResource.getUniqueId(), sdncModifierDetails, heatEnvId);
+ BaseRestUtils.checkSuccess(downloadResult);
+
+ ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(downloadResult.getResponse(), ArtifactUiDownloadData.class);
+ byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
+ byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+ Yaml yaml = new Yaml();
+
+ InputStream inputStream = new ByteArrayInputStream(decodeBase64);
+
+ Map<String, Object> load = (Map<String, Object>) yaml.load(inputStream);
+ Map<String, Object> paramters = (Map<String, Object>) load.get("parameters");
+ assertNotNull(paramters);
+
+ List<HeatParameterDefinition> heatParameters = heatArtifact.getListHeatParameters();
+ assertNotNull(heatParameters);
+ assertEquals("Validate heat parameters size", heatParameters.size(), paramters.size());
+ Gson gson = new Gson();
+ heatParameters.forEach(hpInResource -> {
+ Object valueInFile = paramters.get(hpInResource.getName());
+ Object valueInResource;
+ if (hpInResource.getCurrentValue() == null) {
+ valueInResource = hpInResource.getDefaultValue();
+ } else {
+ valueInResource = hpInResource.getCurrentValue();
+ }
+ if (valueInResource == null) {
+ assertEquals("Validate null value for parameter " + hpInResource.getName(), valueInResource, valueInFile);
+ } else {
+ HeatParameterType type = HeatParameterType.isValidType(hpInResource.getType());
+ // if (type != null && (HeatParameterType.JSON == type || HeatParameterType.COMMA_DELIMITED_LIST == type)){
+ // String jsonValue = gson.toJson(valueInFile).toString();
+ //
+ // assertEquals("Validate value as json string for parameter " +hpInResource.getName() ,valueInResource, jsonValue);
+ // }else{
+ assertEquals("Validate value for parameter " + hpInResource.getName(), valueInResource, valueInFile.toString());
+ // }
+ }
+ });
+ }
+
+ @Test(enabled = true)
+ public void heatEnvOnVfFailedTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csar_1");
+ assertNotNull(createdResource);
+ Map<String, ArtifactDefinition> deploymentArtifacts = createdResource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+ String heatEnvId = "wrongId";
+ RestResponse downloadResult = ArtifactRestUtils.downloadResourceArtifactInternalApi(createdResource.getUniqueId(), sdncModifierDetails, heatEnvId);
+
+ assertEquals("Validate error code", 404, downloadResult.getErrorCode().intValue());
+
+ // BaseRestUtils.checkErrorResponse(downloadResult, ActionStatus.ARTIFACT_NOT_FOUND);
+
+ }
+
+ @Test(dataProvider = "vfModuleCsar")
+ public void heatEnvOnVfDownloadChangeParamTest(String vfName) throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, vfName);
+ assertNotNull(createdResource);
+ Map<String, ArtifactDefinition> deploymentArtifacts = createdResource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+
+ ArtifactDefinition heatArt = deploymentArtifacts.get("heat0");
+ assertNotNull(heatArt);
+
+ List<HeatParameterDefinition> heatParameters = heatArt.getListHeatParameters();
+ assertNotNull(heatParameters);
+ HeatParameterDefinition paramForChange = null;
+ for (HeatParameterDefinition hp : heatParameters) {
+ if (hp.getType().equals("string")) {
+ paramForChange = hp;
+ break;
+ }
+ }
+ assertNotNull(paramForChange);
+ paramForChange.setCurrentValue("newValueForTest");
+ RestResponse updateResult = ArtifactRestUtils.updateDeploymentArtifactToResource(heatArt, sdncModifierDetails, createdResource.getUniqueId());
+ BaseRestUtils.checkSuccess(updateResult);
+
+ RestResponse getResourceResult = ResourceRestUtils.getResource(createdResource.getUniqueId());
+ BaseRestUtils.checkSuccess(getResourceResult);
+
+ Resource resource = ResponseParser.convertResourceResponseToJavaObject(getResourceResult.getResponse());
+ assertNotNull(resource);
+ deploymentArtifacts = resource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+
+ heatArt = deploymentArtifacts.get("heat0");
+ assertNotNull(heatArt);
+ ArtifactDefinition heatEnvArt = deploymentArtifacts.get("heat0env");
+ assertNotNull(heatEnvArt);
+
+ downloadHeatEnvAndValidate(sdncModifierDetails, createdResource, heatArt, heatEnvArt.getUniqueId());
+
+ }
+
+ // ****************************************
+ private Map<String, Object> downloadComponentInstanceYamlFile(String serviceUniqueId, String resourceInstanceId, User user, String artifactUniqeId) throws Exception {
+ RestResponse heatEnvDownloadResponse = ArtifactRestUtils.downloadResourceInstanceArtifact(serviceUniqueId, resourceInstanceId, user, artifactUniqeId);
+ BaseRestUtils.checkSuccess(heatEnvDownloadResponse);
+
+ ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(heatEnvDownloadResponse.getResponse(), ArtifactUiDownloadData.class);
+ byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
+ byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+ Yaml yaml = new Yaml();
+
+ InputStream inputStream = new ByteArrayInputStream(decodeBase64);
+
+ Map<String, Object> load = (Map<String, Object>) yaml.load(inputStream);
+
+ return load;
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
index 02bef89f2c..2e7b6ea4af 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java
@@ -39,15 +39,20 @@ import org.javatuples.Pair;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Product;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
@@ -63,11 +68,14 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.exception.ResponseFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
@@ -486,7 +494,7 @@ public class PlaceHolderValidations extends ComponentBaseTest {
RestResponse delteArtifactFromResource = ArtifactRestUtils.deleteInformationalArtifactFromResource(
resourceDetails1.getUniqueId(), heatArtifactDetails, sdncDesignerDetails2);
- logger.debug("addInformationalArtifactToResource response: {}", delteArtifactFromResource.getResponseMessage());
+ logger.debug("addInformationalArtifactToResource response: {} ",delteArtifactFromResource.getResponseMessage());
assertTrue("response code is not 200, returned :" + delteArtifactFromResource.getErrorCode(),
delteArtifactFromResource.getErrorCode() == 200);
@@ -685,7 +693,7 @@ public class PlaceHolderValidations extends ComponentBaseTest {
String sourceDir = config.getResourceConfigDir();
String testResourcesPath = sourceDir + File.separator + folderName;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- logger.debug("listFileName: {}", listFileName.toString());
+ logger.debug("listFileName: {}",listFileName.toString());
String payload = FileUtils.loadPayloadFile(listFileName, ext, true);
ArtifactReqDetails updateArtifactReqDetails = ElementFactory.getDefaultDeploymentArtifactForType(artType);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
index 01169630a4..abbaa3050d 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java
@@ -34,6 +34,7 @@ import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.operations.impl.AllOperationsUtil;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -315,7 +316,7 @@ public class ValidateArtResponse extends ComponentBaseTest {
ArtifactDefinition ArtifactDefinitionRespJavaObject = ResponseParser
.convertArtifactDefinitionResponseToJavaObject(updateInformationalArtifactToResource.getResponse());
- List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getHeatParameters();
+ List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getListHeatParameters();
for (HeatParameterDefinition heatParameterDefinition : heatParameters) {
String verify = updateValueParam;
AssertJUnit.assertTrue("verification failed", verify.equals(heatParameterDefinition.getCurrentValue()));
@@ -389,7 +390,7 @@ public class ValidateArtResponse extends ComponentBaseTest {
ArtifactDefinition ArtifactDefinitionRespJavaObject = ResponseParser
.convertArtifactDefinitionResponseToJavaObject(updateInformationalArtifactToResource.getResponse());
- List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getHeatParameters();
+ List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getListHeatParameters();
for (HeatParameterDefinition heatParameterDefinition : heatParameters) {
String verify = updateValueParam;
AssertJUnit.assertTrue("verification failed", verify.equals(heatParameterDefinition.getCurrentValue()));
@@ -461,7 +462,7 @@ public class ValidateArtResponse extends ComponentBaseTest {
// verify change in update response
ArtifactDefinition ArtifactDefinitionRespJavaObject = ResponseParser
.convertArtifactDefinitionResponseToJavaObject(updateInformationalArtifactToResource.getResponse());
- List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getHeatParameters();
+ List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getListHeatParameters();
for (HeatParameterDefinition heatParameterDefinition : heatParameters) {
// String verify = updateValueParam;
if (heatParameterDefinition.getDefaultValue() != null) {
@@ -541,7 +542,7 @@ public class ValidateArtResponse extends ComponentBaseTest {
ArtifactDefinition ArtifactDefinitionRespJavaObject = ResponseParser
.convertArtifactDefinitionResponseToJavaObject(updateInformationalArtifactToResource.getResponse());
- List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getHeatParameters();
+ List<HeatParameterDefinition> heatParameters = ArtifactDefinitionRespJavaObject.getListHeatParameters();
for (HeatParameterDefinition heatParameterDefinition : heatParameters) {
String verify = updateValueParam;
AssertJUnit.assertTrue("verification failed", verify.equals(heatParameterDefinition.getCurrentValue()));
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsFromUI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsFromUI.java
deleted file mode 100644
index c22dcb96d4..0000000000
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsFromUI.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.ci.tests.execute.artifacts;
-
-//
-//import java.util.Arrays;
-//import java.util.List;
-//
-//import org.junit.Rule;
-//import org.junit.rules.TestName;
-//import org.testng.AssertJUnit;
-//import org.testng.annotations.Test;
-//
-//import org.openecomp.sdc.be.dao.api.ActionStatus;
-//import org.openecomp.sdc.be.model.ArtifactDefinition;
-//import org.openecomp.sdc.be.model.ComponentInstance;
-//import org.openecomp.sdc.be.model.HeatParameterDefinition;
-//import org.openecomp.sdc.be.model.Resource;
-//import org.openecomp.sdc.be.model.Service;
-//import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-//import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
-//import org.openecomp.sdc.ci.tests.datatypes.enums.RespJsonKeysEnum;
-//import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-//import org.openecomp.sdc.ci.tests.preRequisites.HeatEnvBaseTest;
-//import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
-//import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
-//import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
-//import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
-//import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
-//import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
-//
-//public class ValidateHeatArtFieldsFromUI extends HeatEnvBaseTest {
-public class ValidateHeatArtFieldsFromUI {
- //
- //
- //
- // private static final String heatExtension = "yaml";
- // private static final String yangXmlExtension = "xml";
- // private static final String muranoPkgExtension = "zip";
- // private final String folderName= "yamlFieldsValidation";
- //
- //
- // private final String uuidString =
- // RespJsonKeysEnum.UUID.getRespJsonKeyName().toString();
- //
- // public ValidateHeatArtFieldsFromUI() {
- // super(name, ValidateHeatArtFieldsFromUI.class.getName());
- // }
- //
- // @Rule
- // public static TestName name = new TestName();
- //
- //
- // @Test
- // public void heatEnvValidateHeatArtFiledTypes_UpdateFailed() throws
- // Exception {
- //
- // //get relevant service
- // RestResponse serviceGetResponse =
- // ServiceRestUtils.getService(serviceDetails2, sdncDesignerDetails);
- // Service service =
- // ResponseParser.convertServiceResponseToJavaObject(serviceGetResponse.getResponse());
- // List<ComponentInstance> resourceInstances =
- // service.getComponentInstances();
- // ComponentInstance resourceInstance = resourceInstances.get(0);
- //
- //
- // String defaultParam = null;
- //
- // //update heatEnv with invalid value in number field
- //
- // ArtifactDefinition artifact = getCurrentArtifactDefinitionFromService();
- // String currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "home_number", "Tel Aviv");
- // ArtifactReqDetails artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // RestResponse res = ArtifactRestUtils.updateDeploymentArtifactToRI(artReq,
- // sdncDesignerDetails, resourceInstance.getUniqueId(),
- // service.getUniqueId());
- //
- // // validate negative response
- // List<String> variables = Arrays.asList("HEAT_ENV", "number",
- // "home_number");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- // artifact = getCurrentArtifactDefinitionFromService();
- // String currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "home_number");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- //
- // //update heatEnv with invalid value in boolean field
- //
- // artifact = getCurrentArtifactDefinitionFromService();
- // currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "private_building", "Tel Aviv");
- // artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // res = ArtifactRestUtils.updateDeploymentArtifactToRI(artReq,
- // sdncDesignerDetails, resourceInstance.getUniqueId(),
- // service.getUniqueId());
- //
- // // validate negative response
- // variables = Arrays.asList("HEAT_ENV", "boolean", "private_building");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- // artifact = getCurrentArtifactDefinitionFromService();
- // currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "private_building");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- //
- //
- //
- //
- // //update heatEnv with invalid value in boolean field
- //
- // artifact = getCurrentArtifactDefinitionFromService();
- // currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "city_name", "\uC2B5");
- // artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // res = ArtifactRestUtils.updateDeploymentArtifactToRI(artReq,
- // sdncDesignerDetails, resourceInstance.getUniqueId(),
- // service.getUniqueId());
- // // validate negative response
- // variables = Arrays.asList("HEAT_ENV", "string", "city_name");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromService();
- // currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "city_name");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- // }
- //
- // @Test
- // public void heatValidateHeatArtFiledTypes_UpdateFailed() throws Exception
- // {
- //
- //
- // RestResponse checkOutResponse =
- // LifecycleRestUtils.changeResourceState(resourceSC, sdncDesignerDetails,
- // LifeCycleStatesEnum.CHECKOUT);
- // AssertJUnit.assertTrue("response code is not 200, returned: " +
- // checkOutResponse.getErrorCode(),checkOutResponse.getErrorCode() == 200);
- // //get relevant service
- // RestResponse resourceGetResponse =
- // ResourceRestUtils.getResource(resourceSC, sdncDesignerDetails);
- // Resource resource =
- // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
- //
- // //update heatEnv with invalid value in number field
- //
- // ArtifactDefinition artifact = getCurrentArtifactDefinitionFromResource();
- // String currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "home_number", "Tel Aviv");
- // ArtifactReqDetails artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // RestResponse res =
- // ArtifactRestUtils.updateInformationalArtifactToResource(artReq,
- // sdncDesignerDetails, resource.getUniqueId());
- // // validate negative response
- // List<String> variables = Arrays.asList("HEAT", "number", "home_number");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- // String currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "home_number");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- //
- //
- // //update heatEnv with invalid value in boolean field
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- // currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "private_building", "Tel Aviv");
- // artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // res = ArtifactRestUtils.updateDeploymentArtifactToResource(artReq,
- // sdncDesignerDetails, resource.getUniqueId());
- // // validate negative response
- // variables = Arrays.asList("HEAT", "boolean", "private_building");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- //
- // currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "private_building");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- //
- //
- // //update heatEnv with invalid value in boolean field
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- // currentHeatEnvParamBeforeUpdate = replaceHeatParamsValue(artifact,
- // "city_name", "\uC2B5");
- //
- // artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // res = ArtifactRestUtils.updateDeploymentArtifactToResource(artReq,
- // sdncDesignerDetails, resource.getUniqueId());
- // // validate negative response
- // variables = Arrays.asList("HEAT", "string", "city_name");
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_HEAT_PARAMETER_VALUE.name(),
- // variables, res.getResponse());
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- // currentHeatEnvParamAfterUpdate = getHeatParamsValue(artifact,
- // "city_name");
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBeforeUpdate,
- // currentHeatEnvParamBeforeUpdate.equals(currentHeatEnvParamAfterUpdate));
- //
- // }
- //
- // @Test
- // public void heatEnvValidateHeatArtFiledTypes_boolNormalization_suc()
- // throws Exception {
- //
- // //get relevant service
- // RestResponse serviceGetResponse =
- // ServiceRestUtils.getService(serviceDetails2, sdncDesignerDetails);
- // Service service =
- // ResponseParser.convertServiceResponseToJavaObject(serviceGetResponse.getResponse());
- // List<ComponentInstance> resourceInstances =
- // service.getComponentInstances();
- // ComponentInstance resourceInstance = resourceInstances.get(0);
- //
- // String defaultParam = null;
- // String currentHeatEnvParamBefore = null;
- // String currentHeatEnvParamAfter = null;
- //
- //
- // List<String> listOfBoolValuesToValidate = Arrays.asList("T", "on", "1",
- // "yes", "y");
- //
- // for (String element : listOfBoolValuesToValidate) {
- //
- // //update heatEnv with invalid value in boolean field
- //
- // ArtifactDefinition artifact = getCurrentArtifactDefinitionFromService();
- // List<HeatParameterDefinition> heatParameters =
- // artifact.getHeatParameters();
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals("private_building")){
- // defaultParam = param.getDefaultValue();
- // currentHeatEnvParamBefore = param.getCurrentValue();
- // param.setCurrentValue(element);
- // }
- // }
- // artifact.setHeatParameters(heatParameters);
- // ArtifactReqDetails artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // RestResponse res = ArtifactRestUtils.updateDeploymentArtifactToRI(artReq,
- // sdncDesignerDetails, resourceInstance.getUniqueId(),
- // service.getUniqueId());
- // AssertJUnit.assertTrue("response code is not 200, returned: " +
- // res.getErrorCode(), res.getErrorCode() == 200);
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromService();
- // heatParameters = artifact.getHeatParameters();
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals("private_building")){
- // currentHeatEnvParamAfter = param.getCurrentValue();
- // }
- // }
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBefore, currentHeatEnvParamAfter.equals("true"));
- //
- // }
- //
- // }
- //
- //
- // @Test
- // public void heatValidateHeatArtFiledTypes_boolNormalization_suc() throws
- // Exception {
- //
- // RestResponse checkOutResponse =
- // LifecycleRestUtils.changeResourceState(resourceSC, sdncDesignerDetails,
- // LifeCycleStatesEnum.CHECKOUT);
- // AssertJUnit.assertTrue("response code is not 200, returned: " +
- // checkOutResponse.getErrorCode(),checkOutResponse.getErrorCode() == 200);
- // //get relevant service
- // RestResponse resourceGetResponse =
- // ResourceRestUtils.getResource(resourceSC, sdncDesignerDetails);
- // Resource resource =
- // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
- //
- //
- // String defaultParam = null;
- // String currentHeatEnvParamBefore = null;
- // String currentHeatEnvParamAfter = null;
- //
- //
- // List<String> listOfBoolValuesToValidate = Arrays.asList("T", "on", "1",
- // "yes", "y");
- //
- // for (String element : listOfBoolValuesToValidate) {
- //
- // //update heatEnv with invalid value in boolean field
- //
- // ArtifactDefinition artifact = getCurrentArtifactDefinitionFromResource();
- // List<HeatParameterDefinition> heatParameters =
- // artifact.getHeatParameters();
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals("private_building")){
- // defaultParam = param.getDefaultValue();
- // currentHeatEnvParamBefore = param.getCurrentValue();
- // param.setCurrentValue(element);
- // }
- // }
- // artifact.setHeatParameters(heatParameters);
- // ArtifactReqDetails artReq =
- // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifact);
- // RestResponse res =
- // ArtifactRestUtils.updateInformationalArtifactToResource(artReq,
- // sdncDesignerDetails, resource.getUniqueId());
- // AssertJUnit.assertTrue("response code is not 200, returned: " +
- // res.getErrorCode(), res.getErrorCode() == 200);
- //
- // //validate current value not affected
- //
- // artifact = getCurrentArtifactDefinitionFromResource();
- // heatParameters = artifact.getHeatParameters();
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals("private_building")){
- // currentHeatEnvParamAfter = param.getCurrentValue();
- // }
- // }
- // AssertJUnit.assertTrue("HeatEnvParam was not updated: " +
- // currentHeatEnvParamBefore, currentHeatEnvParamAfter.equals("true"));
- //
- // }
- //
- // }
- //
- //
- // private ArtifactDefinition getCurrentArtifactDefinitionFromResource()
- // throws Exception {
- //
- // RestResponse resourceGetResponse =
- // ResourceRestUtils.getResource(resourceSC, sdncDesignerDetails);
- // Resource resource =
- // ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
- //
- // ArtifactDefinition artifactDefinition =
- // resource.getDeploymentArtifacts().get("heat");
- //
- //
- // return artifactDefinition;
- //
- // }
- //
- //
- // private ArtifactDefinition getCurrentArtifactDefinitionFromService()
- // throws Exception {
- //
- // RestResponse serviceGetResponse =
- // ServiceRestUtils.getService(serviceDetails2, sdncDesignerDetails);
- // Service service =
- // ResponseParser.convertServiceResponseToJavaObject(serviceGetResponse.getResponse());
- // ArtifactDefinition artifactDefinition = new ArtifactDefinition();
- // artifactDefinition =
- // service.getComponentInstances().get(0).getDeploymentArtifacts().get("heatenv");
- //
- //
- // return artifactDefinition;
- //
- // }
- //
- // private String replaceHeatParamsValue(ArtifactDefinition artifact, String
- // paramName, String paramValue) {
- // String defaultParam;
- // String currentHeatEnvParam = null;
- // List<HeatParameterDefinition> heatParameters =
- // artifact.getHeatParameters();
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals(paramName)){
- // defaultParam = param.getDefaultValue();
- // currentHeatEnvParam = param.getCurrentValue();
- // param.setCurrentValue(paramValue);
- // }
- // }
- // artifact.setHeatParameters(heatParameters);
- // return currentHeatEnvParam;
- // }
- //
- // private String getHeatParamsValue(ArtifactDefinition artifact,
- // String paramName) {
- // List<HeatParameterDefinition> heatParameters =
- // artifact.getHeatParameters();
- // String currentHeatEnvParamValue = null;
- // for(HeatParameterDefinition param : heatParameters){
- // if (param.getName().equals(paramName)){
- // currentHeatEnvParamValue = param.getCurrentValue();
- // }
- // }
- // return currentHeatEnvParamValue;
- // }
-}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
index 09cda0b73c..a00fceba49 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java
@@ -103,7 +103,7 @@ public class ValidateHeatArtFieldsTypes extends ComponentBaseTest {
response.getErrorCode() == 200);
ArtifactDefinition artifactDefinitionJavaObject = ResponseParser
.convertArtifactDefinitionResponseToJavaObject(response.getResponse());
- List<HeatParameterDefinition> heatParameters = artifactDefinitionJavaObject.getHeatParameters();
+ List<HeatParameterDefinition> heatParameters = artifactDefinitionJavaObject.getListHeatParameters();
String currentValue = null;
for (HeatParameterDefinition heatParameterDefinition : heatParameters) {
if (heatParameterDefinition.getName().equals("city_name")) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
index 58e27177d1..d1b6ff5676 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/attribute/ComponentInstanceAttributeTest.java
@@ -59,23 +59,34 @@ public class ComponentInstanceAttributeTest extends ComponentBaseTest {
public void testUpdateAttributeOnResourceInstance() {
// Prepare VF with vfc instance with Attributes
String testResourcesPath = config.getResourceConfigDir() + File.separator + "importToscaResourceByCreateUrl";
- final Resource vfcWithAttributes = AtomicOperationUtils.importResource(testResourcesPath, "CPWithAttributes.yml").left().value();
- swallowException(() -> AtomicOperationUtils.changeComponentState(vfcWithAttributes, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, false));
- Resource vf = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, false).left().value();
- ComponentInstance vfcInstance = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfcWithAttributes, vf).left().value();
+ final Resource vfcWithAttributes = AtomicOperationUtils
+ .importResource(testResourcesPath, "CPWithAttributes.yml").left().value();
+ swallowException(() -> AtomicOperationUtils.changeComponentState(vfcWithAttributes, UserRoleEnum.DESIGNER,
+ LifeCycleStatesEnum.CHECKIN, false));
+ Resource vf = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, false)
+ .left().value();
+ ComponentInstance vfcInstance = AtomicOperationUtils
+ .addComponentInstanceToComponentContainer(vfcWithAttributes, vf).left().value();
// util method to get the specific attribute from the vf
- Function<Resource, ComponentInstanceAttribute> attributeGetter = resourceVf -> resourceVf.getComponentInstancesAttributes().values().iterator().next().stream().filter(att -> att.getName().equals("private_address")).findAny().get();
+ Function<Resource, ComponentInstanceAttribute> attributeGetter = resourceVf -> resourceVf
+ .getComponentInstancesAttributes().values().iterator().next().stream()
+ .filter(att -> att.getName().equals("private_address")).findAny().get();
// update attribute on vfc instance
- final Resource vfWithInsatncePreUpdate = swallowException(() -> (Resource) AtomicOperationUtils.getCompoenntObject(vf, UserRoleEnum.DESIGNER));
+ final Resource vfWithInsatncePreUpdate = swallowException(
+ () -> (Resource) AtomicOperationUtils.getCompoenntObject(vf, UserRoleEnum.DESIGNER));
ComponentInstanceAttribute attributeOfRI = attributeGetter.apply(vfWithInsatncePreUpdate);
final String newAttValue = "NewValue";
attributeOfRI.setValue(newAttValue);
String body = gson.toJson(attributeOfRI);
- String url = String.format(Urls.UPDATE_ATTRIBUTE_ON_RESOURCE_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(ComponentTypeEnum.RESOURCE), vf.getUniqueId(), vfcInstance.getUniqueId());
- swallowException(() -> BaseRestUtils.sendPost(url, body, UserRoleEnum.DESIGNER.getUserId(), BaseRestUtils.acceptHeaderData));
+ String url = String.format(Urls.UPDATE_ATTRIBUTE_ON_RESOURCE_INSTANCE, config.getCatalogBeHost(),
+ config.getCatalogBePort(), ComponentTypeEnum.findParamByType(ComponentTypeEnum.RESOURCE),
+ vf.getUniqueId(), vfcInstance.getUniqueId());
+ swallowException(() -> BaseRestUtils.sendPost(url, body, UserRoleEnum.DESIGNER.getUserId(),
+ BaseRestUtils.acceptHeaderData));
// Retrieve updated vf and verify attribute was updated
- final Resource vfWithInsatncePostUpdate = swallowException(() -> (Resource) AtomicOperationUtils.getCompoenntObject(vf, UserRoleEnum.DESIGNER));
+ final Resource vfWithInsatncePostUpdate = swallowException(
+ () -> (Resource) AtomicOperationUtils.getCompoenntObject(vf, UserRoleEnum.DESIGNER));
ComponentInstanceAttribute updatedAttribute = attributeGetter.apply(vfWithInsatncePostUpdate);
assertEquals(updatedAttribute.getValue(), newAttValue);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
index d9df79350b..86641eb2c7 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
@@ -48,6 +49,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
index a3ee121611..3b85c052a1 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java
@@ -54,6 +54,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
@@ -61,6 +62,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.CategoryValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -2235,6 +2237,18 @@ public class CategoriesTests extends CategoriesBaseTest {
checkAuditSuccess(PRODUCT_COMPONENT_TYPE);
}
+ // @Test
+ // public void getAllResourceCategories_generalError() throws Exception
+ // {
+ // User user = new User();
+ // RestResponse getAllCategoriesRest =
+ // CategoryRestUtils.getAllCategories(user, SERVICE_COMPONENT_TYPE);
+ // assertEquals("Check response code after get Category", 500,
+ // getAllCategoriesRest.getErrorCode().intValue());
+ // Utils.checkBodyResponseOnError(ActionStatus.GENERAL_ERROR.name(), new
+ // ArrayList<String>(), getAllCategoriesRest.getResponse());
+ // }
+
//////////////////////////////////////////////////////////////////////////////
@Test
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
index 7f30f8ca92..2f48f4fa1e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java
@@ -26,6 +26,7 @@ import static org.testng.AssertJUnit.assertNotNull;
import java.util.HashMap;
import java.util.Map;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
index 7858b3259f..f6b6113b99 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java
@@ -32,6 +32,9 @@ import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RE
import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
import static org.testng.AssertJUnit.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -44,6 +47,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
index dd96ebfc2f..dcc3172d59 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java
@@ -47,6 +47,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
index 418e8f6dc8..7e8d5cf8cc 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
@@ -22,7 +22,9 @@ package org.openecomp.sdc.ci.tests.execute.devCI;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.http.HttpEntity;
@@ -35,13 +37,19 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.util.EntityUtils;
+import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig.Feature;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.openecomp.sdc.be.config.BeEcompErrorManager;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
@@ -54,10 +62,11 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceDetailedAssetStructure;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
@@ -68,13 +77,13 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
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.rest.ArtifactRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
import org.openecomp.sdc.common.util.GeneralUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,9 +95,13 @@ import org.testng.annotations.Test;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import com.relevantcodes.extentreports.LogStatus;
import fj.data.Either;
+
+import static java.util.Arrays.asList;
+
public class CRUDExternalAPI extends ComponentBaseTest {
private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
@@ -99,781 +112,3254 @@ public class CRUDExternalAPI extends ComponentBaseTest {
protected String contentTypeHeaderData = "application/json";
protected String acceptHeaderDate = "application/json";
+
+
protected Gson gson = new Gson();
protected JSONParser jsonParser = new JSONParser();
+
protected String serviceVersion;
protected ResourceReqDetails resourceDetails;
protected User sdncUserDetails;
protected ServiceReqDetails serviceDetails;
+
@BeforeMethod
- public void init() throws Exception {
+ public void init() throws Exception{
AtomicOperationUtils.createDefaultConsumer(true);
}
-
- @Rule
+
+
+ @Rule
public static TestName name = new TestName();
public CRUDExternalAPI() {
super(name, CRUDExternalAPI.class.getName());
}
+
+
+
+ @DataProvider(name="uploadArtifactOnVfcVlCpViaExternalAPI")
+ public static Object[][] dataProviderUploadArtifactOnVfcVlCpViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+ };
+ }
+
- @DataProvider(name = "uploadArtifactOnVFViaExternalAPI")
+
+ // External API
+ // Upload artifact on VFC, VL, CP via external API - happy flow
+ @Test(dataProvider="uploadArtifactOnVfcVlCpViaExternalAPI")
+ public void uploadArtifactOnVfcVlCpViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s, resourceTypeEnum: %s", chosenLifeCycleState, artifactType, resourceTypeEnum));
+ uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @DataProvider(name="uploadArtifactOnVFViaExternalAPI")
public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPI() {
- return new Object[][] { { LifeCycleStatesEnum.CHECKIN, "DCAE_JSON" },
- { LifeCycleStatesEnum.CHECKOUT, "DCAE_POLICY" }, { LifeCycleStatesEnum.CHECKOUT, "DCAE_EVENT" },
- { LifeCycleStatesEnum.CHECKOUT, "APPC_CONFIG" }, { LifeCycleStatesEnum.CHECKOUT, "DCAE_DOC" },
- { LifeCycleStatesEnum.CHECKOUT, "DCAE_TOSCA" }, { LifeCycleStatesEnum.CHECKOUT, "YANG_XML" },
- { LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG" }, { LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE" },
- { LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE" },
- { LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE" },
- { LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC" }, { LifeCycleStatesEnum.CHECKOUT, "OTHER" } };
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKOUT, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKIN, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"}
+ };
}
+
+
// External API
// Upload artifact on VF via external API - happy flow
- @Test(dataProvider = "uploadArtifactOnVFViaExternalAPI")
- public void uploadArtifactOnVFViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType)
- throws Exception {
- // Method passed variable
- // artifactType = "YANG_XML";
- // chosenLifeCycleState = LifeCycleStatesEnum.CHECKOUT;
+ @Test(dataProvider="uploadArtifactOnVFViaExternalAPI")
+ public void uploadArtifactOnVFViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, chosenLifeCycleState, artifactType, null);
+ }
+
+
+
+
+
+ @DataProvider(name="uploadArtifactOnServiceViaExternalAPI")
+ public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"}
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="uploadArtifactOnServiceViaExternalAPI")
+ public void uploadArtifactOnServiceViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, chosenLifeCycleState, artifactType, null);
+ }
+
+
+ @DataProvider(name="uploadArtifactOnServiceViaExternalAPIIncludingDistribution")
+ public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPIIncludingDistribution() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ };
+ }
+
+ @Test(dataProvider="uploadArtifactOnServiceViaExternalAPIIncludingDistribution")
+ public void uploadArtifactOnServiceViaExternalAPIIncludingDistribution(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, chosenLifeCycleState, artifactType, null);
+
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ if(config.getIsDistributionClientRunning()){
+ List<String> distributionStatusList = Arrays.asList(DistributionNotificationStatusEnum.DOWNLOAD_OK.toString(), DistributionNotificationStatusEnum.DEPLOY_OK.toString(), DistributionNotificationStatusEnum.NOTIFIED.toString());
+ DistributionValidationUtils.validateDistributedArtifactsByAudit((Service)component, distributionStatusList);
+ }
+ }
+
+
+ // Happy flow - get chosen life cycle state, artifact type and asset type
+ // Create asset, upload artifact via external API + check audit & response code
+ // Download artifact via external API + check audit & response code
+ protected Component uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ Component component = null;
+ RestResponse restResponse;
+ int numberOfArtifact = 0;
+
+ // get artifact data
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, false);
+
+ // create component/s & upload artifact via external api
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+
+ component = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, resourceTypeEnum);
+ restResponse = uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+
+ if((LifeCycleStatesEnum.CERTIFICATIONREQUEST == chosenLifeCycleState) && (!component.getComponentType().toString().equals(ComponentTypeEnum.RESOURCE.toString()))) {
+ numberOfArtifact = (component.getComponentInstances().get(0).getDeploymentArtifacts() == null ? 0 : component.getComponentInstances().get(0).getDeploymentArtifacts().size()) + 1;
+ } else {
+ numberOfArtifact = (component.getComponentInstances().get(0).getDeploymentArtifacts() == null ? 0 : component.getComponentInstances().get(0).getDeploymentArtifacts().size()) + 1;
+ }
+ } else {
+ component = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, resourceTypeEnum);
+
+ restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+ numberOfArtifact = component.getDeploymentArtifacts().size() + 1;
+ }
+
+
+
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+ component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+
+ // Get list of deployment artifact + download them via external API
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be increase by one.");
+
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
+
+ return component;
+ }
+
+ // Upload artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse uploadArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, resourceDetails.getComponentInstances().get(0));
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+ expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts");
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+
+
+ protected Component getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum lifeCycleStatesEnum, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ Component component;
+ if(resourceTypeEnum == ResourceTypeEnum.VF) {
+ component = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+
+ Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, null);
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+
+ // Add artifact to service if asked for certifcationrequest - must be at least one artifact for the flow
+ if((LifeCycleStatesEnum.CERTIFICATIONREQUEST == lifeCycleStatesEnum) || (LifeCycleStatesEnum.STARTCERTIFICATION == lifeCycleStatesEnum)) {
+ }
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, component, UserRoleEnum.DESIGNER, true, true).left().value();
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
+ } else {
+ component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+ Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, resourceTypeEnum);
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, lifeCycleStatesEnum, true).getLeft();
+ }
+
+
+ return component;
+ }
+
+
+
+
+ // Upload artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails, sdncModifierDetails, artifactReqDetails);
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+
+ // Check Component version (increase by one if not in checkout)
+ // Input: component, componentLifeCycleState
+ // for any LifeCycleState != checkout
+ // find component of version +0.1
+ // check that this version different for input version
+ // check that this component uniqueID different from input uniqueID
+ // Return: that version
+ protected Component getNewerVersionOfComponent(Component component, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+ Component resourceDetails = null;
+
+ if((!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKOUT)) && (!lifeCycleStatesEnum.equals(LifeCycleStatesEnum.STARTCERTIFICATION))) {
+
+
+ String resourceVersion = component.getVersion();
+ String resourceUniqueID = component.getUniqueId();
+
+ if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+ resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
+ } else {
+ resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), String.format("%.1f", Double.parseDouble(component.getVersion()) + 0.1));
+ }
+
+ String resourceNewVersion = resourceDetails.getVersion();
+ String resourceNewUniqueID = resourceDetails.getUniqueId();
+
+ System.out.println(resourceNewVersion);
+ System.out.println("Service UUID: " + resourceDetails.getUUID());
+ System.out.println("Service UniqueID: " + resourceDetails.getUniqueId());
+
+ // Checking that new version exist + different from old one by unique id
+ Assert.assertNotEquals(resourceVersion, resourceNewVersion, "Expected for diffrent resource version.");
+ Assert.assertNotEquals(resourceUniqueID, resourceNewUniqueID, "Expected that resource will have new unique ID.");
+ } else {
+ if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+ resourceDetails = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+ } else {
+ resourceDetails = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+ }
+ }
+ return resourceDetails;
+ }
+
+
+
+
+
+ // download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
+ protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component resourceDetails, ArtifactDefinition artifactDefinition, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, ComponentTypeEnum componentTypeEnum) throws Exception {
+ RestResponse restResponse;
+
+ if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+ restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getComponentType().toString());
+ } else {
+ restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceDetails.getUUID(), artifactDefinition.getArtifactUUID(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getComponentType().toString());
+ }
+
+ Integer responseCode = restResponse.getErrorCode();
+ Integer expectedCode = 200;
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
+
+
+ // For known artifact/payload - verify payload of downloaded artfaict
+ if (artifactReqDetails != null) {
+ String response = restResponse.getResponse();
+ String payloadData = artifactReqDetails.getPayload();
+ String decodedPaypload = org.openecomp.sdc.ci.tests.utils.Decoder.decode(payloadData);
+
+ Assert.assertEquals(response, decodedPaypload, "Response artifact payload not correct.");
+ }
+
+ //TODO - including body - resourceDetails.getName()
+// // Verify audit
+// String auditAction = "DownloadArtifact";
+//
+// Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+// body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+// body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+//
+// ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+// expectedResourceAuditJavaObject.setAction(auditAction);
+// expectedResourceAuditJavaObject.setResourceType(resourceDetails.getComponentType().getValue());
+// expectedResourceAuditJavaObject.setStatus("200");
+// expectedResourceAuditJavaObject.setDesc("OK");
+// expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
+//
+// if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+// expectedResourceAuditJavaObject.setResourceName(resourceDetails.getComponentInstances().get(0).getName());
+// String resource_url = String.format("/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s", resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID());
+// expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
+//
+// AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
+// } else {
+// expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName());
+// String resource_url = String.format("/asdc/v1/catalog/services/%s/artifacts/%s", resourceDetails.getUUID(), artifactDefinition.getArtifactUUID());
+// expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
+// }
+//
+// AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
+
+ return restResponse;
+
+ }
+
+ // download deployment via external api + check response code for success (200) + verify audit
+ protected void downloadResourceDeploymentArtifactExternalAPI(Component resourceDetails, ArtifactDefinition artifactDefinition, User sdncModifierDetails) throws Exception {
+ downloadResourceDeploymentArtifactExternalAPI(resourceDetails, artifactDefinition, sdncModifierDetails, null, resourceDetails.getComponentType());
+ }
+
+
+
+
+
+
+
+
+
+ @DataProvider(name="uploadArtifactOnRIViaExternalAPI")
+ public static Object[][] dataProviderUploadArtifactOnRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT"},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL"},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP"},
+
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT"},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL"},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP"},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP"}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="uploadArtifactOnRIViaExternalAPI")
+ public void uploadArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, null);
+ }
+
+
+
+ @DataProvider(name="uploadArtifactOnVfcVlCpRIViaExternalAPI")
+ public static Object[][] dataProviderUploadArtifactOnVfcVlCpRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="uploadArtifactOnVfcVlCpRIViaExternalAPI")
+ public void uploadArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType, resourceTypeEnum);
+ }
+
+
+
+
+ @DataProvider(name="uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+ public static Object[][] dataProviderUploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
+ return new Object[][] {
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidTypeEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidTypeEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidNameEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidLabelEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidDescriptionEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithSameLabel"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithSameLabel"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "uploadArtifactWithInvalidCheckSum"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "uploadArtifactWithInvalidCheckSum"},
+ };
+ }
+
+
+
+
+ // InvalidArtifact + check audit & response code function
+ @Test(dataProvider="uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+ public void uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
+ ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
+ Component resourceDetails;
+ ComponentInstance componentResourceInstanceDetails = null;
+ ArtifactReqDetails artifactReqDetails;
+
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+ resourceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.SERVICE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+ resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(chosenLifeCycleState, null);
+ componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+ } else {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+
+ resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, chosenLifeCycleState, null);
+ }
+
+
+ switch (uploadArtifactTestType) {
+ case "uploadArtifactWithInvalidTypeToLong":
+ uploadArtifactWithInvalidTypeToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidTypeEmpty":
+ uploadArtifactWithInvalidTypeEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidCheckSum":
+ uploadArtifactWithInvalidCheckSum(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidNameToLong":
+ uploadArtifactWithInvalidNameToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidNameEmpty":
+ uploadArtifactWithInvalidNameEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidLabelToLong":
+ uploadArtifactWithInvalidLabelToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidLabelEmpty":
+ uploadArtifactWithInvalidLabelEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidDescriptionToLong":
+ uploadArtifactWithInvalidDescriptionToLong(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithInvalidDescriptionEmpty":
+ uploadArtifactWithInvalidDescriptionEmpty(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ case "uploadArtifactWithSameLabel":
+ default:
+ uploadArtifactWithSameLabel(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ break;
+ }
+ }
+
+ // Upload artifact with invalid type via external API - to long type
+ protected void uploadArtifactWithInvalidTypeToLong(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+ artifactReqDetails.setArtifactType("dsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfdsdsfdsfds");
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
+ List<String> variables = asList(artifactReqDetails.getArtifactType());
+
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+ // Upload artifact with invalid type via external API - empty type
+ protected void uploadArtifactWithInvalidTypeEmpty(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+ artifactReqDetails.setArtifactType("");
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_TYPE_NOT_SUPPORTED.name());
+ List<String> variables = asList(artifactReqDetails.getArtifactType());
+
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+ // Upload artifact with invalid checksum via external API
+ protected void uploadArtifactWithInvalidCheckSum(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
+ List<String> variables = asList();
+ uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables);
+ }
+
+
+ // Upload artifact with valid type & invalid name via external API - name to long
+ protected void uploadArtifactWithInvalidNameToLong(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+ List<String> variables = asList("artifact name", "255");
+ artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+ // Upload artifact with valid type & invalid name via external API - name is empty
+ protected void uploadArtifactWithInvalidNameEmpty(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
+ List<String> variables = asList();
+
+ artifactReqDetails.setArtifactName("");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+ // Upload artifact with valid type & invalid label via external API - label to long
+ protected void uploadArtifactWithInvalidLabelToLong(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+ List<String> variables = asList("artifact label", "25");
+ artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+ // Upload artifact with valid type & invalid label via external API - label is empty
+ protected void uploadArtifactWithInvalidLabelEmpty(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+ List<String> variables = asList("artifact label");
+ artifactReqDetails.setArtifactLabel("");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+ // Upload artifact with invalid description via external API - to long description
+ protected void uploadArtifactWithInvalidDescriptionToLong(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+ List<String> variables = asList("artifact description", "256");
+ artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+ // Upload artifact with invalid description via external API - empty description
+ protected void uploadArtifactWithInvalidDescriptionEmpty(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+ List<String> variables = asList("artifact description");
+ artifactReqDetails.setDescription("");
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+
+
+ // Upload artifact with same label via external API
+ protected void uploadArtifactWithSameLabel(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ ComponentInstance componentResourceInstanceDetails) throws Exception {
+
+ RestResponse restResponse = null;
+ if(componentResourceInstanceDetails != null) {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ } else {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
- // String operationType = "Upload";
- UserRoleEnum creatorUser = UserRoleEnum.DESIGNER;
- String specificUser = "DESIGNER";
+ }
+
+ ArtifactDefinition artifactDefinition = getArtifactDataFromJson(restResponse.getResponse());
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_EXIST.name());
+
+ List<String> variables = asList(artifactDefinition.getArtifactDisplayName());
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables, null);
+ }
+
+
+
+
+
+
+
+
+ protected RestResponse uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ Integer expectedResponseCode, ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+ RestResponse restResponse;
+
+ if(componentResourceInstanceDetails != null) {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resourceDetails, sdncModifierDetails, artifactReqDetails, componentResourceInstanceDetails);
+ } else {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails, sdncModifierDetails, artifactReqDetails);
- Component resourceDetails = getComponentInTargetLifeCycleState("vf", creatorUser, chosenLifeCycleState);
+ }
+
+ // validate response code
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+// ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+
+ responseArtifact.setUpdaterFullName("");
+ responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, resourceDetails.getUUID(), errorInfo, variables);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ expectedExternalAudit.setRESOURCE_TYPE(resourceDetails.getComponentType().getValue());
+ expectedExternalAudit.setARTIFACT_DATA(null);
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+ if(componentResourceInstanceDetails != null) {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + resourceDetails.getComponentInstances().get(0).getNormalizedName() + "/artifacts");
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ } else {
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ }
+
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);
+
+ return restResponse;
+
+ }
- String resourceUUID = resourceDetails.getUUID();
- System.out.println("Resource UUID: " + resourceUUID);
+
+
+
+
+
+ protected RestResponse uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails,
+ Integer expectedResponseCode, ComponentInstance componentResourceInstanceDetails, ErrorInfo errorInfo, List<String> variables) throws Exception {
+ RestResponse restResponse;
+
+ if(componentResourceInstanceDetails != null) {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfComponentInstanceOnAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentResourceInstanceDetails);
+ } else {
+ restResponse = ArtifactRestUtils.externalAPIUploadArtifactWithInvalidCheckSumOfTheAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
- // get artifact data
- ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("Abcd", artifactType, true);
+ }
+
+ // validate response code
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+ // Check auditing for upload operation
+// ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.DEPLOYMENT_ARTIFACT_NAME_ALREADY_EXISTS.name());
+// = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+// List<String> variables = asList("artifact name", "255");
+
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+// ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+
+ responseArtifact.setUpdaterFullName("");
+ responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, resourceDetails.getUUID(), errorInfo, variables);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ expectedExternalAudit.setRESOURCE_TYPE(resourceDetails.getComponentType().getValue());
+ expectedExternalAudit.setARTIFACT_DATA(null);
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+ if(componentResourceInstanceDetails != null) {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + resourceDetails.getComponentInstances().get(0).getNormalizedName() + "/artifacts");
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ } else {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ }
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), body);
+
+ return restResponse;
+
+ }
+
+
+
+
+
+
+
+
+ @DataProvider(name="uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public static Object[][] dataProviderUploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
+ return new Object[][] {
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},
+ };
+ }
+
+
+ // External API
+ // Upload artifact by diffrent user then creator of asset - Fail
+ @Test(dataProvider="uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public void uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum));
+ Component resourceDetails;
+ ComponentInstance componentResourceInstanceDetails = null;
+ ArtifactReqDetails artifactReqDetails;
+
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+ resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(lifeCycleStatesEnum, null);
+ componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+ } else {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
+
+ resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, lifeCycleStatesEnum, null);
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+ List<String> variables = asList();
+
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(userRoleEnum),
+ artifactReqDetails, 409, componentResourceInstanceDetails, errorInfo, variables, lifeCycleStatesEnum);
+
+ if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CHECKIN)) {
+ performeClean();
+ }
+ }
+
+
+
+
+
+ @DataProvider(name="uploadArtifactOnAssetWhichNotExist")
+ public static Object[][] dataProviderUploadArtifactOnAssetWhichNotExist() {
+ return new Object[][] {
+ {ComponentTypeEnum.SERVICE},
+ {ComponentTypeEnum.RESOURCE},
+ {ComponentTypeEnum.RESOURCE_INSTANCE},
+ };
+ }
+
- RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.valueOf(specificUser.toUpperCase())), artifactReqDetails);
+ // External API
+ // Upload artifact on VF via external API - happy flow
+ @Test(dataProvider="uploadArtifactOnAssetWhichNotExist")
+ public void uploadArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
+ Component resourceDetails;
+ ComponentInstance componentResourceInstanceDetails = null;
+ ArtifactReqDetails artifactReqDetails;
+
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+ resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum.CHECKIN, null);
+ componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+
+ resourceDetails.setUUID("12345");
+ componentResourceInstanceDetails.setNormalizedName("12345");
+ } else {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", "OTHER", true, false);
+
+ resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, null);
+
+ resourceDetails.setUUID("12345");
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+ List<String> variables = asList("null");
+
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 404, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.CHECKIN);
+
+ performeClean();
+
+ }
+
+
+ @DataProvider(name="uploadArtifactOnAssetWhichInInvalidStateForUploading")
+ public static Object[][] dataProviderUploadArtifactOnAssetWhichInInvalidStateForUploading() {
+ return new Object[][] {
+ {ComponentTypeEnum.SERVICE},
+ {ComponentTypeEnum.RESOURCE},
+ {ComponentTypeEnum.RESOURCE_INSTANCE},
+ };
+ }
+
+
+ @Test(dataProvider="uploadArtifactOnAssetWhichInInvalidStateForUploading")
+ public void uploadArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s", componentTypeEnum));
+ Component resourceDetails;
+ ComponentInstance componentResourceInstanceDetails = null;
+ ArtifactReqDetails artifactReqDetails;
+
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString(), true, false);
+
+ resourceDetails = getComponentWithResourceInstanceInTargetLifeCycleState(LifeCycleStatesEnum.STARTCERTIFICATION, null);
+ componentResourceInstanceDetails = resourceDetails.getComponentInstances().get(0);
+ } else {
+ artifactReqDetails = ElementFactory.getArtifactByType("Abcd", ArtifactTypeEnum.OTHER.toString(), true, false);
- Integer responseCode = restResponse.getErrorCode();
- Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
+ resourceDetails = getComponentInTargetLifeCycleState(componentTypeEnum.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, null);
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+ List<String> variables = asList(resourceDetails.getName(), resourceDetails.getComponentType().toString().toLowerCase(), resourceDetails.getLastUpdaterFullName().split(" ")[0],
+ resourceDetails.getLastUpdaterFullName().split(" ")[1], resourceDetails.getLastUpdaterUserId());
+
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ artifactReqDetails, 403, componentResourceInstanceDetails, errorInfo, variables, LifeCycleStatesEnum.STARTCERTIFICATION);
+
+ performeClean();
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ // Update External API //
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+
+ @DataProvider(name="updateArtifactForServiceViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactForServiceViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"},
+ {LifeCycleStatesEnum.CERTIFY, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFY, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFY, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFY, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFY, "OTHER"}
+ };
+ }
+
+
+
+
+ // Update artifact for Service - Success
+ @Test(dataProvider="updateArtifactForServiceViaExternalAPI")
+ public void updateArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum, artifactType);
+
+ // for certify version check that previous version exist, and that it artifact can be download + checksum
+ if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.SERVICE);
+ }
+ }
+
+ @DataProvider(name="updateArtifactForVFViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactForVFViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKOUT, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKIN, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"}
+ };
+ }
+
+
+ // Update artifact for VF - Success
+ @Test(dataProvider="updateArtifactForVFViaExternalAPI")
+ public void updateArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
+
+ // for certify version check that previous version exist, and that it artifact can be download + checksum
+ if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
+ }
+ }
+
+ @DataProvider(name="updateArtifactForVfcVlCpViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactForVfcVlCpViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+ };
+ }
+
+
+ // Update artifact for VFC/VL/CP - Success
+ @Test(dataProvider="updateArtifactForVfcVlCpViaExternalAPI")
+ public void updateArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum, artifactType);
+
+ // for certify version check that previous version exist, and that it artifact can be download + checksum
+ if(lifeCycleStatesEnum.equals(LifeCycleStatesEnum.CERTIFY)) {
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE);
+ }
+ }
+
+ @DataProvider(name="updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
+ return new Object[][] {
+ {ResourceTypeEnum.VFC},
+ {ResourceTypeEnum.VL},
+ {ResourceTypeEnum.CP}
+ };
+ }
+
+
+ // Verify that it cannot update VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
+ @Test(dataProvider="updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+ public void updateArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
+
+ Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", "SNMP_TRAP", true, false);
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+ resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+ Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+ component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
+ String artifactUUID = null;
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+ List<String> variables = asList(artifactUUID);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", errorInfo, variables, UserRoleEnum.DESIGNER, 404);
- // ArtifactDefinition artifactJavaObject =
- // ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
- // AuditingActionEnum action =
- // AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
- // ExpectedExternalAudit expectedExternalAudit =
- // ElementFactory.getDefaultExternalArtifactAuditSuccess(AssetTypeEnum.RESOURCES,
- // action, artifactJavaObject, resourceUUID);
- // AuditValidationUtils.validateExternalAudit(expectedExternalAudit,
- // AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), null);
}
+
+
+
+
+
+ @DataProvider(name="updateArtifactOnRIViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactOnRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", null},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", null},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VF}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="updateArtifactOnRIViaExternalAPI")
+ public void updateArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
+
+ // for certify version check that previous version exist, and that it artifact can be download + checksum
+ if(chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
+ }
+ }
+
+
+
+
+
+
+
+ @DataProvider(name="updateArtifactOnVfcVlCpRIViaExternalAPI")
+ public static Object[][] dataProviderUpdateArtifactOnVfcVlCpRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="updateArtifactOnVfcVlCpRIViaExternalAPI")
+ public void updateArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ updateArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState, artifactType);
+
+
+ // for certify version check that previous version exist, and that it artifact can be download + checksum
+ if(chosenLifeCycleState.equals(LifeCycleStatesEnum.CERTIFY)) {
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(component, artifactType, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE_INSTANCE);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+ @DataProvider(name="updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public static Object[][] dataProviderUpdateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
+ return new Object[][] {
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+ };
+ }
+
- @DataProvider(name = "uploadArtifactOnServiceViaExternalAPI")
- public static Object[][] dataProviderUploadArtifactOnServiceViaExternalAPI() {
+
+ // External API
+ // Update artifact by diffrent user then creator of asset - Fail
+ @Test(dataProvider="updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public void updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, userRoleEnum: %s, lifeCycleStatesEnum: %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+ List<String> variables = asList();
+ updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, lifeCycleStatesEnum, artifactType, errorInfo, variables, userRoleEnum, 409);
+ }
+
+
+ @DataProvider(name="updateArtifactOnAssetWhichNotExist")
+ public static Object[][] dataProviderUpdateArtifactOnAssetWhichNotExist() {
return new Object[][] {
- // {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
- // {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
- // {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
- // {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
- // {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
- { LifeCycleStatesEnum.CHECKIN, "YANG_XML" }, { LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG" },
- { LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE" },
- { LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC" }, { LifeCycleStatesEnum.CHECKIN, "OTHER" },
- { LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML" },
- { LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG" },
- { LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE" },
- { LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC" },
- { LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER" } };
- }
-
- @Test(dataProvider = "uploadArtifactOnServiceViaExternalAPI")
- public void uploadArtifactOnServiceViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType)
- throws Exception {
- Component resourceDetails = getComponentInTargetLifeCycleState("service", UserRoleEnum.DESIGNER,
- chosenLifeCycleState);
- double resourceVersion = Double.parseDouble(resourceDetails.getVersion());
+ {ComponentTypeEnum.SERVICE, "OTHER", null},
+ {ComponentTypeEnum.RESOURCE, "OTHER", null},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VF},
+ };
+ }
+
- // get artifact data
- ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("Abcd", artifactType, true);
- System.out.println("Service UUID: " + resourceDetails.getUUID());
- System.out.println("Service Version: " + resourceVersion);
- System.out.println("Service life cycle state: " + chosenLifeCycleState);
- System.out.println("Artifact Type: " + artifactReqDetails.getArtifactType());
+ // External API
+ // Upload artifact on VF via external API - happy flow
+ @Test(dataProvider="updateArtifactOnAssetWhichNotExist")
+ public void updateArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
+
+ // get updated artifact data
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
+ String artifactUUID = deploymentArtifacts.get(artifactReqDetails.getArtifactLabel()).getArtifactUUID();
+
+ // Invalid artifactUUID
+ String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+ List<String> variables = asList(invalidArtifactUUID);
+
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, component.getComponentInstances().get(0), artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, null, artifactReqDetails, invalidArtifactUUID, errorInfo, variables, null);
- RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails);
+ }
+
+ // Invalid componentUUID
+// errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+// variables = asList("null");
+
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
+
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
+
+ variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN);
+ } else {
+ component.setUUID("invalidComponentUUID");
+
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+ variables = asList("null");
+
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, null, artifactReqDetails, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN);
+ }
+ }
+
+
+ @DataProvider(name="updateArtifactOnAssetWhichInInvalidStateForUploading")
+ public static Object[][] dataProviderUpdateProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
+ return new Object[][] {
+// {ComponentTypeEnum.SERVICE, "OTHER"},
+// {ComponentTypeEnum.RESOURCE, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, "DCAE_INVENTORY_TOSCA"},
+ };
+ }
+
+
+ @Test(dataProvider="updateArtifactOnAssetWhichInInvalidStateForUploading")
+ public void updateArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+ List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
+ updateArtifactOnAssetViaExternalAPI(component, componentTypeEnum, LifeCycleStatesEnum.STARTCERTIFICATION, artifactType, errorInfo, variables, UserRoleEnum.DESIGNER, 403);
+
+ }
+
+
+
+
+
+ @DataProvider(name="updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+ public static Object[][] dataProviderUpdateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI() {
+ return new Object[][] {
+// {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidCheckSum"},
+// {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidCheckSum"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidNameEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidNameEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidLabelEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidLabelEmpty"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionToLong"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionToLong"},
+
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKOUT, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CHECKIN, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.SERVICE, "updateArtifactWithInvalidDescriptionEmpty"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, ComponentTypeEnum.RESOURCE_INSTANCE, "updateArtifactWithInvalidDescriptionEmpty"},
+ };
+ }
+
+
+
+
+ // InvalidArtifact + check audit & response code function
+ @Test(dataProvider="updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI")
+ public void updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState,
+ ComponentTypeEnum componentTypeEnum, String uploadArtifactTestType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, componentTypeEnum: %s, uploadArtifactTestType: %s", chosenLifeCycleState, componentTypeEnum, uploadArtifactTestType));
+ Component component;
+ ComponentInstance componentInstance = null;
+ String artifactType;
+
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ artifactType = ArtifactTypeEnum.DCAE_INVENTORY_DOC.toString();
+ component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+ componentInstance = component.getComponentInstances().get(0);
+ } else {
+ artifactType = ArtifactTypeEnum.OTHER.toString();
+ component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, null);
+ }
+
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+
+ switch (uploadArtifactTestType) {
+ case "updateArtifactWithInvalidCheckSum":
+ updateArtifactWithInvalidCheckSum(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidNameToLong":
+ updateArtifactWithInvalidNameToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidNameEmpty":
+ updateArtifactWithInvalidNameEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidLabelToLong":
+ updateArtifactWithInvalidLabelToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidLabelEmpty":
+ updateArtifactWithInvalidLabelEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidDescriptionToLong":
+ updateArtifactWithInvalidDescriptionToLong(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ case "updateArtifactWithInvalidDescriptionEmpty":
+ default:
+ updateArtifactWithInvalidDescriptionEmpty(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactType, componentInstance);
+ break;
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+// // TODO: there is defect when checking invalid type
+//// // Upload artifact with invalid type via external API
+//// // invalid type
+//// String artifactType = artifactReqDetails.getArtifactType();
+//// artifactReqDetails.setArtifactType("invalidType");
+//// restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 400, componentResourceInstanceDetails);
+//// // empty type
+//// artifactReqDetails.setArtifactType("");
+//// restResponse = uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 400, componentResourceInstanceDetails);
+//// artifactReqDetails.setArtifactType(artifactType);
+///////////////////////////////////////////////////////////////////////////////
+ }
+
+ // TODO
+ // Update artifact with invalid checksum via external API
+ protected void updateArtifactWithInvalidCheckSum(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_INVALID_MD5.name());
+ List<String> variables = asList();
+// uploadArtifactWithInvalidCheckSumOfAssetIncludingValiditionOfAuditAndResponseCode(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+// artifactReqDetails, 400, componentResourceInstanceDetails, errorInfo, variables);
+ }
+
+
+ // Update artifact with valid type & invalid name via external API - name to long
+ protected void updateArtifactWithInvalidNameToLong(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.EXCEEDS_LIMIT.name());
+ List<String> variables = asList("artifact name", "255");
+ artifactReqDetails.setArtifactName("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
- // Check response of external API
- Integer responseCode = restResponse.getErrorCode();
- Integer expectedCode = 200;
- Assert.assertEquals(responseCode, expectedCode, "Response code is not correct.");
-
- // TODO: Check auditing for upload opeartion
- // ArtifactDefinition artifactJavaObject =
- // ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
- // AuditingActionEnum action =
- // AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
- // ExpectedExternalAudit expectedExternalAudit =
- // ElementFactory.getDefaultExternalArtifactAuditSuccess(AssetTypeEnum.RESOURCES,
- // action, artifactJavaObject, resourceUUID);
- // AuditValidationUtils.validateExternalAudit(expectedExternalAudit,
- // AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), null);
-
- // Check Service version (increase by one if not in checkout)
- if (!chosenLifeCycleState.equals(LifeCycleStatesEnum.CHECKOUT)) {
- double resourceNewVersion = Double.parseDouble(resourceDetails.getVersion());
-
- System.out.println(resourceVersion);
- System.out.println(resourceNewVersion);
}
}
+
+
+ // Update artifact with valid type & invalid name via external API - name is empty
+ protected void updateArtifactWithInvalidNameEmpty(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_ARTIFACT_NAME.name());
+ List<String> variables = asList();
+ artifactReqDetails.setArtifactName("");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
- @Test
- public void artifactOperationOnRIViaExternalAPI() throws Exception {
- // Method passed variable
- String operationType = "Upload";
- LifeCycleStatesEnum chosenLifeCycleState = LifeCycleStatesEnum.CHECKOUT;
- UserRoleEnum creatorUser = UserRoleEnum.DESIGNER;
- String specificUser = "DESIGNER";
- String artifactType = "OTHER";
+ }
+ }
+
+
+ // Update artifact with valid type & invalid label via external API - label to long
+ protected void updateArtifactWithInvalidLabelToLong(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED.name());
+ List<String> variables = asList();
+ artifactReqDetails.setArtifactLabel("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
- Component resourceDetails = getComponentInTargetLifeCycleState("service", creatorUser, chosenLifeCycleState);
- Component resourceInstanceDetails = getComponentInTargetLifeCycleState("vf", creatorUser, chosenLifeCycleState);
- ComponentInstance componentResourceInstanceDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(resourceInstanceDetails, resourceDetails,
- UserRoleEnum.DESIGNER, true)
- .left().value();
+ }
+ }
+
+
+ // Update artifact with valid type & invalid label via external API - label is empty
+ protected void updateArtifactWithInvalidLabelEmpty(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_DATA.name());
+ List<String> variables = asList("artifact label");
+ artifactReqDetails.setArtifactLabel("");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
- String resourceUUID = resourceDetails.getUUID();
- System.out.println("Resource UUID: " + resourceUUID);
+ }
+ }
+
+
+ // Update artifact with invalid description via external API - to long description
+ protected void updateArtifactWithInvalidDescriptionToLong(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED.name());
+ List<String> variables = asList();
+ artifactReqDetails.setDescription("invalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeinvalGGfdsiofhdsouhfoidshfoidshoifhsdoifhdsouihfdsofhiufdsghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidTypeghiufghodhfioudsgafodsgaiofudsghifudsiugfhiufawsouipfhgawseiupfsadiughdfsoiuhgfaighfpasdghfdsaqgfdsgdfgidType");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
- // get artifact data
- ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("Abcd", artifactType, true);
+ }
+ }
+
+
+ // Update artifact with invalid description via external API - empty description
+ protected void updateArtifactWithInvalidDescriptionEmpty(Component component, User sdncModifierDetails, String artifactType,
+ ComponentInstance componentInstance) throws Exception {
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ if(componentInstance != null) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED.name());
+ List<String> variables = asList("artifact description");
+ artifactReqDetails.setDescription("");
+
+ if(componentInstance != null) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 400, null, artifactReqDetails, artifactUUID, errorInfo, variables, null);
+ }
+ }
+
+ // Unhappy flow - get chosen life cycle state, artifact type and asset type
+ // update artifact via external API + check audit & response code
+ // Download artifact via external API + check audit & response code
+ // Check artifact version, uuid & checksusm
+ protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ErrorInfo errorInfo, List<String> variables, UserRoleEnum userRoleEnum, Integer expectedResponseCode) throws Exception {
+ String componentVersionBeforeUpdate = null;
+
+ // get updated artifact data
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+ componentVersionBeforeUpdate = component.getVersion();
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ ArtifactReqDetails artifactReqDetails = getUpdatedArtifact(deploymentArtifacts, artifactType);
+
+ String artifactName = artifactReqDetails.getArtifactLabel();
+ String artifactUUID = deploymentArtifacts.get(artifactName).getArtifactUUID();
+ String artifactVersionBeforeUpdate = deploymentArtifacts.get(artifactName).getArtifactVersion();
+ int numberOfArtifact = deploymentArtifacts.size();
+
+ // create component/s & upload artifact via external api
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+ expectedResponseCode, component.getComponentInstances().get(0), artifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState);
+ } else {
+ updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+ expectedResponseCode, null, artifactReqDetails, artifactUUID, errorInfo, variables, chosenLifeCycleState);
+ }
+
+ if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+ component = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+ } else {
+ component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+ }
+
+ // Get list of deployment artifact + download them via external API
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ deploymentArtifacts = component.getComponentInstances().get(0).getDeploymentArtifacts();
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+ Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
+ Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate))), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Expected that aftifact will not change.");
+ Assert.assertEquals(artifactUUID, deploymentArtifacts.get(artifactName).getArtifactUUID(), "Expected that aftifactUUID will not change.");
+ Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
+
+ return component;
+ }
+
+ protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails,
+ Integer expectedResponseCode, ComponentInstance componentInstance, ArtifactReqDetails artifactReqDetails, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+ RestResponse restResponse;
+
+ if(componentInstance != null) {
+ restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(resourceDetails, sdncModifierDetails, artifactReqDetails, componentInstance, artifactUUID);
+ } else {
+ restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(resourceDetails, sdncModifierDetails, artifactReqDetails, artifactUUID);
+
+ }
+
+ // validate response code
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+ //TODO
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+// ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+
+ responseArtifact.setUpdaterFullName("");
+ responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, resourceDetails.getUUID(), errorInfo, variables);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ expectedExternalAudit.setRESOURCE_TYPE(resourceDetails.getComponentType().getValue());
+ expectedExternalAudit.setARTIFACT_DATA("");
+ expectedExternalAudit.setCURR_ARTIFACT_UUID(artifactUUID);
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+ if(componentInstance != null) {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + resourceDetails.getComponentInstances().get(0).getNormalizedName() + "/artifacts/" + artifactUUID);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ } else {
+ expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL() + "/" + artifactUUID);
+ if((lifeCycleStatesEnum == LifeCycleStatesEnum.CHECKIN) || (lifeCycleStatesEnum == LifeCycleStatesEnum.STARTCERTIFICATION)) {
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ } else {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ }
+ }
+
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);
+
+ return restResponse;
+
+ }
+
+
+ // This function get component, user & if updatedPayload or not
+ // It will create default payload / updated payload of artifact
+ // And download artifact of component which starts with ci
+ protected RestResponse downloadResourceDeploymentArtifactExternalAPIAndComparePayLoadOfArtifactType(Component component, String artifactType, User sdncModifierDetails, ComponentTypeEnum componentTypeEnum) throws IOException, Exception {
+ // Download the uploaded artifact via external API
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("abcd", artifactType, true, false);
+ String artifactName = null;
+ for (String key : component.getDeploymentArtifacts().keySet()) {
+ if (key.startsWith("ci")) {
+ artifactName = key;
+ break;
+ }
+ }
+ return downloadResourceDeploymentArtifactExternalAPI(component, component.getDeploymentArtifacts().get(artifactName), sdncModifierDetails, artifactReqDetails, componentTypeEnum);
+ }
+
+ // Get deployment artifact of asset
+ protected Map<String, ArtifactDefinition> getDeploymentArtifactsOfAsset(Component component, ComponentTypeEnum componentTypeEnum) {
+ Map<String, ArtifactDefinition> deploymentArtifacts = null;
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ for(ComponentInstance componentInstance: component.getComponentInstances()) {
+ if(componentInstance.getNormalizedName().startsWith("ci")) {
+ deploymentArtifacts = componentInstance.getDeploymentArtifacts();
+ break;
+ }
+ }
+ } else {
+ deploymentArtifacts = component.getDeploymentArtifacts();
+ }
+ return deploymentArtifacts;
+ }
+
+ // get deploymentArtifact of asset and artifactType -> generate new artifact that can be updated on the asset
+ protected ArtifactReqDetails getUpdatedArtifact(Map<String, ArtifactDefinition> deploymentArtifacts, String artifactType) throws IOException, Exception {
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
+ artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
+ artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
+ break;
+ }
+ }
+
+ return artifactReqDetails;
+ }
+
+ // Happy flow - get chosen life cycle state, artifact type and asset type
+ // update artifact via external API + check audit & response code
+ // Download artifact via external API + check audit & response code
+ // Check artifact version, uuid & checksusm
+ protected Component updateArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState, String artifactType) throws Exception {
RestResponse restResponse = null;
+ int numberOfArtifact = 0;
+ String artifactVersionBeforeUpdate = null;
+ String artifactName = null;
+ String componentVersionBeforeUpdate = null;
+
+ // get updated artifact data
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType, true, true);
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactName = key;
+ artifactVersionBeforeUpdate = deploymentArtifacts.get(key).getArtifactVersion();
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ artifactReqDetails.setArtifactDisplayName(deploymentArtifacts.get(key).getArtifactDisplayName());
+ artifactReqDetails.setArtifactName(deploymentArtifacts.get(key).getArtifactName());
+ artifactReqDetails.setArtifactLabel(deploymentArtifacts.get(key).getArtifactLabel());
+ break;
+ }
+ }
+
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+ componentVersionBeforeUpdate = component.getVersion();
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ numberOfArtifact = deploymentArtifacts.size();
+
+
+ // create component/s & upload artifact via external api
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ if((chosenLifeCycleState == LifeCycleStatesEnum.CERTIFICATIONREQUEST) && (!component.getComponentType().toString().equals(ComponentTypeEnum.RESOURCE.toString()))) {
+ numberOfArtifact = numberOfArtifact - 1;
+ }
+ restResponse = updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
+ } else {
+
+ restResponse = updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID, 200);
+ }
+
+
+
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+ component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+
+ // Get list of deployment artifact + download them via external API
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ Assert.assertEquals(numberOfArtifact, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will be same as before.");
+ Assert.assertEquals(String.valueOf((Integer.parseInt(artifactVersionBeforeUpdate) + 1)), deploymentArtifacts.get(artifactName).getArtifactVersion(), "Expected that aftifact version will increase by one.");
+
+ if(chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
+ Assert.assertEquals(componentVersionBeforeUpdate, component.getVersion(), "Expected that check-out component will not change version number.");
+ } else {
+ Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeUpdate) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
+ }
+
+ // Download the uploaded artifact via external API
+ downloadResourceDeploymentArtifactExternalAPI(component, deploymentArtifacts.get(responseArtifact.getArtifactLabel()), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, componentTypeEnum);
+
+ return component;
+ }
+
+
+ // Update artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse updateArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, ComponentInstance componentInstance, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfComponentInstanceOnAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, resourceDetails.getComponentInstances().get(0), artifactUUID);
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+// expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
+ expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts/" + artifactUUID);
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+ // Update artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse updateArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails, ArtifactReqDetails artifactReqDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIUpdateArtifactOfTheAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, artifactUUID);
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPDATE_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+ expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_UPDATE_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+
+
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ // Delete External API //
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////
+ @DataProvider(name="deleteArtifactForServiceViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactForServiceViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"},
+ {LifeCycleStatesEnum.CERTIFY, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFY, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFY, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFY, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFY, "OTHER"}
+ };
+ }
+
+
+
+
+ // Delete artifact for Service - Success
+ @Test(dataProvider="deleteArtifactForServiceViaExternalAPI")
+ public void deleteArtifactForServiceViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.SERVICE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+ deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.SERVICE, lifeCycleStatesEnum);
+ }
+
+ @DataProvider(name="deleteArtifactForVFViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactForVFViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKOUT, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CHECKIN, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML"},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER"},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_JSON"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_POLICY"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_EVENT"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "APPC_CONFIG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_DOC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_TOSCA"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC"},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER"},
+ };
+ }
+
+
+ // Delete artifact for VF - Success
+ @Test(dataProvider="deleteArtifactForVFViaExternalAPI")
+ public void deleteArtifactForVFViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s", lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+ deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
+ }
+
+ @DataProvider(name="deleteArtifactForVfcVlCpViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactForVfcVlCpViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKOUT, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CHECKIN, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "YANG_XML", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VNF_CATALOG", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VF_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "VENDOR_LICENSE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_INVENTORY_PROFILE", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "MODEL_QUERY_SPEC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "OTHER", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+ };
+ }
+
+
+ // Delete artifact for VFC, VL, CP - Success
+ @Test(dataProvider="deleteArtifactForVfcVlCpViaExternalAPI")
+ public void deleteArtifactForVfcVlCpViaExternalAPI(LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("lifeCycleStatesEnum: %s, artifactType: %s, resourceTypeEnum: %s", lifeCycleStatesEnum, artifactType, resourceTypeEnum));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE, lifeCycleStatesEnum);
+ }
+
+ @DataProvider(name="deleteArtifactOnRIViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactOnRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", null},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", null},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VF},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VF}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="deleteArtifactOnRIViaExternalAPI")
+ public void deleteArtifactOnRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
+ }
+
+
+ @DataProvider(name="deleteArtifactOnVfcVlCpRIViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactOnVfcVlCpRIViaExternalAPI() {
+ return new Object[][] {
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VFC, null},
+
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.VL, null},
+
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_POLL", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKOUT, "SNMP_TRAP", ResourceTypeEnum.CP, null},
+
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VFC, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VFC, null},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.VL, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.VL, null},
+
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_POLL", ResourceTypeEnum.CP, null},
+ {LifeCycleStatesEnum.CHECKIN, "SNMP_TRAP", ResourceTypeEnum.CP, null},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VFC},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VFC},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.VL},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.VL},
+
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_JSON", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_POLICY", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_DOC", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_BLUEPRINT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "DCAE_INVENTORY_EVENT", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_POLL", ResourceTypeEnum.CP},
+ {LifeCycleStatesEnum.CERTIFICATIONREQUEST, "SNMP_TRAP", ResourceTypeEnum.CP}
+
+ };
+ }
+
+
+
+
+
+ @Test(dataProvider="deleteArtifactOnVfcVlCpRIViaExternalAPI")
+ public void deleteArtifactOnVfcVlCpRIViaExternalAPI(LifeCycleStatesEnum chosenLifeCycleState, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("chosenLifeCycleState: %s, artifactType: %s", chosenLifeCycleState, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(ComponentTypeEnum.RESOURCE_INSTANCE, LifeCycleStatesEnum.CHECKOUT, artifactType, resourceTypeEnum);
+ deleteArtifactOnAssetViaExternalAPI(component, ComponentTypeEnum.RESOURCE_INSTANCE, chosenLifeCycleState);
+ }
+
+
+ @DataProvider(name="deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public static Object[][] dataProviderDeleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset() {
+ return new Object[][] {
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.DESIGNER2, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.TESTER, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.ADMIN, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.OPS, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+//
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, "DCAE_INVENTORY_TOSCA"},
+ {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, "DCAE_INVENTORY_TOSCA"},
+ };
+ }
+
- if (operationType.toLowerCase().equals("upload")) {
- restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.valueOf(specificUser.toUpperCase())),
- artifactReqDetails);
- System.out.println("1234");
+ // External API
+ // Delete artifact by diffrent user then creator of asset - Fail
+ @Test(dataProvider="deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset")
+ public void deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset(ComponentTypeEnum componentTypeEnum, UserRoleEnum userRoleEnum, LifeCycleStatesEnum lifeCycleStatesEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, userRoleEnum %s, lifeCycleStatesEnum %s, artifactType: %s", componentTypeEnum, userRoleEnum, lifeCycleStatesEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, lifeCycleStatesEnum, artifactType, null);
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+ String artifactUUID = null;
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
+ List<String> variables = asList();
+
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+ 409, component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, lifeCycleStatesEnum);
+ } else {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(userRoleEnum),
+ 409, null, artifactUUID, errorInfo, variables, lifeCycleStatesEnum);
}
+
+ //TODO
+// downloadResourceDeploymentArtifactExternalAPI(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, componentTypeEnum);
+ }
+
+
+ @DataProvider(name="deleteArtifactOnAssetWhichNotExist")
+ public static Object[][] dataProviderDeleteArtifactOnAssetWhichNotExist() {
+ return new Object[][] {
+ {ComponentTypeEnum.SERVICE, "OTHER", null},
+ {ComponentTypeEnum.RESOURCE, "OTHER", null},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, "DCAE_INVENTORY_TOSCA", ResourceTypeEnum.VF},
+ };
+ }
+
- ArtifactDefinition artifactJavaObject = ResponseParser
- .convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
- AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
- ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(
- AssetTypeEnum.RESOURCES, action, artifactJavaObject, resourceUUID);
- AuditValidationUtils.validateExternalAudit(expectedExternalAudit,
- AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), null);
- }
-
- // @Test
- // public void artifactViaExternalAPI() throws Exception {
- // // Method passed variable
- // String operationType = "Upload";
- // String assetType = "vf";
- // LifeCycleStatesEnum chosenLifeCycleState = LifeCycleStatesEnum.CHECKOUT;
- // String componentInstanceAssetType = "vf";
- // LifeCycleStatesEnum componentInstanceChosenLifeCycleState =
- // LifeCycleStatesEnum.CHECKOUT;
- // UserRoleEnum creatorUser = UserRoleEnum.DESIGNER;
- // String specificUser = "DESIGNER";
- // String artifactType = "HEAT";
- //
- //
- // Component resourceDetails = null;
- // Component resourceInstanceDetails = null;
- // ComponentInstance componentResourceInstanceDetails = null;
- //
- // String resourceUUID = null;
- // String resourceType = null;
- // String resourceInstanceName = null;
- //
- // // Create resource & resource instance of requested type and state
- // if (assetType.toLowerCase().equals("vf")) {
- // resourceDetails = getComponentInTargetLifeCycleState("vf", creatorUser,
- // chosenLifeCycleState);
- // } else if (assetType.toLowerCase().equals("service")) {
- // resourceDetails = getComponentInTargetLifeCycleState("service",
- // creatorUser, chosenLifeCycleState);
- // } else if (assetType.toLowerCase().equals("ri")) {
- // resourceInstanceDetails = getComponentInTargetLifeCycleState("vf",
- // creatorUser, chosenLifeCycleState);
- // if(componentInstanceAssetType.toLowerCase().equals("vf")) {
- // resourceDetails = getComponentInTargetLifeCycleState("vf", creatorUser,
- // componentInstanceChosenLifeCycleState);
- // componentResourceInstanceDetails =
- // AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails,
- // resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
- // } else if (componentInstanceAssetType.toLowerCase().equals("service")) {
- // resourceDetails = getComponentInTargetLifeCycleState("service",
- // creatorUser, componentInstanceChosenLifeCycleState);
- // componentResourceInstanceDetails =
- // AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails,
- // resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
- // } else {
- // Assert.assertEquals(false, true, "Component instance asset type is
- // wrong.");
- // }
- // } else {
- // Assert.assertEquals(false, true, "Asset type is wrong.");
- // }
- //
- //
- // // print uuid & resource instance name
- // if (assetType.toLowerCase().equals("ri")) {
- // resourceUUID = resourceDetails.getUUID();
- // resourceInstanceName =
- // componentResourceInstanceDetails.getNormalizedName();
- //
- //
- // System.out.println("Resource UUID: " + resourceUUID);
- // System.out.println("Resource instance name: " + resourceInstanceName);
- // System.out.println("Resource type: " + resourceType);
- // } else {
- // resourceUUID = resourceDetails.getUUID();
- //
- // System.out.println("Resource UUID: " + resourceUUID);
- // System.out.println("Resource type: " + resourceType);
- // }
- //
- // // get artifact data
- // ArtifactReqDetails artifactReqDetails =
- // ElementFactory.getArtifactByType("Abcd", artifactType, true);
- //
- //// RestResponse restResponse;
- // // using rest external api
- //// if(operationType.toLowerCase().equals("upload")) {
- //// if (!assetType.toLowerCase().equals("ri")) {
- // RestResponse restResponse =
- // ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(resourceDetails,
- // ElementFactory.getDefaultUser(UserRoleEnum.valueOf(specificUser.toUpperCase())),
- // artifactReqDetails);
- // System.out.println("1234");
- //// } else {
- ////
- //// }
- //// } else {
- ////
- //// }
- //
- // ArtifactDefinition artifactJavaObject =
- // ResponseParser.convertArtifactDefinitionResponseToJavaObject(restResponse.getResponse());
- //// AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
- // AuditingActionEnum action = AuditingActionEnum.ARTIFACT_UPLOAD_BY_API;
- // ExpectedExternalAudit expectedExternalAudit =
- // ElementFactory.getDefaultExternalArtifactAuditSuccess(AssetTypeEnum.RESOURCES,
- // action, artifactJavaObject, resourceUUID);
- // AuditValidationUtils.validateExternalAudit(expectedExternalAudit,
- // AuditingActionEnum.ARTIFACT_UPLOAD_BY_API.getName(), null);
- //
- //
- //
- //
- // }
- //
-
- @Test
- public void getResourceAssetMetadataWithNonCertifiedResourceInstancesAndArtifactsSuccess() throws Exception {
-
- Resource resourceVF = AtomicOperationUtils
- .createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
- Resource resource2 = AtomicOperationUtils
- .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
- resource2 = (Resource) AtomicOperationUtils
- .changeComponentState(resource2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
- Resource resource3 = AtomicOperationUtils
- .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
- resource3 = (Resource) AtomicOperationUtils
- .changeComponentState(resource3, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true)
- .getLeft();
-
- AtomicOperationUtils.addComponentInstanceToComponentContainer(resource2, resourceVF, UserRoleEnum.DESIGNER,
- true);
- AtomicOperationUtils.addComponentInstanceToComponentContainer(resource3, resourceVF, UserRoleEnum.DESIGNER,
- true);
- // TODO
- Either<ArtifactDefinition, RestResponse> artifactDefinition = AtomicOperationUtils
- .uploadArtifactByType(ArtifactTypeEnum.VENDOR_LICENSE, resourceVF, UserRoleEnum.DESIGNER, true, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.APPC_CONFIG, resourceVF, UserRoleEnum.DESIGNER, true,
- true);
- resourceVF = ResponseParser.parseToObjectUsingMapper(
- ResourceRestUtils.getResource(resourceVF.getUniqueId()).getResponse(), Resource.class);
-
- RestResponse assetResponse = AssetRestUtils.getAssetMetadataByAssetTypeAndUuid(true, AssetTypeEnum.RESOURCES,
- resourceVF.getUUID());
- BaseRestUtils.checkSuccess(assetResponse);
-
- ResourceDetailedAssetStructure resourceAssetMetadata = AssetRestUtils.getResourceAssetMetadata(assetResponse);
- AssetRestUtils.resourceMetadataValidatior(resourceAssetMetadata, resourceVF, AssetTypeEnum.RESOURCES);
-
- // Validate audit message
- ExpectedExternalAudit expectedAssetListAudit = ElementFactory
- .getDefaultAssetMetadataAudit(AssetTypeEnum.RESOURCES, resourceVF);
- // AuditValidationUtils.validateAudit(expectedAssetListAudit,
- // AuditingActionEnum.GET_ASSET_METADATA.getName(), null);
-
- }
-
- public Component getComponentInTargetLifeCycleState(String componentType, UserRoleEnum creatorUser,
- LifeCycleStatesEnum targetLifeCycleState) throws Exception {
- Component resourceDetails = null;
+ // External API
+ // Upload artifact on VF via external API - happy flow
+ @Test(dataProvider="deleteArtifactOnAssetWhichNotExist")
+ public void deleteArtifactOnAssetWhichNotExist(ComponentTypeEnum componentTypeEnum, String artifactType, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKIN, artifactType, resourceTypeEnum);
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+ String artifactUUID = null;
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+ // Invalid artifactUUID
+ String invalidArtifactUUID = "12341234-1234-1234-1234-123412341234";
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+ List<String> variables = asList(invalidArtifactUUID);
+
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, component.getComponentInstances().get(0), invalidArtifactUUID, errorInfo, variables, null);
+ } else {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, null, invalidArtifactUUID, errorInfo, variables, null);
- if (componentType.toLowerCase().equals("vf")) {
- Either<Resource, RestResponse> createdResource = AtomicOperationUtils
- .createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT,
- ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, creatorUser, true);
- resourceDetails = createdResource.left().value();
- resourceDetails = AtomicOperationUtils
- .changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+ }
+
+
+ // Invalid componentUUID
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ component.getComponentInstances().get(0).setNormalizedName("invalidNormalizedName");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER.name());
+ variables = asList("invalidNormalizedName", ComponentTypeEnum.RESOURCE_INSTANCE.getValue().toLowerCase(), ComponentTypeEnum.SERVICE.getValue(), component.getName());
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN);
} else {
- Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(creatorUser,
- true);
- resourceDetails = createdResource.left().value();
- resourceDetails = AtomicOperationUtils
- .changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+ component.setUUID("invalidComponentUUID");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name());
+ variables = asList("null");
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, null, artifactUUID, errorInfo, variables, LifeCycleStatesEnum.CHECKIN);
}
+
+
- return resourceDetails;
+
+ }
+
+ @DataProvider(name="deleteArtifactOnAssetWhichInInvalidStateForUploading")
+ public static Object[][] dataProviderDeleteArtifactOnAssetWhichInInvalidStateForUploading() {
+ return new Object[][] {
+ {ComponentTypeEnum.SERVICE, "OTHER"},
+ {ComponentTypeEnum.RESOURCE, "OTHER"},
+ {ComponentTypeEnum.RESOURCE_INSTANCE, "DCAE_INVENTORY_TOSCA"},
+ };
+ }
+
+
+ @Test(dataProvider="deleteArtifactOnAssetWhichInInvalidStateForUploading")
+ public void deleteArtifactOnAssetWhichInInvalidStateForUploading(ComponentTypeEnum componentTypeEnum, String artifactType) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("componentTypeEnum: %s, artifactType: %s", componentTypeEnum, artifactType));
+ Component component = uploadArtifactOnAssetViaExternalAPI(componentTypeEnum, LifeCycleStatesEnum.CHECKOUT, artifactType, null);
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ String artifactUUID = null;
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+
+ // Invalid artifactUUID
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+ List<String> variables = asList(component.getName(), component.getComponentType().toString().toLowerCase(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getFirstName(),
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getLastName(), ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId());
+
+ if(componentTypeEnum.equals(ComponentTypeEnum.RESOURCE_INSTANCE)) {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 403, component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null);
+ } else {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 403, null, artifactUUID, errorInfo, variables, null);
+
+ }
+
+ }
+
+
+ @DataProvider(name="deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+ public static Object[][] dataProviderDeleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI() {
+ return new Object[][] {
+ {ResourceTypeEnum.VFC},
+ {ResourceTypeEnum.VL},
+ {ResourceTypeEnum.CP}
+ };
}
+
+
+ // Verify that it cannot delete VFC/VL/CP artifact on VFCi/VLi/CPi - Failure flow
+ @Test(dataProvider="deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI")
+ public void deleteArtifactOfVfcVlCpForVfciVliCpiViaExternalAPI(ResourceTypeEnum resourceTypeEnum) throws Exception {
+ extendTest.log(LogStatus.INFO, String.format("resourceTypeEnum: %s", resourceTypeEnum));
+
+ Component resourceInstanceDetails = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.getValue(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, resourceTypeEnum);
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", "SNMP_TRAP", true, false);
+ uploadArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(resourceInstanceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactReqDetails, 200);
+ resourceInstanceDetails = AtomicOperationUtils.changeComponentState(resourceInstanceDetails, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+ Component component = getComponentInTargetLifeCycleState(ComponentTypeEnum.RESOURCE.toString(), UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, null);
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceInstanceDetails, component, UserRoleEnum.DESIGNER, true).left().value();
+ component = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, component.getName(), component.getVersion());
+
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
+ Map<String, ArtifactDefinition> deploymentArtifacts;
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, ComponentTypeEnum.RESOURCE_INSTANCE);
+ String artifactUUID = null;
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci") && !key.endsWith("env")) {
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+ List<String> variables = asList(artifactUUID);
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ 404, component.getComponentInstances().get(0), artifactUUID, errorInfo, variables, null);
+ }
+
+ protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails,
+ Integer expectedResponseCode, ComponentInstance componentInstance, String artifactUUID, ErrorInfo errorInfo, List<String> variables, LifeCycleStatesEnum lifeCycleStatesEnum) throws Exception {
+ RestResponse restResponse;
+
+ if(componentInstance != null) {
+ restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(resourceDetails, sdncModifierDetails, componentInstance, artifactUUID);
+ } else {
+ restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(resourceDetails, sdncModifierDetails, artifactUUID);
- // // External API - Download artifact for resource - negative test
- // @Test
- // public void k() throws Exception {
- // Resource resourceDetailsVF;
- // Either<Resource, RestResponse> createdResource =
- // AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF,
- // NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE,
- // UserRoleEnum.DESIGNER, true);
- // resourceDetailsVF = createdResource.left().value();
- // ArtifactDefinition heatArtifact =
- // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT,
- // resourceDetailsVF, UserRoleEnum.DESIGNER, true, true).left().value();
- // resourceDetails = new ResourceReqDetails(resourceDetailsVF);
- //
- // String resourceUUID = resourceDetailsVF.getUUID();
- // String artifactUUID = heatArtifact.getArtifactUUID();
- //
- // System.out.println("Resource UUID: " + resourceUUID);
- // System.out.println("Artifact UUID: " + artifactUUID);
- //
- // RestResponse restResponse =
- // ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID,
- // "dfsgfdsg324", ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
- // "Resource");
- //
- // Integer responseCode = restResponse.getErrorCode();
- // Integer expectedCode = 200;
- // Assert.assertEquals(responseCode,expectedCode, "Response code is not
- // correct.");
- // }
- //
- //
- //
- //
- //
- // // External API - Download artifact for service - negative test
- // @Test
- // public void downloadArtifactFromServiceViaExternalAPI() throws Exception
- // {
- //
- // Service resourceDetailsService;
- // Either<Service, RestResponse> createdResource =
- // AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
- // resourceDetailsService = createdResource.left().value();
- //
- // ArtifactDefinition heatArtifact =
- // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER,
- // resourceDetailsService, UserRoleEnum.DESIGNER, true,
- // true).left().value();
- //
- // String resourceUUID = resourceDetailsService.getUUID();
- // String artifactUUID = heatArtifact.getArtifactUUID();
- //
- // System.out.println("Resource UUID: " + resourceUUID);
- // System.out.println("Artifact UUID: " + artifactUUID);
- //
- // RestResponse restResponse =
- // ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID,
- // artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
- // "Service");
- //
- // Integer responseCode = restResponse.getErrorCode();
- // Integer expectedCode = 200;
- // Assert.assertEquals(responseCode,expectedCode, "Response code is not
- // correct.");
- //
- // String response = restResponse.getResponse();
- //
- // String payloadData =
- // "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
- // String decodedPaypload = Decoder.decode(payloadData);
- //
- // Assert.assertEquals(response, decodedPaypload, "Response deployment
- // artifact not correct.");
- //
- // String auditAction = "ArtifactDownload";
- //
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new
- // ExpectedResourceAuditJavaObject();
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceName(resourceDetailsService.getName());
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setStatus("200");
- // expectedResourceAuditJavaObject.setDesc("OK");
- //
- // expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
- // String resource_url =
- // String.format("/asdc/v1/catalog/services/%s/artifacts/%s", resourceUUID,
- // artifactUUID);
- // expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
- //
- // AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- // }
- //
- //
- //
- //
- //
- //
- // // External API - Download ComponentInstance artifact of service -
- // negative test
- // @Test
- // public void
- // downloadArtifactOfComponentInstanceFromServiceViaExternalAPI() throws
- // Exception {
- //
- // Either<Resource, RestResponse> resourceDetailsVF_01e =
- // AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF,
- // NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE,
- // UserRoleEnum.DESIGNER, true);
- // Component resourceDetailsVF_01 = resourceDetailsVF_01e.left().value();
- // ArtifactDefinition heatArtifact =
- // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT,
- // resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true).left().value();
- //
- // resourceDetailsVF_01 =
- // AtomicOperationUtils.changeComponentState(resourceDetailsVF_01,
- // UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
- //
- // Service resourceDetailsService;
- // Either<Service, RestResponse> createdResource =
- // AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
- // resourceDetailsService = createdResource.left().value();
- //
- //
- // ComponentInstance resourceDetailsVF1ins_01 =
- // AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVF_01,
- // resourceDetailsService, UserRoleEnum.DESIGNER, true).left().value();
- //
- //
- // System.out.println("-----");
- //
- //
- // String resourceUUID = resourceDetailsService.getUUID();
- // String componentInstanceUID = resourceDetailsVF1ins_01.getUniqueId();
- // String artifactUUID = heatArtifact.getArtifactUUID();
- //
- // System.out.println("Resource UUID: " + resourceUUID);
- // System.out.println("Component instance UID: " + componentInstanceUID);
- // System.out.println("Artifact UUID: " + artifactUUID);
- //
- // RestResponse restResponse =
- // ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(resourceUUID,
- // componentInstanceUID, artifactUUID,
- // ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "Service");
- ////
- // Integer responseCode = restResponse.getErrorCode();
- // Integer expectedCode = 200;
- // Assert.assertEquals(responseCode,expectedCode, "Response code is not
- // correct.");
- //
- // String response = restResponse.getResponse();
- //
- // String payloadData =
- // "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
- // String decodedPaypload = Decoder.decode(payloadData);
- //
- // Assert.assertEquals(response, decodedPaypload, "Response deployment
- // artifact not correct.");
- //
- // String auditAction = "ArtifactDownload";
- //
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new
- // ExpectedResourceAuditJavaObject();
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setResourceName(resourceDetailsVF1ins_01.getName());
- // expectedResourceAuditJavaObject.setResourceType("Service");
- // expectedResourceAuditJavaObject.setStatus("200");
- // expectedResourceAuditJavaObject.setDesc("OK");
- //
- // expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
- // String resource_url =
- // String.format("/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s",
- // resourceUUID, componentInstanceUID, artifactUUID);
- // expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
- //
- // AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- // }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- // @Test
- // public void downloadArtifactFromResourceTest() throws Exception {
- //
- // CloseableHttpClient httpclient = HttpClients.createDefault();
- // try {
- // String jsonBody = createUploadArtifactBodyJson();
- //
- // String resourceId = resourceDetails.getUniqueId();
- // String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE,
- // config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
- // HttpPost httppost = createPostAddArtifactRequeast(jsonBody, url, true);
- // HttpResponse response = httpclient.execute(httppost);
- // int status = response.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("failed to add artifact", 200, status);
- //
- // ArtifactDefinition origArtifact = getArtifactDataFromJson(jsonBody);
- // addArtifactDataFromResponse(response, origArtifact);
- // String artifactId = origArtifact.getUniqueId();
- //
- // url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT,
- // config.getCatalogBeHost(), config.getCatalogBePort(), resourceId,
- // artifactId);
- // HttpGet httpGet = createGetRequest(url);
- // response = httpclient.execute(httpGet);
- // status = response.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("failed to download artifact", 200, status);
- //
- // InputStream inputStream = response.getEntity().getContent();
- // ArtifactUiDownloadData artifactUiDownloadData =
- // getArtifactUiDownloadData(IOUtils.toString(inputStream));
- // AssertJUnit.assertEquals("Downloaded payload is different from uploaded
- // one", UPLOAD_ARTIFACT_PAYLOAD,
- // artifactUiDownloadData.getBase64Contents());
- // AssertJUnit.assertEquals("Downloaded artifact name is different from
- // uploaded one", UPLOAD_ARTIFACT_NAME,
- // artifactUiDownloadData.getArtifactName());
- //
- // // validate audit
- //
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // Convertor.constructFieldsForAuditValidation(resourceDetails,
- // resourceDetails.getVersion(), sdncUserDetails);
- // String auditAction = "ArtifactDownload";
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setPrevVersion("");
- // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
- // expectedResourceAuditJavaObject.setStatus("200");
- // expectedResourceAuditJavaObject.setDesc("OK");
- // expectedResourceAuditJavaObject.setArtifactData(AuditValidationUtils.buildArtifactDataAudit(origArtifact));
- // expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
- // expectedResourceAuditJavaObject.setPrevArtifactUuid("");
- // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- //
- // } finally {
- // httpclient.close();
- // }
- //
- // }
- //
- // @Test
- // public void downloadArtifactFromServiceTest() throws Exception {
- //
- // CloseableHttpClient httpclient = HttpClients.createDefault();
- //
- // try {
- //
- // String jsonStr = createUploadArtifactBodyJson();
- //
- // String url = String.format(Urls.ADD_ARTIFACT_TO_SERVICE,
- // config.getCatalogBeHost(), config.getCatalogBePort(),
- // serviceDetails.getUniqueId());
- // HttpPost httpPost = createPostAddArtifactRequeast(jsonStr, url, true);
- // CloseableHttpResponse result = httpclient.execute(httpPost);
- // int status = result.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("failed to add artifact", 200, status);
- //
- // ArtifactDefinition origArtifact = getArtifactDataFromJson(jsonStr);
- // addArtifactDataFromResponse(result, origArtifact);
- // String artifactId = origArtifact.getUniqueId();
- //
- // url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT,
- // config.getCatalogBeHost(), config.getCatalogBePort(),
- // serviceDetails.getUniqueId(), artifactId);
- // HttpGet httpGet = createGetRequest(url);
- // CloseableHttpResponse response2 = httpclient.execute(httpGet);
- // status = response2.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("failed to download artifact", 200, status);
- // InputStream inputStream = response2.getEntity().getContent();
- // ArtifactUiDownloadData artifactUiDownloadData =
- // getArtifactUiDownloadData(IOUtils.toString(inputStream));
- // AssertJUnit.assertEquals("Downloaded payload is different from uploaded
- // one", UPLOAD_ARTIFACT_PAYLOAD,
- // artifactUiDownloadData.getBase64Contents());
- // AssertJUnit.assertEquals("Downloaded artifact name is different from
- // uploaded one", UPLOAD_ARTIFACT_NAME,
- // artifactUiDownloadData.getArtifactName());
- //
- // // validate audit
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // AuditValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // serviceDetails.getVersion(), sdncUserDetails);
- // String auditAction = "ArtifactDownload";
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setPrevVersion("");
- // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
- // expectedResourceAuditJavaObject.setStatus("200");
- // expectedResourceAuditJavaObject.setDesc("OK");
- // expectedResourceAuditJavaObject.setArtifactData(AuditValidationUtils.buildArtifactDataAudit(origArtifact));
- // expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
- // expectedResourceAuditJavaObject.setPrevArtifactUuid("");
- //
- // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- //
- // } finally {
- //// RestResponse response = ServiceRestUtils.deleteService(serviceDetails,
- // serviceVersion, sdncUserDetails );
- //// checkDeleteResponse(response);
- // httpclient.close();
- // }
- // }
- //
- // @Test
- // public void downloadArtifactFromResourceNotFound() throws Exception {
- //
- // CloseableHttpClient httpclient = HttpClients.createDefault();
- // try {
- //
- // String resourceId = resourceDetails.getUniqueId();
- // String artifactIdNotFound = "11111";
- //
- // ArtifactDefinition origArtifact = new ArtifactDefinition();
- // origArtifact.setUniqueId(artifactIdNotFound);
- //
- // String url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT,
- // config.getCatalogBeHost(), config.getCatalogBePort(), resourceId,
- // artifactIdNotFound);
- // HttpGet httpGet = createGetRequest(url);
- // CloseableHttpResponse response = httpclient.execute(httpGet);
- // int status = response.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("expected 404 not found", 404, status);
- //
- // // validate audit
- // ErrorInfo errorInfo =
- // ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // Convertor.constructFieldsForAuditValidation(resourceDetails,
- // resourceDetails.getVersion(), sdncUserDetails);
- // String auditAction = "ArtifactDownload";
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setPrevVersion("");
- // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
- // expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getAuditDesc(""));
- // expectedResourceAuditJavaObject.setArtifactData("");
- // expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
- // expectedResourceAuditJavaObject.setPrevArtifactUuid("");
- // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- // expectedResourceAuditJavaObject.setPrevArtifactUuid(null);
- // } finally {
- // httpclient.close();
- // }
- //
- // }
- //
- // @Test
- // public void downloadArtifactFromServiceNotFound() throws Exception {
- //
- // CloseableHttpClient httpclient = HttpClients.createDefault();
- // try {
- //
- // String artifactIdNotFound = "11111";
- // ArtifactDefinition origArtifact = new ArtifactDefinition();
- // origArtifact.setUniqueId(artifactIdNotFound);
- //
- // String url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT,
- // config.getCatalogBeHost(), config.getCatalogBePort(),
- // serviceDetails.getUniqueId(), artifactIdNotFound);
- // HttpGet httpGet = createGetRequest(url);
- // CloseableHttpResponse response2 = httpclient.execute(httpGet);
- // int status = response2.getStatusLine().getStatusCode();
- // AssertJUnit.assertEquals("expected 404 not found", 404, status);
- //
- // // validate audit
- // ErrorInfo errorInfo =
- // ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.ARTIFACT_NOT_FOUND.name());
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceValidationUtils.constructFieldsForAuditValidation(serviceDetails,
- // serviceDetails.getVersion(), sdncUserDetails);
- // String auditAction = "ArtifactDownload";
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setPrevVersion("");
- // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
- // expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
- // expectedResourceAuditJavaObject.setDesc(errorInfo.getAuditDesc(""));
- // expectedResourceAuditJavaObject.setArtifactData("");
- // expectedResourceAuditJavaObject.setCurrArtifactUuid(origArtifact.getUniqueId());
- // expectedResourceAuditJavaObject.setPrevArtifactUuid("");
- // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- //
- // } finally {
- // httpclient.close();
- // }
- //
- // }
- //
- // @Test
- // public void addArtifactToResourceTest() throws Exception {
- //
- // ArtifactReqDetails defaultArtifact = ElementFactory.getDefaultArtifact();
- //
- // RestResponse response =
- // ArtifactRestUtils.addInformationalArtifactToResource(defaultArtifact,
- // sdncUserDetails, resourceDetails.getUniqueId());
- // int status = response.getErrorCode();
- // AssertJUnit.assertEquals("add informational artifact request returned
- // status: " + response.getErrorCode(), 200, status);
- //
- // RestResponse resourceResp =
- // ResourceRestUtils.getResource(resourceDetails.getUniqueId());
- // Resource resource =
- // ResponseParser.convertResourceResponseToJavaObject(resourceResp.getResponse());
- // AssertJUnit.assertNotNull(resource);
- //
- // Map<String, ArtifactDefinition> artifacts = resource.getArtifacts();
- // boolean isExist = false;
- // for (Map.Entry<String, ArtifactDefinition> entry : artifacts.entrySet())
- // {
- // if (entry.getKey().equals(defaultArtifact.getArtifactLabel())) {
- // isExist = true;
- //
- // }
- // }
- // AssertJUnit.assertTrue(isExist);
- // }
+ }
+
+ // validate response code
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+// ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+
+ responseArtifact.setUpdaterFullName("");
+ responseArtifact.setUserIdLastUpdater(sdncModifierDetails.getUserId());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditFailure(assetTypeEnum, action, responseArtifact, resourceDetails.getUUID(), errorInfo, variables);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ expectedExternalAudit.setRESOURCE_TYPE(resourceDetails.getComponentType().getValue());
+ expectedExternalAudit.setARTIFACT_DATA(null);
+ expectedExternalAudit.setCURR_ARTIFACT_UUID(artifactUUID);
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+ if(componentInstance != null) {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + resourceDetails.getComponentInstances().get(0).getNormalizedName() + "/artifacts/" + artifactUUID);
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getComponentInstances().get(0).getNormalizedName());
+ } else {
+ expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL() + "/" + artifactUUID);
+ if((errorInfo.getMessageId().equals(ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_NOT_FOUND.name()).getMessageId())) ||
+ errorInfo.getMessageId().equals(ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name()).getMessageId()) ||
+ (lifeCycleStatesEnum == LifeCycleStatesEnum.STARTCERTIFICATION)) {
+ expectedExternalAudit.setRESOURCE_NAME(resourceDetails.getName());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ } else {
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+ }
+ }
+
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);
+
+ return restResponse;
+
+ }
+
+
+ // Happy flow - get chosen life cycle state, artifact type and asset type
+ // delete artifact via external API + check audit & response code
+ protected Component deleteArtifactOnAssetViaExternalAPI(Component component, ComponentTypeEnum componentTypeEnum, LifeCycleStatesEnum chosenLifeCycleState) throws Exception {
+ String artifactName = null;
+ component = AtomicOperationUtils.changeComponentState(component, UserRoleEnum.DESIGNER, chosenLifeCycleState, true).getLeft();
+
+ // get updated artifact data
+ String artifactUUID = null;
+ Map<String, ArtifactDefinition> deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+
+ for (String key : deploymentArtifacts.keySet()) {
+ if (key.startsWith("ci")) {
+ artifactName = key;
+ artifactUUID = deploymentArtifacts.get(key).getArtifactUUID();
+ break;
+ }
+ }
+
+
+ String componentVersionBeforeDelete = component.getVersion();
+ int numberOfArtifact = deploymentArtifacts.size();
+
+
+ // create component/s & upload artifact via external api
+ if(ComponentTypeEnum.RESOURCE_INSTANCE == componentTypeEnum) {
+ deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(component, component.getComponentInstances().get(0), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
+ } else {
+ deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, 200);
+ }
+
+ component = getNewerVersionOfComponent(component, chosenLifeCycleState);
+
+ // Get list of deployment artifact + download them via external API
+ deploymentArtifacts = getDeploymentArtifactsOfAsset(component, componentTypeEnum);
+ if(deploymentArtifacts.get(artifactName) != null) {
+ Assert.assertTrue(false, "Expected that deletecd artifact will not appear in deployment artifact list.");
+ }
+ if((LifeCycleStatesEnum.CERTIFICATIONREQUEST.equals(chosenLifeCycleState)) && (ComponentTypeEnum.RESOURCE_INSTANCE.equals(componentTypeEnum)) && (!component.getComponentType().toString().equals(ComponentTypeEnum.RESOURCE.toString()))) {
+ Assert.assertEquals(numberOfArtifact - 2, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact (one deleted and one vfmodule) will decrease by two.");
+ } else {
+ Assert.assertEquals(numberOfArtifact - 1, deploymentArtifacts.keySet().size(), "Expected that number of deployment artifact will decrease by one.");
+ }
+
+ if(chosenLifeCycleState == LifeCycleStatesEnum.CHECKOUT) {
+ Assert.assertEquals(componentVersionBeforeDelete, component.getVersion(), "Expected that check-out component will not change version number.");
+ } else {
+ Assert.assertEquals(String.format("%.1f", (Double.parseDouble(componentVersionBeforeDelete) + 0.1)), component.getVersion(), "Expected that non check-out component version will increase by 0.1.");
+ }
+
+ downloadResourceDeploymentArtifactExternalAPI(component, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID, componentTypeEnum);
+
+ return component;
+ }
+
+ // Delete artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse deleteArtifactOfRIIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, ComponentInstance componentInstance, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfComponentInstanceOnAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getComponentInstances().get(0), artifactUUID);
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, componentInstance.getNormalizedName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+// expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
+ expectedExternalAudit.setRESOURCE_NAME(componentInstance.getNormalizedName());
+ expectedExternalAudit.setRESOURCE_URL("/asdc/v1/catalog/" + assetTypeEnum.getValue() + "/" + resourceDetails.getUUID() + "/resourceInstances/" + componentInstance.getNormalizedName() + "/artifacts/" + artifactUUID);
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+ // Delete artifact via external API + Check auditing for upload operation + Check response of external API
+ protected RestResponse deleteArtifactOfAssetIncludingValiditionOfAuditAndResponseCode(Component resourceDetails, User sdncModifierDetails, String artifactUUID, Integer expectedResponseCode) throws Exception {
+ RestResponse restResponse = ArtifactRestUtils.externalAPIDeleteArtifactOfTheAsset(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), artifactUUID);
+
+ // Check response of external API
+ Integer responseCode = restResponse.getErrorCode();
+ Assert.assertEquals(responseCode, expectedResponseCode, "Response code is not correct.");
+
+
+ // Check auditing for upload operation
+ ArtifactDefinition responseArtifact = getArtifactDataFromJson(restResponse.getResponse());
+
+ AuditingActionEnum action = AuditingActionEnum.ARTIFACT_DELETE_BY_API;
+
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+
+ AssetTypeEnum assetTypeEnum = AssetTypeEnum.valueOf((resourceDetails.getComponentType().getValue() + "s").toUpperCase());
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalArtifactAuditSuccess(assetTypeEnum, action, responseArtifact, resourceDetails);
+ expectedExternalAudit.setRESOURCE_URL(expectedExternalAudit.getRESOURCE_URL()+ "/" + artifactUUID);
+ AuditValidationUtils.validateExternalAudit(expectedExternalAudit, AuditingActionEnum.ARTIFACT_DELETE_BY_API.getName(), body);
+
+ return restResponse;
+ }
+
+
+
+ // download deployment via external api + check response code for success (200) + get artifactReqDetails and verify payload + verify audit
+ protected RestResponse downloadResourceDeploymentArtifactExternalAPI(Component resourceDetails, User sdncModifierDetails, String artifactUUID, ComponentTypeEnum componentTypeEnum) throws Exception {
+ RestResponse restResponse;
+
+ if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+ restResponse = ArtifactRestUtils.getComponentInstanceDeploymentArtifactExternalAPI(resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getComponentType().toString());
+ } else {
+ restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceDetails.getUUID(), artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getComponentType().toString());
+ }
+
+ Integer responseCode = restResponse.getErrorCode();
+ Integer expectedCode = 404;
+ Assert.assertEquals(responseCode,expectedCode, "Response code is not correct.");
+
+
+ //TODO - including body - resourceDetails.getName()
+// // Verify audit
+// String auditAction = "DownloadArtifact";
+//
+// Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+// body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, responseCode.toString());
+// body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resourceDetails.getName());
+//
+// ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+// expectedResourceAuditJavaObject.setAction(auditAction);
+// expectedResourceAuditJavaObject.setResourceType(resourceDetails.getComponentType().getValue());
+// expectedResourceAuditJavaObject.setStatus("200");
+// expectedResourceAuditJavaObject.setDesc("OK");
+// expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
+//
+// if(componentTypeEnum == ComponentTypeEnum.RESOURCE_INSTANCE) {
+// expectedResourceAuditJavaObject.setResourceName(resourceDetails.getComponentInstances().get(0).getName());
+// String resource_url = String.format("/asdc/v1/catalog/services/%s/resourceInstances/%s/artifacts/%s", resourceDetails.getUUID(), resourceDetails.getComponentInstances().get(0).getNormalizedName(), artifactDefinition.getArtifactUUID());
+// expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
+//
+// AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
+// } else {
+// expectedResourceAuditJavaObject.setResourceName(resourceDetails.getName());
+// String resource_url = String.format("/asdc/v1/catalog/services/%s/artifacts/%s", resourceDetails.getUUID(), artifactDefinition.getArtifactUUID());
+// expectedResourceAuditJavaObject.setRESOURCE_URL(resource_url);
+// }
+//
+// AuditValidationUtils.validateAuditDownloadExternalAPI(expectedResourceAuditJavaObject, auditAction, null, false);
+
+ return restResponse;
+
+ }
+
+
+
+
+ public Component getComponentInTargetLifeCycleState(String componentType, UserRoleEnum creatorUser, LifeCycleStatesEnum targetLifeCycleState, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ Component resourceDetails = null;
+
+ if((componentType.toLowerCase().equals("vf")) || (componentType.toLowerCase().equals("resource"))){
+ if(resourceTypeEnum==null) {
+ resourceTypeEnum = ResourceTypeEnum.VF;
+ }
+ Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(resourceTypeEnum, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, creatorUser, true);
+ resourceDetails = createdResource.left().value();
+ resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+ } else {
+ Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(creatorUser, true);
+ resourceDetails = createdResource.left().value();
+ // Add artifact to service if asked for certifcationrequest - must be at least one artifact for the flow
+ if((LifeCycleStatesEnum.CERTIFICATIONREQUEST == targetLifeCycleState) || (LifeCycleStatesEnum.STARTCERTIFICATION == targetLifeCycleState)) {
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetails, UserRoleEnum.DESIGNER, true, true).left().value();
+ }
+ resourceDetails = AtomicOperationUtils.changeComponentState(resourceDetails, creatorUser, targetLifeCycleState, true).getLeft();
+ }
+
+ return resourceDetails;
+ }
+
+
+
+
+
protected String createUploadArtifactBodyJson() {
Map<String, Object> jsonBody = new HashMap<String, Object>();
jsonBody.put("artifactName", UPLOAD_ARTIFACT_NAME);
@@ -885,32 +3371,54 @@ public class CRUDExternalAPI extends ComponentBaseTest {
jsonBody.put("artifactLabel", "configure");
return gson.toJson(jsonBody);
}
+
+ protected ArtifactDefinition getArtifactDataFromJson(String content) {
- protected ArtifactDefinition getArtifactDataFromJson(String json) {
- Gson gson = new Gson();
JsonObject jsonElement = new JsonObject();
- jsonElement = gson.fromJson(json, jsonElement.getClass());
- ArtifactDefinition artifact = new ArtifactDefinition();
- String payload = null;
- JsonElement artifactPayload = jsonElement.get(Constants.ARTIFACT_PAYLOAD_DATA);
- if (artifactPayload != null && !artifactPayload.isJsonNull()) {
- payload = artifactPayload.getAsString();
- }
- jsonElement.remove(Constants.ARTIFACT_PAYLOAD_DATA);
- artifact = gson.fromJson(jsonElement, ArtifactDefinition.class);
- artifact.setPayloadData(payload);
-
- /*
- * atifact.setArtifactName(UPLOAD_ARTIFACT_NAME);
- * artifact.setArtifactDisplayName("configure");
- * artifact.setArtifactType("SHELL"); artifact.setMandatory(false);
- * artifact.setDescription("ff");
- * artifact.setPayloadData(UPLOAD_ARTIFACT_PAYLOAD);
- * artifact.setArtifactLabel("configure");
- */
- return artifact;
+ ArtifactDefinition resourceInfo = null;
+
+ try {
+ Gson gson = new Gson();
+ jsonElement = gson.fromJson(content, jsonElement.getClass());
+ JsonElement artifactGroupValue = jsonElement.get(Constants.ARTIFACT_GROUP_TYPE_FIELD);
+ if (artifactGroupValue != null && !artifactGroupValue.isJsonNull()) {
+ String groupValueUpper = artifactGroupValue.getAsString().toUpperCase();
+ if (!ArtifactGroupTypeEnum.getAllTypes().contains(groupValueUpper)) {
+ StringBuilder sb = new StringBuilder();
+ for (String value : ArtifactGroupTypeEnum.getAllTypes()) {
+ sb.append(value).append(", ");
+ }
+ log.debug("artifactGroupType is {}. valid values are: {}", groupValueUpper, sb.toString());
+ return null;
+ } else {
+ jsonElement.remove(Constants.ARTIFACT_GROUP_TYPE_FIELD);
+ jsonElement.addProperty(Constants.ARTIFACT_GROUP_TYPE_FIELD, groupValueUpper);
+ }
+ }
+ String payload = null;
+ JsonElement artifactPayload = jsonElement.get(Constants.ARTIFACT_PAYLOAD_DATA);
+ if (artifactPayload != null && !artifactPayload.isJsonNull()) {
+ payload = artifactPayload.getAsString();
+ }
+ jsonElement.remove(Constants.ARTIFACT_PAYLOAD_DATA);
+ String json = gson.toJson(jsonElement);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
+
+ resourceInfo = mapper.readValue(json, ArtifactDefinition.class);
+ resourceInfo.setPayloadData(payload);
+
+ } catch (Exception e) {
+ BeEcompErrorManager.getInstance().logBeArtifactInformationInvalidError("Artifact Upload / Update");
+ log.debug("Failed to convert the content {} to object.", content.substring(0, Math.min(50, content.length())), e);
+ }
+
+ return resourceInfo;
}
+
protected HttpGet createGetRequest(String url) {
HttpGet httpGet = new HttpGet(url);
httpGet.addHeader(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
@@ -918,53 +3426,49 @@ public class CRUDExternalAPI extends ComponentBaseTest {
httpGet.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
return httpGet;
}
-
+
protected String getArtifactUid(HttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
String artifactId = (String) responseMap.get("uniqueId");
return artifactId;
}
-
+
protected String getArtifactEsId(HttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
String esId = (String) responseMap.get("EsId");
return esId;
}
-
- protected ArtifactDefinition addArtifactDataFromResponse(HttpResponse response, ArtifactDefinition artifact)
- throws HttpResponseException, IOException, ParseException {
- // String responseString = new
- // BasicResponseHandler().handleResponse(response);
+
+ protected ArtifactDefinition addArtifactDataFromResponse(HttpResponse response, ArtifactDefinition artifact) throws HttpResponseException, IOException, ParseException {
+ //String responseString = new BasicResponseHandler().handleResponse(response);
HttpEntity entity = response.getEntity();
- String responseString = EntityUtils.toString(entity);
+ String responseString = EntityUtils.toString(entity);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
- artifact.setEsId((String) responseMap.get("esId"));
+ artifact.setEsId((String)responseMap.get("esId"));
artifact.setUniqueId((String) responseMap.get("uniqueId"));
artifact.setArtifactGroupType(ArtifactGroupTypeEnum.findType((String) responseMap.get("artifactGroupType")));
artifact.setTimeout(((Long) responseMap.get("timeout")).intValue());
return artifact;
}
-
- protected String getLifecycleArtifactUid(CloseableHttpResponse response)
- throws HttpResponseException, IOException, ParseException {
+
+ protected String getLifecycleArtifactUid(CloseableHttpResponse response) throws HttpResponseException, IOException, ParseException {
String responseString = new BasicResponseHandler().handleResponse(response);
JSONObject responseMap = (JSONObject) jsonParser.parse(responseString);
responseMap = (JSONObject) responseMap.get("implementation");
String artifactId = (String) responseMap.get("uniqueId");
return artifactId;
}
-
+
protected HttpDelete createDeleteArtifactRequest(String url) {
HttpDelete httpDelete = new HttpDelete(url);
httpDelete.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
httpDelete.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
return httpDelete;
}
-
- protected HttpPost createPostAddArtifactRequeast(String jsonBody, String url, boolean addMd5Header)
- throws UnsupportedEncodingException {
+
+ protected HttpPost createPostAddArtifactRequeast(String jsonBody, String url, boolean addMd5Header) throws UnsupportedEncodingException {
HttpPost httppost = new HttpPost(url);
httppost.addHeader(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
@@ -975,10 +3479,10 @@ public class CRUDExternalAPI extends ComponentBaseTest {
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
httppost.setEntity(input);
- log.debug("Executing request {}", httppost.getRequestLine());
+ log.debug("Executing request {}" , httppost.getRequestLine());
return httppost;
}
-
+
protected String createLoadArtifactBody() {
Map<String, Object> json = new HashMap<String, Object>();
json.put("artifactName", "install_apache2.sh");
@@ -986,21 +3490,20 @@ public class CRUDExternalAPI extends ComponentBaseTest {
json.put("description", "ddd");
json.put("payloadData", "UEsDBAoAAAAIAAeLb0bDQz");
json.put("artifactLabel", "name123");
-
+
String jsonStr = gson.toJson(json);
return jsonStr;
}
-
+
protected void checkDeleteResponse(RestResponse response) {
BaseRestUtils.checkStatusCode(response, "delete request failed", false, 204, 404);
}
-
+
protected ArtifactUiDownloadData getArtifactUiDownloadData(String artifactUiDownloadDataStr) throws Exception {
-
+
ObjectMapper mapper = new ObjectMapper();
try {
- ArtifactUiDownloadData artifactUiDownloadData = mapper.readValue(artifactUiDownloadDataStr,
- ArtifactUiDownloadData.class);
+ ArtifactUiDownloadData artifactUiDownloadData = mapper.readValue(artifactUiDownloadDataStr, ArtifactUiDownloadData.class);
return artifactUiDownloadData;
} catch (Exception e) {
e.printStackTrace();
@@ -1008,4 +3511,5 @@ public class CRUDExternalAPI extends ComponentBaseTest {
return null;
}
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
index 2c9d96d79d..dd078377db 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java
@@ -20,15 +20,20 @@
package org.openecomp.sdc.ci.tests.execute.devCI;
+import static org.testng.AssertJUnit.assertTrue;
+
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.imports.ImportCsarResourceTest;
@@ -37,6 +42,7 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -54,14 +60,14 @@ public class ImportCsarUpdate extends ComponentBaseTest {
@DataProvider(name = "happyArts")
public Object[][] getHappyArtifacts() {
- return new Object[][] { { "happy_VF_RI2_G2_two_different_artifacts_under_heatBaseheatVolheatNet2" },
- { "happy_VF_RI2_G2_two_different_artifacts_under_heatBaseheatVolheatNet" },
- { "happy_VF_RI2_G2_two_identical_artifacts_under_heatBaseheatVolheatNet" },
- { "happy_VF_RI2_G2_two_different_artifacts_under_nested" },
- { "happy_VF_RI2_G2_two_indentical_nested_under_different_groups" },
- { "happy_VF_RI2_G2_two_different_nested_under_different_groups" },
- { "happy_VF_RI2_G2_two_different_nested_under_same_group" },
-
+ return new Object[][] {
+ { "happy_VF_RI2_G2_two_different_artifacts_under_heatBaseheatVolheatNet2" },
+ { "happy_VF_RI2_G2_two_different_artifacts_under_heatBaseheatVolheatNet" },
+ { "happy_VF_RI2_G2_two_identical_artifacts_under_heatBaseheatVolheatNet" },
+ { "happy_VF_RI2_G2_two_different_artifacts_under_nested" },
+ { "happy_VF_RI2_G2_two_indentical_nested_under_different_groups" },
+ { "happy_VF_RI2_G2_two_different_nested_under_different_groups" },
+ { "happy_VF_RI2_G2_two_different_nested_under_same_group" }
};
}
@@ -69,12 +75,13 @@ public class ImportCsarUpdate extends ComponentBaseTest {
public Object[][] getNegativeArtifacts() {
return new Object[][] {
-
- { "negative_VF_RI2_G2_same_heatVol_different_groups" },
- { "negative_VF_RI2_G2_same_heatBase_different_envs" },
- { "negative_VF_RI2_G2_heatBaseHeatVolHeatNet_under_nested" },
- { "negative_VF_RI2_G2_two_indentical_artifacts_under_nested" },
- { "negative_VF_RI2_G2_nested_under_nested" }, { "negative_VF_RI2_G2_same_heatVol_different_groups" }, };
+ { "negative_VF_RI2_G2_same_heatVol_different_groups" },
+ { "negative_VF_RI2_G2_same_heatBase_different_envs" },
+ { "negative_VF_RI2_G2_heatBaseHeatVolHeatNet_under_nested" },
+ { "negative_VF_RI2_G2_two_indentical_artifacts_under_nested" },
+ { "negative_VF_RI2_G2_nested_under_nested" },
+ { "negative_VF_RI2_G2_same_heatVol_different_groups" }
+ };
}
@BeforeTest
@@ -100,25 +107,18 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -133,14 +133,10 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
// User sdncModifierDetails =
// ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
@@ -148,11 +144,9 @@ public class ImportCsarUpdate extends ComponentBaseTest {
// ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,"updateImportCsar_2Gartifacts_topologyChanged.csar","importCsar_2Gartifacts.csar");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -167,25 +161,20 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Component resourceObject =
// AtomicOperationUtils.changeComponentState(resourceFirstImport,
// UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -200,25 +189,18 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -233,24 +215,18 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER,
- LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -265,26 +241,19 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setName("hardcodedNameChanged");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
@@ -299,23 +268,17 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails.setName("hardcodedName");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails,
- "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
+ RestResponse copyRes = ImportCsarResourceTest.copyCsarRest(sdncModifierDetails, "updateImportCsar_2Gartifacts_topologyChanged.csar", "importCsar_2Gartifacts.csar");
resourceDetails.setName("hardcodedNameChanged");
resourceDetails.setCsarUUID("importCsar_2Gartifacts");
- createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
}
@@ -325,14 +288,10 @@ public class ImportCsarUpdate extends ComponentBaseTest {
ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
resourceDetails.setName("hardcodedName");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
- Component resourceObject = AtomicOperationUtils
- .changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true)
- .getLeft();
+ Resource resourceFirstImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ Component resourceObject = AtomicOperationUtils.changeComponentState(resourceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
// User sdncModifierDetails =
// ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
// RestResponse copyRes =
@@ -341,11 +300,9 @@ public class ImportCsarUpdate extends ComponentBaseTest {
resourceDetails2.setName("hardcodedName");
resourceDetails2.setCsarUUID("importCsar_2Gartifacts");
resourceDetails2.setResourceType(ResourceTypeEnum.VF.name());
- createResource = ResourceRestUtils.createResource(resourceDetails2,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ createResource = ResourceRestUtils.createResource(resourceDetails2, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
- Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(),
- Resource.class);
+ Resource resourceSecondImport = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
// Validation Part
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
index 49e5950db5..5ed71e53b0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java
@@ -25,11 +25,16 @@ import static org.testng.AssertJUnit.assertTrue;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+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.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/OpsRejectDistribution.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/OpsRejectDistribution.java
new file mode 100644
index 0000000000..2ac31183d3
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/OpsRejectDistribution.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.devCI;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.utils.CommonBeUtils;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+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.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class OpsRejectDistribution extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public OpsRejectDistribution() {
+ super(name, OpsRejectDistribution.class.getName());
+ }
+
+ @Test
+ public void testOpsRejectDistribution() throws Exception {
+ User designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ ServiceReqDetails service = ElementFactory.getDefaultService();
+ RestResponse createdService = ServiceRestUtils.createService(service, designer);
+ BaseRestUtils.checkCreateResponse(createdService);
+ Service serviceFirstImport = ResponseParser.parseToObjectUsingMapper(createdService.getResponse(), Service.class);
+ Component serviceObject = AtomicOperationUtils.changeComponentState(serviceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ AtomicOperationUtils.approveAndRejectServiceForDistribution(serviceObject);
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/SearchFilterCategoryExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/SearchFilterCategoryExternalAPI.java
new file mode 100644
index 0000000000..af4b9380fd
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/SearchFilterCategoryExternalAPI.java
@@ -0,0 +1,344 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.devCI;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Base64.Decoder;
+
+import javax.json.Json;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.cassandra.cli.CliParser.operator_return;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.http.util.EntityUtils;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
+import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceDetailedAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.SearchCriteriaEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedExternalAudit;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
+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.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.api.ApplicationErrorCodesEnum;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.api.UploadArtifactInfo;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import org.openecomp.sdc.common.util.GeneralUtility;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.openecomp.sdc.utils.Pair;
+import com.google.common.base.CaseFormat;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.relevantcodes.extentreports.LogStatus;
+
+import fj.P;
+import fj.data.Either;
+import it.unimi.dsi.fastutil.bytes.ByteSortedSets.SynchronizedSortedSet;
+
+import static java.util.Arrays.asList;
+
+public class SearchFilterCategoryExternalAPI extends ComponentBaseTest {
+
+ private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
+
+ protected Config config = Config.instance();
+ protected String contentTypeHeaderData = "application/json";
+ protected String acceptHeaderDate = "application/json";
+
+ protected Gson gson = new Gson();
+ protected JSONParser jsonParser = new JSONParser();
+
+ @BeforeMethod
+ public void init() throws Exception{
+ AtomicOperationUtils.createDefaultConsumer(true);
+ }
+
+ ;
+ @Rule
+ public static TestName name = new TestName();
+
+ public SearchFilterCategoryExternalAPI() {
+ super(name, SearchFilterCategoryExternalAPI.class.getName());
+
+ }
+
+ // Search for invalid resourceType
+ @Test
+ public void searchWithInvalidFilter() throws Exception {
+ RestResponse restResponse = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "invalid", ResourceTypeEnum.VFC.toString());
+
+ Integer expectedResponseCode = 400;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+
+ List<String> variables = Arrays.asList("resourceTypeinvalid", "[resourceType, subCategory, category]");
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_FILTER_KEY.name(), variables, restResponse.getResponse());
+
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "invalid=" + ResourceTypeEnum.VFC.toString());
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_FILTER_KEY.name());
+ expectedExternalAudit.setDESC(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
+ expectedExternalAudit.setSTATUS("400");
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+ AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
+ }
+
+ @DataProvider(name="searchForResourceTypeNegativeTest")
+ public static Object[][] dataProviderSearchForResourceTypeNegativeTest() {
+ return new Object[][] {
+ {"invalidResourceType"},
+ {""}
+ };
+ }
+
+ // Search for invalid resourceType
+ @Test(dataProvider="searchForResourceTypeNegativeTest")
+ public void searchForResourceTypeNegativeTest(String resourceType) throws Exception {
+ RestResponse restResponse = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue(), resourceType);
+
+ Integer expectedResponseCode = 400;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+
+ List<String> variables = Arrays.asList();
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), variables, restResponse.getResponse());
+
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + resourceType);
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
+ expectedExternalAudit.setDESC(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
+ expectedExternalAudit.setSTATUS("400");
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+ AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
+ }
+
+ // Searching for resource filter incorrect resource type using external API
+ @Test
+ public void searchingForResouceFilterIncorrectResouceTypeUsingExternalAPI() throws Exception {
+ Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+ List<String> createdResoucesName = new ArrayList<String>();
+ createdResoucesName.add(resource.getName());
+
+ for(ResourceTypeEnum resourceTypeEnum: ResourceTypeEnum.values()) {
+ // Create resource for each type so it will not return 404
+ AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(resourceTypeEnum, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+
+ RestResponse restResponse = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue(), resourceTypeEnum.toString());
+
+ Integer expectedResponseCode = 200;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+ if(resourceTypeEnum == ResourceTypeEnum.VF) {
+ validateJsonContainResource(restResponse.getResponse(), createdResoucesName, true);
+ } else {
+ validateJsonContainResource(restResponse.getResponse(), createdResoucesName, false);
+ }
+
+
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + resourceTypeEnum.toString());
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+ AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
+ }
+ }
+
+ // Searching for several resource types using external API
+ @Test
+ public void searchingForSeveralResouceTypesUsingExternalAPI() throws Exception {
+ for(ResourceTypeEnum resourceTypeEnum: ResourceTypeEnum.values()) {
+ List<String> createdResoucesName = new ArrayList<String>();
+ Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(resourceTypeEnum, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+ createdResoucesName.add(resource.getName());
+
+ RestResponse restResponse = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue(), resourceTypeEnum.toString());
+
+ Integer expectedResponseCode = 200;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+ validateJsonContainResource(restResponse.getResponse(), createdResoucesName, true);
+
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + resourceTypeEnum.toString());
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_URL, expectedExternalAudit.getRESOURCE_URL());
+ AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), body);
+ }
+ }
+
+ // Searching for several resources of type VFCMT using external API
+ @Test
+ public void searchingForSeveralResourcesOfTypeVFCMTUsingExternalAPI() throws Exception {
+ Random random = new Random();
+ int numberOfResouceToCreate = random.nextInt(5) + 1;
+ List<String> createdResoucesName = new ArrayList<String>();
+
+ for(int i=0; i<numberOfResouceToCreate; i++) {
+
+ Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFCMT, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+ createdResoucesName.add(resource.getName());
+ }
+
+ RestResponse restResponse = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue(), ResourceTypeEnum.VFCMT.toString());
+
+ Integer expectedResponseCode = 200;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+ validateJsonContainResource(restResponse.getResponse(), createdResoucesName, true);
+
+ ExpectedExternalAudit expectedExternalAudit = ElementFactory.getDefaultExternalAuditObject(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_FILTERED_ASSET_LIST, "?" + SearchCriteriaEnum.RESOURCE_TYPE.getValue() + "=" + ResourceTypeEnum.VFCMT.toString());
+ AuditValidationUtils.validateAuditExternalSearchAPI(expectedExternalAudit, AuditingActionEnum.GET_FILTERED_ASSET_LIST.getName(), null);
+ }
+
+
+
+ @DataProvider(name="normativeResourceCategory")
+ public static Object[][] dataProviderNormativeResourceCategory() {
+ return new Object[][] {
+ {ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE},
+ {ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE},
+ };
+ }
+
+ // Verify exist of normative resource category from data provider
+ @Test(dataProvider="normativeResourceCategory")
+ public void normativeResourceCategory(ResourceCategoryEnum resourceCategoryEnum) throws Exception {
+ RestResponse restResponse = CategoryRestUtils.getAllCategories(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), "resources");
+ validateJsonContainResourceCategory(restResponse.getResponse(), resourceCategoryEnum);
+
+ Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, resourceCategoryEnum, UserRoleEnum.DESIGNER, true).left().value();
+ List<String> createdResoucesName = new ArrayList<String>();
+ createdResoucesName.add(resource.getName());
+
+ restResponse = ResourceRestUtils.getResourceListFilterByCategory(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), resourceCategoryEnum.getCategory());
+
+ Integer expectedResponseCode = 200;
+ Assert.assertEquals(restResponse.getErrorCode(), expectedResponseCode);
+ validateJsonContainResource(restResponse.getResponse(), createdResoucesName, true);
+ }
+
+ protected void validateJsonContainResource(String json, List<String> resourceNameList, Boolean willBeFound) {
+ int lenResourceNameList = resourceNameList.size();
+ Gson gson = new Gson();
+ JsonElement jsonElement = new JsonParser().parse(json);
+ JsonArray jsonArray = jsonElement.getAsJsonArray();
+ for(JsonElement jElement: jsonArray) {
+ ResourceReqDetails jResource = gson.fromJson(jElement, ResourceReqDetails.class);
+
+ if(resourceNameList.contains(jResource.getName())) {
+ resourceNameList.remove(jResource.getName());
+ }
+ }
+
+ if(resourceNameList.size() != 0 && willBeFound) {
+ Assert.assertTrue(false, "Created resource not found on search filtered by category.");
+ } else if (lenResourceNameList != resourceNameList.size() & !willBeFound) {
+ Assert.assertTrue(false, "Some of the resources found when expect that no resource will be found.");
+ }
+ }
+
+
+
+ protected void validateJsonContainResourceCategory(String json, ResourceCategoryEnum resourceCategoryEnum) {
+ Gson gson = new Gson();
+ JsonElement jelement = new JsonParser().parse(json);
+ JsonArray jsonArray = jelement.getAsJsonArray();
+ for(JsonElement jsonElement : jsonArray){
+ CategoryDefinition categoryDefinition = gson.fromJson(jsonElement, CategoryDefinition.class);
+
+ if(categoryDefinition.getName().equals(resourceCategoryEnum.getCategory())) {
+ for(SubCategoryDefinition subcategory: categoryDefinition.getSubcategories()) {
+ if(subcategory.getName().equals(resourceCategoryEnum.getSubCategory())) {
+ return;
+ }
+ }
+ }
+
+ }
+
+ Assert.assertTrue(false, "Category and subcategory not found in categories list.");
+ }
+
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java
index bb86f8f336..3264efb280 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.ci.tests.execute.devCI;
+import static org.testng.AssertJUnit.assertEquals;
+
import java.util.HashMap;
import java.util.Map;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/VFCMTExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/VFCMTExternalAPI.java
new file mode 100644
index 0000000000..955b501db1
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/VFCMTExternalAPI.java
@@ -0,0 +1,390 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.devCI;
+
+import static java.util.Arrays.asList;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.simple.parser.JSONParser;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.SearchCriteriaEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+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.rest.AssetRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtilsExternalAPI;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+
+public class VFCMTExternalAPI extends ComponentBaseTest {
+
+ private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName());
+ protected static final String UPLOAD_ARTIFACT_PAYLOAD = "UHVUVFktVXNlci1LZXktRmlsZS0yOiBzc2gtcnNhDQpFbmNyeXB0aW9uOiBhZXMyNTYtY2JjDQpDb21tZW5wOA0K";
+ protected static final String UPLOAD_ARTIFACT_NAME = "TLV_prv.ppk";
+
+ protected Config config = Config.instance();
+ protected String contentTypeHeaderData = "application/json";
+ protected String acceptHeaderDate = "application/json";
+
+
+
+ protected Gson gson = new Gson();
+ protected JSONParser jsonParser = new JSONParser();
+
+
+ protected String serviceVersion;
+ protected ResourceReqDetails resourceDetails;
+ protected User sdncUserDetails;
+ protected ServiceReqDetails serviceDetails;
+
+
+ @BeforeMethod
+ public void init() throws Exception{
+ AtomicOperationUtils.createDefaultConsumer(true);
+ }
+
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public VFCMTExternalAPI() {
+ super(name, VFCMTExternalAPI.class.getName());
+
+ }
+
+ // Create VFCMT - validate response + search external api + retrieve metadata via external api - success flow
+ @Test
+ public void createVfcmt() throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails defaultResource = ElementFactory.getDefaultResourceByType("ci", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ RestResponse restResponse = ResourceRestUtilsExternalAPI.createResource(defaultResource, defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(restResponse.getResponse(), ResourceAssetStructure.class);
+
+ // auditing verification
+ AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(parsedCreatedResponse.getName());
+ AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);
+
+ // search for vfcmt via external api - validate created resource exist
+ RestResponse searchResult = ResourceRestUtils.getResourceListFilterByCriteria(ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), AssetTypeEnum.RESOURCES.getValue(), SearchCriteriaEnum.RESOURCE_TYPE.getValue(), ResourceTypeEnum.VFCMT.toString());
+ JsonArray listSearchResult = gson.fromJson(searchResult.getResponse(), JsonArray.class);
+ boolean found = false;
+ for(JsonElement result: listSearchResult) {
+ ResourceAssetStructure parsedResult = gson.fromJson(result, ResourceAssetStructure.class);
+ if(parsedResult.getName().equals(defaultResource.getName())) {
+ found = true;
+ }
+ }
+ Assert.assertEquals(found, true);
+
+ // get created vfcmt metadata via external api - validate data
+ RestResponse resourceMetadata = AssetRestUtils.getAssetMetadataByAssetTypeAndUuid(true, AssetTypeEnum.RESOURCES, parsedCreatedResponse.getUuid());
+ ResourceAssetStructure parsedMetadata = gson.fromJson(resourceMetadata.getResponse(), ResourceAssetStructure.class);
+
+ Assert.assertEquals(parsedCreatedResponse.getUuid(), parsedMetadata.getUuid());
+ Assert.assertEquals(parsedCreatedResponse.getInvariantUUID(), parsedMetadata.getInvariantUUID());
+ Assert.assertEquals(parsedCreatedResponse.getName(), parsedMetadata.getName());
+ Assert.assertEquals(parsedCreatedResponse.getVersion(), parsedMetadata.getVersion());
+ Assert.assertEquals(parsedCreatedResponse.getCategory(), parsedMetadata.getCategory());
+ Assert.assertEquals(parsedCreatedResponse.getSubCategory(), parsedMetadata.getSubCategory());
+ Assert.assertEquals(parsedCreatedResponse.getResourceType(), parsedMetadata.getResourceType());
+ Assert.assertEquals(parsedCreatedResponse.getLifecycleState(), parsedMetadata.getLifecycleState());
+ Assert.assertEquals(parsedCreatedResponse.getLastUpdaterUserId(), parsedMetadata.getLastUpdaterUserId());
+ Assert.assertEquals(parsedCreatedResponse.getLastUpdaterFullName(), parsedMetadata.getLastUpdaterFullName());
+ Assert.assertEquals(parsedCreatedResponse.getToscaResourceName(), parsedMetadata.getToscaResourceName());
+ }
+
+
+
+ // Create two VFCMT with same name - validate error + audit - failure flow
+ @Test
+ public void createTwoVfcmtWithSameName() throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails defaultResource = ElementFactory.getDefaultResourceByType("ci", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ // create vfcmt
+ RestResponse firstTryToCreate = ResourceRestUtilsExternalAPI.createResource(defaultResource, defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(firstTryToCreate.getResponse(), ResourceAssetStructure.class);
+
+ // auditing verification
+ AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, parsedCreatedResponse.getName());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(parsedCreatedResponse.getName());
+ AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);
+
+ // try to create another vfcmt wit same name
+ RestResponse secondTryToCreate = ResourceRestUtilsExternalAPI.createResource(defaultResource, defaultUser);
+ Assert.assertEquals((int)secondTryToCreate.getErrorCode(), 409);
+
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, "409");
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name());
+ List<String> variables = asList(ComponentTypeEnum.RESOURCE.getValue(), defaultResource.getName());
+ expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
+ expectedResourceAuditJavaObject.setStatus("409");
+ AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);
+ }
+
+
+
+ @DataProvider(name="createVfcmtVariousFailureFlows")
+ public static Object[][] dataProviderCreateVfcmtVariousFailureFlows() {
+ return new Object[][] {
+ {"name_missing"},
+ {"name_to_long"},
+ {"name_with_invalid_char"},
+ {"description_missing"},
+ {"description_to_long"},
+ {"description_with_invalid_char"},
+ {"resource_type_missing"},
+ {"resource_type_invalid"},
+ {"category_type_missing"},
+ {"category_type_invalid"},
+ {"subcategory_type_missing"},
+ {"subcategory_type_invalid"},
+ {"vendor_name_missing"},
+ {"vendor_name_to_long"},
+ {"vendor_name_with_invalid_char"},
+ {"vendor_release_missing"},
+ {"vendor_release_to_long"},
+ {"vendor_release_with_invalid_char"},
+ {"tags_missing"},
+ {"tags_to_long"},
+ {"tags_invalid"},
+ {"icon_missing"},
+ {"contact_id_missing"},
+ {"contact_id_invalid"},
+ };
+ }
+
+ // Various failure flows
+ @Test(dataProvider="createVfcmtVariousFailureFlows")
+ public void createVfcmtVariousFailureFlows(String flow) throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails defaultResource = ElementFactory.getDefaultResourceByType("ci", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ ErrorInfo errorInfo = null;
+ List<String> variables = null;
+ AuditingActionEnum action = AuditingActionEnum.CREATE_RESOURCE_BY_API;
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultCreateResourceExternalAPI(defaultResource.getName());
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, defaultResource.getName());
+
+ switch (flow) {
+ case "name_missing":
+ defaultResource.setName("");
+ List<String> resourceTags = defaultResource.getTags();
+ resourceTags.add("");
+ defaultResource.setTags(resourceTags);
+ expectedResourceAuditJavaObject.setResourceName("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_COMPONENT_NAME.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "");
+ break;
+ case "name_to_long":
+ defaultResource.setName("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
+ expectedResourceAuditJavaObject.setResourceName("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue(), "1024");
+
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
+ break;
+ case "name_with_invalid_char":
+ defaultResource.setName("!@#$%^&*(");
+ expectedResourceAuditJavaObject.setResourceName("!@#$%^&*(");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_COMPONENT_NAME.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, "!@#$%^&*(");
+ break;
+ case "description_missing":
+ defaultResource.setDescription("");
+ expectedResourceAuditJavaObject.setDesc("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "description_to_long":
+ defaultResource.setDescription("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
+ expectedResourceAuditJavaObject.setDesc("asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1asdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjklasdfghjk1");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue(), "1024");
+ break;
+ case "description_with_invalid_char":
+ defaultResource.setDescription("\uC2B5");
+ expectedResourceAuditJavaObject.setDesc("t");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INVALID_DESCRIPTION.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+// // TODO: defect on the flow - need to get error instead create VFC
+// case "resource_type_missing":
+// defaultResource.setResourceType("");
+// expectedResourceAuditJavaObject.setResourceType("");
+// errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_DESCRIPTION.name());
+// variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+// break;
+ // TODO: in audit RESOURCE_NAME is empty
+ case "resource_type_invalid":
+ defaultResource.setResourceType("invalid");
+ expectedResourceAuditJavaObject.setResourceType("invalid");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "category_type_missing":
+ defaultResource.setCategory("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_CATEGORY.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ // TODO: not correct response code in this flow - 500 instead 400
+ case "category_type_invalid":
+ defaultResource.setCategory("invalid");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INVALID_CATEGORY.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "subcategory_type_missing":
+ defaultResource.setSubcategory("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_SUBCATEGORY.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ // TODO: not correct error - it not missing it not correct
+ case "subcategory_type_invalid":
+ defaultResource.setSubcategory("invalid");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_SUB_CATEGORY_NOT_FOUND_FOR_CATEGORY.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "vendor_name_missing":
+ defaultResource.setVendorName("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_VENDOR_NAME.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "vendor_name_to_long":
+ defaultResource.setVendorName("asdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdff");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT.name());
+ variables = asList("25");
+ break;
+ case "vendor_name_with_invalid_char":
+ defaultResource.setVendorName("!@#$*()&*^%$#@");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_VENDOR_NAME.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "vendor_release_missing":
+ defaultResource.setVendorRelease("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_VENDOR_RELEASE.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "vendor_release_to_long":
+ defaultResource.setVendorRelease("asdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdff");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT.name());
+ variables = asList("25");
+ break;
+ case "vendor_release_with_invalid_char":
+ defaultResource.setVendorRelease("!@#$*()&*^%$#@");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_VENDOR_RELEASE.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "tags_missing":
+ defaultResource.setTags(asList(""));
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_FIELD_FORMAT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue(), "tag");
+ break;
+ case "tags_to_long":
+ defaultResource.setTags(asList("asdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdffasdff"));
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT.name());
+ variables = asList("1024");
+ break;
+ case "tags_invalid":
+ defaultResource.setTags(asList("asfdg"));
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "icon_missing":
+ defaultResource.setIcon("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_ICON.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "att_contact_missing":
+ defaultResource.setContactId("");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_MISSING_CONTACT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ case "att_contact_invalid":
+ default:
+ defaultResource.setContactId("abcderfffdfdfd");
+ errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_INVALID_CONTACT.name());
+ variables = asList(ComponentTypeEnum.RESOURCE.getValue());
+ break;
+ }
+
+ // create vfcmt
+ RestResponse restResponse = ResourceRestUtilsExternalAPI.createResource(defaultResource, defaultUser);
+
+ expectedResourceAuditJavaObject.setStatus("400");
+ expectedResourceAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo, variables));
+ AuditValidationUtils.validateAuditExternalCreateResource(expectedResourceAuditJavaObject, action.getName(), body);
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ValidateConformanceLevel.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ValidateConformanceLevel.java
new file mode 100644
index 0000000000..08e7539b28
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ValidateConformanceLevel.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.devCI;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.utils.CommonBeUtils;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+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.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class ValidateConformanceLevel extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public ValidateConformanceLevel() {
+ super(name, ValidateConformanceLevel.class.getName());
+ }
+
+ @Test
+ public void testValidateServiceConformanceLevel() throws Exception {
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ ServiceReqDetails service = ElementFactory.getDefaultService();
+ RestResponse createdService = ServiceRestUtils.createService(service, user);
+ BaseRestUtils.checkCreateResponse(createdService);
+ Service serviceFirstImport = ResponseParser.parseToObjectUsingMapper(createdService.getResponse(), Service.class);
+ Component serviceObject = AtomicOperationUtils.changeComponentState(serviceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+
+ RestResponse apiRes = ComponentRestUtils.validateConformanceLevel(serviceObject.getUniqueId(), user.getUserId());
+ String result = apiRes.getResponse();
+ assertTrue(apiRes.getErrorCode() == 200);
+ assertTrue(result.equals("true"));
+ }
+
+ @Test
+ public void testValidateConformanceLevel404() throws Exception {
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ RestResponse apiRes = ComponentRestUtils.validateConformanceLevel("fake-uuid-for-test", user.getUserId());
+ assertTrue(apiRes.getErrorCode() == 404);
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java
new file mode 100644
index 0000000000..be32d544ec
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/test1.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.devCI;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+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.DistributionUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils;
+import org.testng.annotations.Test;
+
+import org.openecomp.sdc.utils.DistributionStatusEnum;
+
+import fj.data.Either;
+
+public class test1 extends ComponentBaseTest{
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public test1() {
+ super(name, CRUDExternalAPI.class.getName());
+
+ }
+
+ @Test()
+ public void uploadArtifactOnServiceViaExternalAPI() throws Exception {
+ Config config = Utils.getConfig();
+
+ Service service = AtomicOperationUtils.createServiceByCategory(ServiceCategoriesEnum.MOBILITY, UserRoleEnum.DESIGNER, true).left().value();
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.MODEL_QUERY_SPEC, service, UserRoleEnum.DESIGNER, true, true);
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ if(config.getIsDistributionClientRunning()){
+ List<String> distributionStatusList = Arrays.asList(DistributionNotificationStatusEnum.DOWNLOAD_OK.toString(), DistributionNotificationStatusEnum.DEPLOY_OK.toString(), DistributionNotificationStatusEnum.NOTIFIED.toString());
+ DistributionValidationUtils.validateDistributedArtifactsByAudit(service, distributionStatusList);
+ }
+ }
+
+
+ public static Map<String, String> addVNF_ModuleDeploymentArtifactToMap(Service service, Map<String, String> distributionArtifactMap){
+
+
+ return distributionArtifactMap;
+ }
+
+ public Component getComponentInTargetLifeCycleState(String componentType, UserRoleEnum creatorUser, LifeCycleStatesEnum targetLifeCycleState) throws Exception {
+ Component component = null;
+
+ if(componentType.toLowerCase().equals("vf")) {
+ Either<Resource, RestResponse> createdResource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, creatorUser, true);
+ component = createdResource.left().value();
+ component = AtomicOperationUtils.changeComponentState(component, creatorUser, targetLifeCycleState, true).getLeft();
+ } else {
+ Either<Service, RestResponse> createdResource = AtomicOperationUtils.createDefaultService(creatorUser, true);
+ component = createdResource.left().value();
+ component = AtomicOperationUtils.changeComponentState(component, creatorUser, targetLifeCycleState, true).getLeft();
+ }
+
+ return component;
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
index 6cf5626e7e..255dfd9de2 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
@@ -37,6 +37,7 @@ import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
@@ -45,13 +46,16 @@ import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedDistDownloadAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.ArtifactUtils;
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.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
@@ -103,10 +107,6 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
// serviceBaseVersion = "0.1";
// designerUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
// adminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
- //// resourceDetails =
- // ElementFactory.getDefaultResource("tosca.nodes.newnotgenericresource4testNew",
- // NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS,
- // "jh0003");
// resourceDetails =
// ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
// NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS,
@@ -125,10 +125,6 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
serviceBaseVersion = "0.1";
designerUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
adminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
- // resourceDetails =
- // ElementFactory.getDefaultResource("tosca.nodes.newnotgenericresource4testNew",
- // NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS,
- // "jh0003");
resourceDetails = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, adminUser);
serviceDetails = ElementFactory.getDefaultService();
@@ -538,5 +534,63 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
download_serviceVersionNotFound_inner(serviceDetails.getName(), "0.2", null, null);
}
+
+ @Test
+ public void downloadServiceToscaArtifactSuccess() throws Exception {
+ // Creates service
+ RestResponse serviceResponse = ServiceRestUtils.createService(serviceDetails, designerUser);
+ assertEquals("Check response code after creating resource", 201, serviceResponse.getErrorCode().intValue());
+ Service service = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ // Approves service distribution
+ RestResponse serviceDistributionApproveRes = ServiceRestUtils.approveServiceDistribution(service.getUniqueId(), UserRoleEnum.GOVERNOR.getUserId());
+ service = ResponseParser.convertServiceResponseToJavaObject(serviceDistributionApproveRes.getResponse());
+ // Distributes service
+ RestResponse serviceDistributionRes = AtomicOperationUtils.distributeService(service, true);
+ service = ResponseParser.convertServiceResponseToJavaObject(serviceDistributionRes.getResponse());
+ // Gets tosca template artifact from service
+ ArtifactDefinition toscaTemplateArtifact = service.getToscaArtifacts().get("assettoscatemplate");
+ String expectedPayloadChecksum = toscaTemplateArtifact.getArtifactChecksum();
+ String artifactName = toscaTemplateArtifact.getArtifactName();
+ ArtifactReqDetails artifactDetails = ArtifactUtils.convertArtifactDefinitionToArtifactReqDetails(toscaTemplateArtifact);
+ // Downloads tosca template artifact
+ Map<String, String> authorizationHeaders = new HashMap<String, String>();
+ authorizationHeaders.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, artifactDetails,
+ designerUser, authorizationHeaders);
+ assertEquals("Check response code after download resource", 200, restResponse.getErrorCode().intValue());
+
+ // Validating headers
+ // content disposition
+ List<String> contDispHeaderList = restResponse.getHeaderFields().get(Constants.CONTENT_DISPOSITION_HEADER);
+ assertNotNull(contDispHeaderList);
+ assertEquals("Check content disposition header",
+ new StringBuilder().append("attachment; filename=\"").append(artifactName).append("\"").toString(),
+ contDispHeaderList.get(0));
+
+ // content type
+ List<String> contTypeHeaderList = restResponse.getHeaderFields().get(Constants.CONTENT_TYPE_HEADER);
+ assertNotNull(contTypeHeaderList);
+ assertEquals("Check content type", "application/octet-stream", contTypeHeaderList.get(0));
+ String actualContents = restResponse.getResponse();
+
+ // validating checksum
+ byte[] bytes = actualContents.getBytes();
+ String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(bytes);
+ AssertJUnit.assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
+
+ // validating valid zip
+ InputStream is = new ByteArrayInputStream(bytes);
+ InputStream zis = new ZipInputStream(is);
+ zis.close();
+
+ // validate audit
+ String relativeUrl = encodeUrlForDownload(String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL,
+ ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceBaseVersion, artifactName));
+ String auditAction = "DArtifactDownload";
+ ExpectedDistDownloadAudit expectedDistDownloadAudit = new ExpectedDistDownloadAudit(auditAction,
+ ResourceRestUtils.ecomp, encodeUrlForDownload(relativeUrl), "200", "OK");
+ AuditValidationUtils.validateAudit(expectedDistDownloadAudit, auditAction);
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
index 3325227ebc..80b70d675e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
@@ -114,12 +114,22 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
public void init() {
sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
- resourceDetailsVF_01 = ElementFactory.getDefaultImportResourceByType("VF100", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(), ResourceTypeEnum.VF.toString());
- resourceDetailsVF_02 = ElementFactory.getDefaultResourceByType("VF200", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(), ResourceTypeEnum.VF.toString());
- resourceDetailsVF_03 = ElementFactory.getDefaultResourceByType("VF300", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(), ResourceTypeEnum.VF.toString());
- resourceDetailsCP_01 = ElementFactory.getDefaultResourceByType("CP100", NormativeTypesEnum.PORT, ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(), ResourceTypeEnum.CP.toString());
- serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId());
- serviceDetails_02 = ElementFactory.getDefaultService("newtestservice2", ServiceCategoriesEnum.MOBILITY, sdncDesignerDetails.getUserId());
+ resourceDetailsVF_01 = ElementFactory.getDefaultImportResourceByType("VF100", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
+ ResourceTypeEnum.VF.toString());
+ resourceDetailsVF_02 = ElementFactory.getDefaultResourceByType("VF200", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
+ ResourceTypeEnum.VF.toString());
+ resourceDetailsVF_03 = ElementFactory.getDefaultResourceByType("VF300", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncDesignerDetails.getUserId(),
+ ResourceTypeEnum.VF.toString());
+ resourceDetailsCP_01 = ElementFactory.getDefaultResourceByType("CP100", NormativeTypesEnum.PORT,
+ ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, sdncDesignerDetails.getUserId(),
+ ResourceTypeEnum.CP.toString());
+ serviceDetails_01 = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY,
+ sdncDesignerDetails.getUserId());
+ serviceDetails_02 = ElementFactory.getDefaultService("newtestservice2", ServiceCategoriesEnum.MOBILITY,
+ sdncDesignerDetails.getUserId());
}
@Test
@@ -147,21 +157,33 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
private Service createServiceWithArtifacts() throws Exception {
- ArtifactReqDetails otherArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.OTHER.getType());
-
- RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(otherArtifactDetails, sdncDesignerDetails, serviceDetails_01.getUniqueId());
- assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToService.getErrorCode(), addInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
-
- ArtifactReqDetails yangXmlArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.YANG_XML.getType());
-
- addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(yangXmlArtifactDetails, sdncDesignerDetails, serviceDetails_01.getUniqueId());
- assertTrue("response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :" + addInformationalArtifactToService.getErrorCode(), addInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ ArtifactReqDetails otherArtifactDetails = ElementFactory
+ .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.OTHER.getType());
+
+ RestResponse addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(
+ otherArtifactDetails, sdncDesignerDetails, serviceDetails_01.getUniqueId());
+ assertTrue(
+ "response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :"
+ + addInformationalArtifactToService.getErrorCode(),
+ addInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+
+ ArtifactReqDetails yangXmlArtifactDetails = ElementFactory
+ .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.YANG_XML.getType());
+
+ addInformationalArtifactToService = ArtifactRestUtils.addInformationalArtifactToService(yangXmlArtifactDetails,
+ sdncDesignerDetails, serviceDetails_01.getUniqueId());
+ assertTrue(
+ "response code is not BaseRestUtils.STATUS_CODE_SUCCESS, returned :"
+ + addInformationalArtifactToService.getErrorCode(),
+ addInformationalArtifactToService.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
RestResponse createServiceResponse = ServiceRestUtils.getService(serviceDetails_01, sdncDesignerDetails);
return ResponseParser.convertServiceResponseToJavaObject(createServiceResponse.getResponse());
}
- private RestResponse downloadResourceInstanceArtifact(Service service, ComponentInstance ri, ArtifactDefinition artifact) throws Exception {
- String url = String.format(Urls.GET_DOWNLOAD_SERVICE_RI_ARTIFACT, "localhost", "8080", service.getUUID(), ri.getNormalizedName(), artifact.getArtifactUUID());
+ private RestResponse downloadResourceInstanceArtifact(Service service, ComponentInstance ri,
+ ArtifactDefinition artifact) throws Exception {
+ String url = String.format(Urls.GET_DOWNLOAD_SERVICE_RI_ARTIFACT, "localhost", "8080", service.getUUID(),
+ ri.getUniqueId(), artifact.getArtifactUUID());
String userId = sdncDesignerDetails.getUserId();
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
@@ -174,14 +196,16 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
sendAuthorizationRequest();
HttpRequest http = new HttpRequest();
RestResponse response = http.httpSendGet(url, headersMap);
- if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) {
+ if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null
+ && response.getResponse().getBytes().length == 0) {
return null;
}
return response;
}
private RestResponse downloadServiceArtifact(Service service, ArtifactDefinition artifact) throws Exception {
- String url = String.format(Urls.GET_DOWNLOAD_SERVICE_ARTIFACT, "localhost", "8080", service.getUUID(), artifact.getArtifactUUID());
+ String url = String.format(Urls.GET_DOWNLOAD_SERVICE_ARTIFACT, "localhost", "8080", service.getUUID(),
+ artifact.getArtifactUUID());
String userId = sdncDesignerDetails.getUserId();
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
@@ -194,7 +218,8 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
sendAuthorizationRequest();
HttpRequest http = new HttpRequest();
RestResponse response = http.httpSendGet(url, headersMap);
- if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) {
+ if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null
+ && response.getResponse().getBytes().length == 0) {
return null;
}
return response;
@@ -213,7 +238,9 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
}
HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, "{\"consumerName\":\"test\",\"consumerPassword\":\"0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b\",\"consumerSalt\":\"2a1f887d607d4515d4066fe0f5452a50\"}", headersMap);
+ RestResponse response = http.httpSendPost(url,
+ "{\"consumerName\":\"test\",\"consumerPassword\":\"0a0dc557c3bf594b1a48030e3e99227580168b21f44e285c69740b8d5b13e33b\",\"consumerSalt\":\"2a1f887d607d4515d4066fe0f5452a50\"}",
+ headersMap);
if (response.getErrorCode() != 201) {
return null;
}
@@ -223,8 +250,10 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
private Service createServiceWithRIsWithArtifacts() throws Exception {
serviceDetails_02.setUniqueId(serviceDetails_01.getUniqueId());
createTreeCheckedinVFInstances();
- LifecycleRestUtils.changeResourceState(resourceDetailsCP_01, sdncDesignerDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
- createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01, sdncDesignerDetails);
+ LifecycleRestUtils.changeResourceState(resourceDetailsCP_01, sdncDesignerDetails, "0.1",
+ LifeCycleStatesEnum.CHECKIN);
+ createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01,
+ sdncDesignerDetails);
RestResponse updateServiceResp = ServiceRestUtils.updateService(serviceDetails_02, sdncDesignerDetails);
ServiceRestUtils.checkSuccess(updateServiceResp);
getComponentAndValidateRIs(serviceDetails_01, 5, 0);
@@ -233,15 +262,19 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
}
private void createTreeCheckedinVFInstances() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
+ sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
+ sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createSecondVFInstResp);
- RestResponse createThirdVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_03, sdncDesignerDetails);
+ RestResponse createThirdVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_03,
+ sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createThirdVFInstResp);
}
- private Component getComponentAndValidateRIs(ComponentReqDetails componentDetails, int numberOfRIs, int numberOfRelations) throws IOException, Exception {
+ private Component getComponentAndValidateRIs(ComponentReqDetails componentDetails, int numberOfRIs,
+ int numberOfRelations) throws IOException, Exception {
RestResponse getResponse = null;
Component component = null;
@@ -258,42 +291,56 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
Assert.fail("Unsupported type of componentDetails - " + componentDetails.getClass().getSimpleName());
}
ResourceRestUtils.checkSuccess(getResponse);
- int numberOfActualRIs = component.getComponentInstances() != null ? component.getComponentInstances().size() : 0;
- int numberOfActualRelations = component.getComponentInstancesRelations() != null ? component.getComponentInstancesRelations().size() : 0;
+ int numberOfActualRIs = component.getComponentInstances() != null ? component.getComponentInstances().size()
+ : 0;
+ int numberOfActualRelations = component.getComponentInstancesRelations() != null
+ ? component.getComponentInstancesRelations().size() : 0;
assertEquals("Check number of RIs meet the expected number", numberOfRIs, numberOfActualRIs);
- assertEquals("Check number of RI relations meet the expected number", numberOfRelations, numberOfActualRelations);
+ assertEquals("Check number of RI relations meet the expected number", numberOfRelations,
+ numberOfActualRelations);
return component;
}
- private void createVFInstanceAndAtomicResourceInstanceWithoutCheckin(ResourceReqDetails vf, ResourceReqDetails atomicResource, User user) throws Exception {
+ private void createVFInstanceAndAtomicResourceInstanceWithoutCheckin(ResourceReqDetails vf,
+ ResourceReqDetails atomicResource, User user) throws Exception {
RestResponse createVFInstance = createVFInstance(serviceDetails_01, vf, user);
ResourceRestUtils.checkCreateResponse(createVFInstance);
RestResponse atomicInstanceForService = createAtomicInstanceForService(serviceDetails_01, atomicResource, user);
ResourceRestUtils.checkCreateResponse(atomicInstanceForService);
}
- private RestResponse createCheckedinVFInstance(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
+ private RestResponse createCheckedinVFInstance(ServiceReqDetails containerDetails,
+ ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
changeResourceLifecycleState(compInstOriginDetails, modifier.getUserId(), LifeCycleStatesEnum.CHECKIN);
return createVFInstance(containerDetails, compInstOriginDetails, modifier);
}
- private RestResponse createVFInstance(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
- return createComponentInstance(containerDetails, compInstOriginDetails, modifier, ComponentTypeEnum.SERVICE, true);
+ private RestResponse createVFInstance(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails,
+ User modifier) throws Exception {
+ return createComponentInstance(containerDetails, compInstOriginDetails, modifier, ComponentTypeEnum.SERVICE,
+ true);
}
- private RestResponse createAtomicInstanceForService(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
- return createComponentInstance(containerDetails, compInstOriginDetails, modifier, ComponentTypeEnum.SERVICE, true);
+ private RestResponse createAtomicInstanceForService(ServiceReqDetails containerDetails,
+ ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
+ return createComponentInstance(containerDetails, compInstOriginDetails, modifier, ComponentTypeEnum.SERVICE,
+ true);
}
- private RestResponse createComponentInstance(ComponentReqDetails containerDetails, ComponentReqDetails compInstOriginDetails, User modifier, ComponentTypeEnum containerComponentTypeEnum, boolean isHighestLevel) throws IOException, Exception {
- ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getComponentResourceInstance(compInstOriginDetails);
- RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, modifier, containerDetails.getUniqueId(), containerComponentTypeEnum);
+ private RestResponse createComponentInstance(ComponentReqDetails containerDetails,
+ ComponentReqDetails compInstOriginDetails, User modifier, ComponentTypeEnum containerComponentTypeEnum,
+ boolean isHighestLevel) throws IOException, Exception {
+ ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory
+ .getComponentResourceInstance(compInstOriginDetails);
+ RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(
+ resourceInstanceReqDetails, modifier, containerDetails.getUniqueId(), containerComponentTypeEnum);
return createResourceInstanceResponse;
}
- private void changeResourceLifecycleState(ResourceReqDetails resourceDetails, String userId, LifeCycleStatesEnum lifeCycleStates) throws Exception {
- RestResponse response = LifecycleRestUtils.changeResourceState(resourceDetails, userId, lifeCycleStates);
+ private void changeResourceLifecycleState(ResourceReqDetails resourceDetails, String userUserId,
+ LifeCycleStatesEnum lifeCycleStates) throws Exception {
+ RestResponse response = LifecycleRestUtils.changeResourceState(resourceDetails, userUserId, lifeCycleStates);
LifecycleRestUtils.checkLCS_Response(response);
}
@@ -324,7 +371,7 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
private void importVfWithArtifacts(ImportReqDetails resourceDetailsVF_01) throws Exception {
String payloadName = "VF_RI2_G4_withArtifacts.csar";
- Path path = Paths.get(rootPath + "/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar");
+ Path path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts.csar");
byte[] data = Files.readAllBytes(path);
String payloadData = Base64.encodeBase64String(data);
resourceDetailsVF_01.setPayloadData(payloadData);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/LifeCycleExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/LifeCycleExternalAPI.java
new file mode 100644
index 0000000000..510d8076be
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/LifeCycleExternalAPI.java
@@ -0,0 +1,270 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.externalapi;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.DbUtils;
+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.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtilsExternalAPI;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.gson.Gson;
+
+public class LifeCycleExternalAPI extends ComponentBaseTest{
+ @Rule
+ public static final TestName name = new TestName();
+ protected Gson gson = new Gson();
+
+ public LifeCycleExternalAPI() {
+ super(name, LifeCycleExternalAPI.class.getName());
+ }
+
+ @BeforeMethod
+ public void setup() {
+ AtomicOperationUtils.createDefaultConsumer(true);
+ }
+
+ @Test
+ public void testReseourceSuccsesfullTransition() throws Exception{
+ ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
+ resourceDetails.setName("ciResource1");
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
+ defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(createResource.getResponse(), ResourceAssetStructure.class);
+ BaseRestUtils.checkCreateResponse(createResource);
+
+ //CHECKIN
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,defaultUser,
+ LifeCycleStatesEnum.CHECKIN,null);
+ //testAudit(defaultUser,parsedCreatedResponse,"0.1",LifeCycleStatesEnum.CHECKOUT.name(),"201","OK");
+
+ //CERTIFICATIONREQUEST
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,defaultUser,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST,null);
+
+ //CERTIFICATIONREQUEST
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
+ LifeCycleStatesEnum.STARTCERTIFICATION,null);
+
+ //CERTIFICATIONREQUEST
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
+ LifeCycleStatesEnum.CERTIFY,"1.0");
+ }
+
+ @Test
+ public void testVFCMTSuccsesfullTransitionDesigner() throws Exception{
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails resourceDetails = ElementFactory.getDefaultResourceByType("ci1", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ RestResponse restResponse = ResourceRestUtilsExternalAPI.createResource(resourceDetails, defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(restResponse.getResponse(), ResourceAssetStructure.class);
+
+ BaseRestUtils.checkCreateResponse(restResponse);
+
+ //CHECKIN
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CHECKIN,null);
+
+ //CERTIFICATIONREQUEST
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CERTIFY,"1.0");
+ }
+
+ @Test
+ public void testVFCMTSuccsesfullTransitionTester() throws Exception{
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails resourceDetails = ElementFactory.getDefaultResourceByType("ci1", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ RestResponse restResponse = ResourceRestUtilsExternalAPI.createResource(resourceDetails, defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(restResponse.getResponse(), ResourceAssetStructure.class);
+
+ BaseRestUtils.checkCreateResponse(restResponse);
+
+ //CHECKIN
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CHECKIN,null);
+
+ //CERTIFICATIONREQUEST
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
+ LifeCycleStatesEnum.CERTIFY,"1.0");
+ }
+
+ @Test
+ public void testVFCMTFailSubmitForTesting() throws Exception{
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ResourceExternalReqDetails resourceDetails = ElementFactory.getDefaultResourceByType("ci1", ResourceCategoryEnum.TEMPLATE_MONITORING_TEMPLATE, defaultUser.getUserId(), ResourceTypeEnum.VFCMT.toString());
+
+ RestResponse restResponse = ResourceRestUtilsExternalAPI.createResource(resourceDetails, defaultUser);
+ ResourceAssetStructure parsedCreatedResponse = gson.fromJson(restResponse.getResponse(), ResourceAssetStructure.class);
+
+ BaseRestUtils.checkCreateResponse(restResponse);
+
+ //CHECKIN
+ testResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CHECKIN,null);
+
+ //CERTIFICATIONREQUEST
+ testFailResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST,400,ActionStatus.RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID.name(),Arrays.asList(LifeCycleStatesEnum.CERTIFICATIONREQUEST.getState()));
+
+ //CERTIFICATIONREQUEST
+ testFailResourceTransitionOfLifeCycle(parsedCreatedResponse,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.STARTCERTIFICATION,400,ActionStatus.RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID.name(),Arrays.asList(LifeCycleStatesEnum.STARTCERTIFICATION.getState()));
+ }
+
+ //@Test
+ public void testServiceSuccsesfullTransition() throws Exception{
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
+ serviceDetails.setName("ciService1");
+ RestResponse createService = ServiceRestUtils.createService(serviceDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ ServiceAssetStructure parsedCreatedService = gson.fromJson(createService.getResponse(), ServiceAssetStructure.class);
+ BaseRestUtils.checkCreateResponse(createService);
+
+ //CHECKIN
+ testServiceTransitionOfLifeCycle(serviceDetails, parsedCreatedService,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CHECKIN,null);
+
+ //CERTIFICATIONREQUEST
+ testServiceTransitionOfLifeCycle(serviceDetails, parsedCreatedService,ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER),
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST,null);
+
+ //CERTIFICATIONREQUEST
+ testServiceTransitionOfLifeCycle(serviceDetails, parsedCreatedService,ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
+ LifeCycleStatesEnum.STARTCERTIFICATION,null);
+
+ //CERTIFICATIONREQUEST
+ testServiceTransitionOfLifeCycle(serviceDetails, parsedCreatedService,ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
+ LifeCycleStatesEnum.CERTIFY,"1.0");
+ }
+
+ private void testFailResourceTransitionOfLifeCycle(ResourceAssetStructure parsedCreatedResponse, User user,
+ LifeCycleStatesEnum lifeCycleStatesEnum,int errorCode, String error,List<String> variables) throws IOException, JSONException {
+ RestResponse response = LifecycleRestUtils.changeExternalResourceState(parsedCreatedResponse.getUuid(),user, lifeCycleStatesEnum);
+ AssertJUnit.assertNotNull("check response object is not null", response);
+ AssertJUnit.assertNotNull("check error code exists in response", response.getErrorCode());
+ AssertJUnit.assertEquals("Check response code is succses", errorCode, response.getErrorCode().intValue());
+
+ ErrorValidationUtils.checkBodyResponseOnError(error, variables,response.getResponse());
+ }
+
+ private void testResourceTransitionOfLifeCycle(ResourceAssetStructure parsedCreatedResponse, User user,
+ LifeCycleStatesEnum lifeCycleStatesEnum,String version) throws IOException {
+ RestResponse response = LifecycleRestUtils.changeExternalResourceState(parsedCreatedResponse.getUuid(),user, lifeCycleStatesEnum);
+ AssertJUnit.assertNotNull("check response object is not null", response);
+ AssertJUnit.assertNotNull("check error code exists in response", response.getErrorCode());
+ AssertJUnit.assertEquals("Check response code is succses", 201, response.getErrorCode().intValue());
+ ResourceAssetStructure parsedMetadata = gson.fromJson(response.getResponse(), ResourceAssetStructure.class);
+
+ Assert.assertEquals(parsedMetadata.getUuid(),parsedCreatedResponse.getUuid());
+ Assert.assertEquals(parsedMetadata.getInvariantUUID(),parsedCreatedResponse.getInvariantUUID());
+ Assert.assertEquals(parsedMetadata.getName(),parsedCreatedResponse.getName());
+ if (version==null){
+ Assert.assertEquals(parsedMetadata.getVersion(),parsedCreatedResponse.getVersion());
+ } else {
+ Assert.assertEquals(parsedMetadata.getVersion(),version);
+ }
+ Assert.assertEquals(parsedMetadata.getResourceType(),parsedCreatedResponse.getResourceType());
+ Assert.assertEquals(parsedMetadata.getLifecycleState(),lifeCycleStatesEnum.getComponentState());
+ Assert.assertEquals(parsedMetadata.getLastUpdaterUserId(),user.getUserId());
+ Assert.assertEquals(parsedMetadata.getLastUpdaterFullName(),user.getFullName());
+ }
+
+ private void testServiceTransitionOfLifeCycle(ServiceReqDetails resourceDetails,
+ ServiceAssetStructure parsedCreatedResponse, User user, LifeCycleStatesEnum lifeCycleStatesEnum,String version) throws IOException {
+ RestResponse response = LifecycleRestUtils.changeExternalServiceState(resourceDetails,user, lifeCycleStatesEnum);
+ AssertJUnit.assertNotNull("check response object is not null", response);
+ AssertJUnit.assertNotNull("check error code exists in response", response.getErrorCode());
+ AssertJUnit.assertEquals("Check response code is succses", 201, response.getErrorCode().intValue());
+ ServiceAssetStructure parsedMetadata = gson.fromJson(response.getResponse(), ServiceAssetStructure.class);
+
+ Assert.assertEquals(parsedMetadata.getUuid(),parsedCreatedResponse.getUuid());
+ Assert.assertEquals(parsedMetadata.getInvariantUUID(),parsedCreatedResponse.getInvariantUUID());
+ Assert.assertEquals(parsedMetadata.getName(),parsedCreatedResponse.getName());
+ if (version==null){
+ Assert.assertEquals(parsedMetadata.getVersion(),parsedCreatedResponse.getVersion());
+ } else {
+ Assert.assertEquals(parsedMetadata.getVersion(),version);
+ }
+ Assert.assertEquals(parsedMetadata.getLifecycleState(),lifeCycleStatesEnum.getComponentState());
+ Assert.assertEquals(parsedMetadata.getLastUpdaterUserId(),user.getUserId());
+ }
+
+ private void testAudit(User modifier,ResourceAssetStructure resource,String prevVersion,String prevLifecycle,
+ String errorCode, String error) throws Exception{
+ DbUtils.cleanAllAudits();
+
+ //ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(currResource.getActionStatus().name());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+ String auditAction = "ChangeLyfecycleByAPI";
+ expectedResourceAuditJavaObject.setAction(auditAction);
+ expectedResourceAuditJavaObject.setModifierUid(modifier.getUserId());
+ expectedResourceAuditJavaObject.setModifierName(modifier.getFullName());
+ expectedResourceAuditJavaObject.setResourceName(resource.getName());
+ expectedResourceAuditJavaObject.setResourceType("Resource");
+ expectedResourceAuditJavaObject.setPrevVersion(prevVersion);
+ expectedResourceAuditJavaObject.setCurrVersion(resource.getVersion());
+ expectedResourceAuditJavaObject.setPrevState(prevLifecycle);
+ expectedResourceAuditJavaObject.setCurrState(resource.getLifecycleState());
+ expectedResourceAuditJavaObject.setStatus(errorCode);
+// List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams() : new ArrayList<String>());
+// String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
+ expectedResourceAuditJavaObject.setDesc(error);
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, resource.getName());
+ AuditValidationUtils.validateAuditExternalChangeLifecycle(expectedResourceAuditJavaObject, auditAction,body);
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/UserAPIs.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/UserAPIs.java
new file mode 100644
index 0000000000..157f3157b8
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/UserAPIs.java
@@ -0,0 +1,473 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.externalapi;
+
+import static org.testng.AssertJUnit.*;
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
+import org.openecomp.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+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.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.EcompUserRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import fj.data.Either;
+
+import org.testng.Assert;
+
+public class UserAPIs extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public UserAPIs() {
+ super(name, UserAPIs.class.getName());
+ }
+
+ public User adminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+
+
+ @Test
+ public void createUserAllPosibleRoles() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+
+ List<EcompRole> allRoles = getAllRoles();
+
+ for (EcompRole ecompRole2 : allRoles) {
+ try {
+
+ ///get list of users
+ List<EcompUser> allusersList = getAllusersList();
+ int sizeBeforeChange = allusersList.size();
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) ecompRole2.getId());
+ ecompRole.setName(ecompRole2.getName());
+ System.out.println(ecompRole2.getName());
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ ///get list of users verify list size changed
+ allusersList = getAllusersList();
+ int sizeAfterChange = allusersList.size();
+
+ assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange );
+ pushUser = EcompUserRestUtils.pushUser(ecompUser);
+
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+
+ }
+
+ }
+
+ @Test
+ public void createSameUserTwiceTest() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ try {
+
+ ///get list of users
+ List<EcompUser> allusersList = getAllusersList();
+ int sizeBeforeChange = allusersList.size();
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ ///get list of users verify list size changed
+ allusersList = getAllusersList();
+ int sizeAfterChange = allusersList.size();
+
+ assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange );
+ pushUser = EcompUserRestUtils.pushUser(ecompUser);
+
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+
+ }
+
+ @Test
+ public void createSameUserTwiceDiffrentDataTest() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ try {
+ ///get list of users
+ List<EcompUser> allusersList = getAllusersList();
+ int sizeBeforeChange = allusersList.size();
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ ///get list of users verify list size changed
+ allusersList = getAllusersList();
+ int sizeAfterChange = allusersList.size();
+
+ assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange );
+
+ //update role
+ ecompRole.setId((long) 2);
+ ecompRole.setName("DESIGNER");
+ setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+
+ pushUser = EcompUserRestUtils.pushUser(ecompUser);
+
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+
+ }
+
+ @Test
+ public void updateUserRoleTest() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ try {
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ List<EcompRole> userRolesBefore = getUserRoles(ecompUser);
+
+ //update role
+ ecompRole = new EcompRole();
+ ecompRole.setId((long) 2);
+ ecompRole.setName("DESIGNER");
+ List<EcompRole> list= new ArrayList<EcompRole>();
+ list.add(ecompRole);
+
+ EcompUserRestUtils.pushUserRoles(ecompUser.getLoginId(), list);
+
+ List<EcompRole> userRolesAfter = getUserRoles(ecompUser);
+
+ assertFalse("role wasn't changed", userRolesBefore.equals(userRolesAfter));
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+
+ }
+
+ @Test
+ public void addUserCreateResource() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ Resource resource = new Resource();
+
+ try {
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 2);
+ ecompRole.setName("DESIGNER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ UserRoleEnum.DESIGNER.setUserId(ecompUser.getLoginId());
+ resource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+
+ } finally {
+ ResourceRestUtils.deleteResource(resource.getUniqueId(), adminUser.getUserId());
+ deleteUser(ecompUser.getLoginId());
+ }
+
+ }
+
+ @Test
+ public void changeUserRoleWithCheckOutResource() throws Exception {
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ Resource resource = new Resource();
+ try {
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 2);
+ ecompRole.setName("DESIGNER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ UserRoleEnum.DESIGNER.setUserId(ecompUser.getLoginId());
+ resource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+
+ //update role
+ ecompRole = new EcompRole();
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ List<EcompRole> list= new ArrayList<EcompRole>();
+ list.add(ecompRole);
+
+ RestResponse pushUserRoles = EcompUserRestUtils.pushUserRoles(ecompUser.getLoginId(), list);
+// assertTrue("wrong response code :" , pushUserRoles.getErrorCode() == BaseRestUtils.STATUS_CODE_ALREADY_EXISTS);
+
+ } finally {
+ ResourceRestUtils.deleteResource(resource.getUniqueId(), adminUser.getUserId());
+ deleteUser(ecompUser.getLoginId());
+ }
+ }
+
+ @Test
+ public void changeUserRoleWithStartTestingResource() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ Resource resource= new Resource();
+
+ try {
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompRole.setId((long) 2);
+ ecompRole.setName("DESIGNER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ UserRoleEnum.DESIGNER.setUserId(ecompUser.getLoginId());
+
+ resource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true);
+
+
+ //update role
+ ecompRole = new EcompRole();
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ List<EcompRole> list= new ArrayList<EcompRole>();
+ list.add(ecompRole);
+
+ RestResponse pushUserRoles = EcompUserRestUtils.pushUserRoles(ecompUser.getLoginId(), list);
+ BaseRestUtils.checkSuccess(pushUserRoles);
+
+ } finally {
+ ResourceRestUtils.deleteResource(resource.getUniqueId(), adminUser.getUserId());
+ deleteUser(ecompUser.getLoginId());
+ }
+ }
+
+ @Test
+ public void fillAllEcompFields() throws Exception {
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ try {
+
+ ///get list of users
+ List<EcompUser> allusersList = getAllusersList();
+ int sizeBeforeChange = allusersList.size();
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ ecompUser.setOrgId((long) 123);
+ ecompUser.setManagerId("ci4321");
+ ecompUser.setFirstName("firstName");
+ ecompUser.setMiddleInitial("middleInitial");
+ ecompUser.setLastName("lastName");
+ ecompUser.setPhone("phone");
+ ecompUser.setEmail("email@email.com");
+ ecompUser.setHrid("hrid");
+ ecompUser.setOrgUserId("orgUserId");
+ ecompUser.setOrgCode("orgCode");
+ ecompUser.setOrgManagerUserId("ci1234");
+ ecompUser.setJobTitle("jobTitle");
+ ecompUser.setActive(true);
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ ///get list of users verify list size changed
+ allusersList = getAllusersList();
+ int sizeAfterChange = allusersList.size();
+
+ assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange );
+
+ } finally {
+
+ deleteUser(ecompUser.getLoginId());
+ }
+ }
+
+ @Test
+ public void missingMandatoryFieldRole() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ try {
+ ///get list of users
+ List<EcompUser> allusersList = getAllusersList();
+ int sizeBeforeChange = allusersList.size();
+
+ //create user
+ ecompUser.setLoginId(getUser());
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ BaseRestUtils.checkSuccess(pushUser);
+
+ ///get list of users verify list size changed
+ allusersList = getAllusersList();
+ int sizeAfterChange = allusersList.size();
+
+ assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange );
+
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+ }
+
+ @Test
+ public void missingMandatoryFieldATTid() throws Exception {
+
+ EcompUser ecompUser = new EcompUser();
+ EcompRole ecompRole = new EcompRole();
+ try {
+
+ //create user
+ ecompUser.setLoginId("");
+ ecompRole.setId((long) 1);
+ ecompRole.setName("TESTER");
+ Set<EcompRole> setRoles = new HashSet<EcompRole>();
+ setRoles.add(ecompRole);
+ ecompUser.setRoles(setRoles);
+ RestResponse pushUser = EcompUserRestUtils.pushUser(ecompUser);
+ assertTrue("wrong response code :" , pushUser.getErrorCode() == BaseRestUtils.STATUS_CODE_INVALID_CONTENT);
+
+ } finally {
+ deleteUser(ecompUser.getLoginId());
+ }
+
+
+ }
+
+ private List<EcompRole> getUserRoles(EcompUser ecompUser) throws IOException {
+ RestResponse userRoles = EcompUserRestUtils.getUserRoles(ecompUser.getLoginId());
+ Type listType = new TypeToken<List<EcompRole>>() {}.getType();
+ List<EcompRole> roleList = new Gson().fromJson(userRoles.getResponse(), listType);
+ return roleList;
+ }
+
+ private void deleteUser(String userId) throws IOException {
+ User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ defaultUser.setUserId(userId);
+
+ UserRestUtils.deleteUser(defaultUser, adminUser, true);
+ }
+
+ private List<EcompUser> getAllusersList() throws IOException {
+ RestResponse allUsers = EcompUserRestUtils.getAllUsers();
+
+ Type listType = new TypeToken<List<EcompUser>>() {}.getType();
+ List<EcompUser> usersList = new Gson().fromJson(allUsers.getResponse(), listType);
+
+ return usersList;
+ }
+
+ private List<EcompRole> getAllRoles() throws IOException {
+ RestResponse allRoles = EcompUserRestUtils.getAllAvailableRoles();
+
+ Type listType = new TypeToken<List<EcompRole>>() {}.getType();
+ List<EcompRole> availableRoles = new Gson().fromJson(allRoles.getResponse(), listType);
+
+ return availableRoles;
+ }
+
+ private String getUser() {
+
+ String returnMe = "ci"+ new BigInteger(getRandomNumber(4));
+ System.out.println(returnMe);
+
+
+ return returnMe;
+ }
+
+ private static Random rnd = new Random();
+
+ public static String getRandomNumber(int digCount) {
+ StringBuilder sb = new StringBuilder(digCount);
+ for(int i=0; i < digCount; i++)
+ sb.append((char)('0' + rnd.nextInt(10)));
+ return sb.toString();
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
index 83a50baeeb..bc114e22c5 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
@@ -52,6 +52,7 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedAuthenticationAudit
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+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.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
@@ -120,24 +121,30 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
public void init() throws Exception {
sdncUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- Resource resourceObject = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
+ Resource resourceObject = AtomicOperationUtils
+ .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
resourceDetails = new ResourceReqDetails(resourceObject);
Service serviceObject = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
serviceDetails = new ServiceReqDetails(serviceObject);
deploymentArtifact = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
- RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(deploymentArtifact, sdncUserDetails, resourceDetails.getUniqueId());
- AssertJUnit.assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(), response.getErrorCode() == 200);
+ RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(deploymentArtifact,
+ sdncUserDetails, resourceDetails.getUniqueId());
+ AssertJUnit.assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),
+ response.getErrorCode() == 200);
componentInstanceReqDetails = ElementFactory.getDefaultComponentInstance();
// certified resource
response = LifecycleRestUtils.certifyResource(resourceDetails);
- AssertJUnit.assertTrue("certify resource request returned status:" + response.getErrorCode(), response.getErrorCode() == 200);
+ AssertJUnit.assertTrue("certify resource request returned status:" + response.getErrorCode(),
+ response.getErrorCode() == 200);
// add resource instance with HEAT deployment artifact to the service
componentInstanceReqDetails.setComponentUid(resourceDetails.getUniqueId());
- response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncUserDetails, serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
- AssertJUnit.assertTrue("response code is not 201, returned: " + response.getErrorCode(), response.getErrorCode() == 201);
+ response = ComponentInstanceRestUtils.createComponentInstance(componentInstanceReqDetails, sdncUserDetails,
+ serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
+ AssertJUnit.assertTrue("response code is not 201, returned: " + response.getErrorCode(),
+ response.getErrorCode() == 201);
expectedAuthenticationAudit = new ExpectedAuthenticationAudit();
// RestResponse addDeploymentArtifactResponse =
@@ -152,13 +159,18 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
// serviceDetails.getVersion(),
// ValidationUtils.normalizeFileName(deploymentArtifact.getArtifactName()));
- expectedDownloadResourceUrl = String.format(Urls.DISTRIB_DOWNLOAD_RESOURCE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceDetails.getVersion(),
- ValidationUtils.convertToSystemName(resourceDetails.getName()), resourceDetails.getVersion(), ValidationUtils.normalizeFileName(deploymentArtifact.getArtifactName()));
- expectedDownloadResourceUrl = expectedDownloadResourceUrl.substring("/asdc/".length(), expectedDownloadResourceUrl.length());
+ expectedDownloadResourceUrl = String.format(Urls.DISTRIB_DOWNLOAD_RESOURCE_ARTIFACT_RELATIVE_URL,
+ ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceDetails.getVersion(),
+ ValidationUtils.convertToSystemName(resourceDetails.getName()), resourceDetails.getVersion(),
+ ValidationUtils.normalizeFileName(deploymentArtifact.getArtifactName()));
+ expectedDownloadResourceUrl = expectedDownloadResourceUrl.substring("/asdc/".length(),
+ expectedDownloadResourceUrl.length());
- expectedDownloadServiceUrl = String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceDetails.getVersion(),
+ expectedDownloadServiceUrl = String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL,
+ ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceDetails.getVersion(),
ValidationUtils.normalizeFileName(deploymentArtifact.getArtifactName()));
- expectedDownloadServiceUrl = expectedDownloadServiceUrl.substring("/asdc/".length(), expectedDownloadServiceUrl.length());
+ expectedDownloadServiceUrl = expectedDownloadServiceUrl.substring("/asdc/".length(),
+ expectedDownloadServiceUrl.length());
sdncAdminUserDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
consumerDataDefinition = createConsumer();
@@ -185,19 +197,24 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
// RestResponse restResponse =
// ArtifactRestUtils.downloadServiceArtifact(serviceDetails,
// deploymentArtifact, sdncUserDetails, authorizationHeader);
- RestResponse restResponse = ArtifactRestUtils.downloadResourceArtifact(serviceDetails, resourceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
- AssertJUnit.assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
+ RestResponse restResponse = ArtifactRestUtils.downloadResourceArtifact(serviceDetails, resourceDetails,
+ deploymentArtifact, sdncUserDetails, authorizationHeader);
+ AssertJUnit.assertEquals("Check response code after download artifact", 200,
+ restResponse.getErrorCode().intValue());
AssertJUnit.assertFalse(restResponse.getHeaderFields().containsKey(HttpHeaderEnum.WWW_AUTHENTICATE.getValue()));
validateAuditAuthentication(USER, AUTH_SUCCESS, ComponentTypeEnum.RESOURCE);
}
- protected void validateAuditAuthentication(String userName, String AuthStatus, ComponentTypeEnum compType) throws Exception {
+ protected void validateAuditAuthentication(String userName, String AuthStatus, ComponentTypeEnum compType)
+ throws Exception {
if (compType.equals(ComponentTypeEnum.RESOURCE)) {
- expectedAuthenticationAudit = new ExpectedAuthenticationAudit(expectedDownloadResourceUrl, userName, auditAction, AuthStatus);
+ expectedAuthenticationAudit = new ExpectedAuthenticationAudit(expectedDownloadResourceUrl, userName,
+ auditAction, AuthStatus);
} else {
- expectedAuthenticationAudit = new ExpectedAuthenticationAudit(expectedDownloadServiceUrl, userName, auditAction, AuthStatus);
+ expectedAuthenticationAudit = new ExpectedAuthenticationAudit(expectedDownloadServiceUrl, userName,
+ auditAction, AuthStatus);
}
AuditValidationUtils.validateAuthenticationAudit(expectedAuthenticationAudit);
}
@@ -213,9 +230,11 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
@Test
public void sendAuthenticatedRequestWithoutHeadersTest() throws Exception, Exception {
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, new HashMap<String, String>());
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, new HashMap<String, String>());
assertEquals("Check response code after download artifact", 401, restResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_REQUIRED.name(), new ArrayList<String>(), restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_REQUIRED.name(), new ArrayList<String>(),
+ restResponse.getResponse());
assertTrue(restResponse.getHeaderFields().containsKey(WWW_AUTHENTICATE));
List<String> getAuthenticateHeader = restResponse.getHeaderFields().get(WWW_AUTHENTICATE);
assertEquals("www-authenticate header contains more then one value", 1, getAuthenticateHeader.size());
@@ -228,9 +247,11 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
public void sendAuthenticatedRequestTest_userIsNotProvsioned() throws Exception, Exception {
String userName = "shay";
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(userName, "123456");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 403, restResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(), restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(),
+ restResponse.getResponse());
assertFalse(restResponse.getHeaderFields().containsKey(WWW_AUTHENTICATE));
validateAuditAuthentication(userName, AUTH_FAILED_USER_NOT_FOUND, ComponentTypeEnum.SERVICE);
@@ -240,9 +261,11 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
public void sendAuthenticatedRequestTest_userIsNull() throws Exception, Exception {
String userName = "";
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(userName, "123456");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 403, restResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(), restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(),
+ restResponse.getResponse());
assertFalse(restResponse.getHeaderFields().containsKey(WWW_AUTHENTICATE));
validateAuditAuthentication(userName, AUTH_FAILED_USER_NOT_FOUND, ComponentTypeEnum.SERVICE);
@@ -252,9 +275,11 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
public void sendAuthenticatedRequestTest_passwordIsNull() throws Exception, Exception {
String userName = "ci";
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(userName, "");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 403, restResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(), restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(),
+ restResponse.getResponse());
assertFalse(restResponse.getHeaderFields().containsKey(WWW_AUTHENTICATE));
validateAuditAuthentication(userName, AUTH_FAILED_INVALID_PASSWORD, ComponentTypeEnum.SERVICE);
@@ -264,9 +289,11 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
public void sendAuthenticatedRequestTest_passowrdIsNotValidated() throws Exception, Exception {
String userCi = "ci";
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(userCi, "98765");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 403, restResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(), restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.AUTH_FAILED.name(), new ArrayList<String>(),
+ restResponse.getResponse());
assertFalse(restResponse.getHeaderFields().containsKey(HttpHeaderEnum.WWW_AUTHENTICATE.getValue()));
validateAuditAuthentication(userCi, AUTH_FAILED_INVALID_PASSWORD, ComponentTypeEnum.SERVICE);
@@ -279,7 +306,8 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
String encodedUserCredentials = new String(encodeBase64);
Map<String, String> authorizationHeader = new HashMap<String, String>();
authorizationHeader.put(HttpHeaderEnum.AUTHORIZATION.getValue(), encodedUserCredentials);
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 400, restResponse.getErrorCode().intValue());
assertFalse(restResponse.getHeaderFields().containsKey(HttpHeaderEnum.WWW_AUTHENTICATE.getValue()));
@@ -289,11 +317,14 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
@Test(enabled = false)
public void sendTwoAuthenticatedRequestsTest() throws Exception, Exception {
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(USER, PASSWORD);
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
- RestResponse secondRestResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
- assertEquals("Check response code after second download artifact", 200, secondRestResponse.getErrorCode().intValue());
+ RestResponse secondRestResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
+ assertEquals("Check response code after second download artifact", 200,
+ secondRestResponse.getErrorCode().intValue());
}
@Test(enabled = false)
@@ -309,8 +340,10 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
RestResponse createResponse = ConsumerRestUtils.createConsumer(consumer, sdncAdminUserDetails);
BaseRestUtils.checkCreateResponse(createResponse);
- Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(consumer.getConsumerName(), PASSWORD);
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(consumer.getConsumerName(),
+ PASSWORD);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
deleteResponse = ConsumerRestUtils.deleteConsumer(consumer, sdncAdminUserDetails);
@@ -340,8 +373,10 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
RestResponse createResponse = ConsumerRestUtils.createConsumer(consumer, sdncAdminUserDetails);
BaseRestUtils.checkCreateResponse(createResponse);
- Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(consumer.getConsumerName(), PASSWORD);
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader(consumer.getConsumerName(),
+ PASSWORD);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
deleteResponse = ConsumerRestUtils.deleteConsumer(consumer, sdncAdminUserDetails);
@@ -354,7 +389,8 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
@Test(enabled = false)
public void sendAuthenticatedRequestTest_userValidation_3() throws Exception, Exception {
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader("a:", "123456");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
}
@@ -369,7 +405,8 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
@Test(enabled = false)
public void sendAuthenticatedRequestTest_passwordValidation_1() throws Exception, Exception {
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader("A1", "123:456");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
}
@@ -383,7 +420,8 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
// users-configuration.yaml in runtime")
public void sendAuthenticatedRequestTest_passwordValidation_2() throws Exception, Exception {
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader("B2", "Sq123a456B");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
}
@@ -396,7 +434,8 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
// @Ignore("add C3:111T-0-*# to file")
public void sendAuthenticatedRequestTest_passwordValidation_3() throws Exception, Exception {
Map<String, String> authorizationHeader = BaseRestUtils.addAuthorizeHeader("C3", "111T-0-*#");
- RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact, sdncUserDetails, authorizationHeader);
+ RestResponse restResponse = ArtifactRestUtils.downloadServiceArtifact(serviceDetails, deploymentArtifact,
+ sdncUserDetails, authorizationHeader);
assertEquals("Check response code after download artifact", 200, restResponse.getErrorCode().intValue());
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
index 9e1b151c49..1551c99e66 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java
@@ -35,6 +35,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedEcomConsumerAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
@@ -191,29 +192,49 @@ public class ManageEcompConsumerCredentials extends ComponentBaseTest {
}
@Test
- public void createEcompCredentialsByDesigner() throws Exception { // HttpCspUserId header contains Designer UserId
- RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition, sdncDesignerUserDetails);
- assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION, createConsumerRest.getErrorCode().intValue());
+ public void createEcompCredentialsByDesigner() throws Exception { // HttpCspUserId
+ // header
+ // contains
+ // Designer
+ // UserId
+ RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition,
+ sdncDesignerUserDetails);
+ assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION,
+ createConsumerRest.getErrorCode().intValue());
// Get Consumer
RestResponse getConsumerRest = ConsumerRestUtils.getConsumer(consumerDataDefinition, sdncAdminUserDetails);
- assertEquals("Check response code after get Consumer", STATUS_CODE_NOT_FOUND, getConsumerRest.getErrorCode().intValue());
+ assertEquals("Check response code after get Consumer", STATUS_CODE_NOT_FOUND,
+ getConsumerRest.getErrorCode().intValue());
// Audit validation
- AuditValidationUtils.createEcompConsumerAuditFailure(ADD_ECOMP_USER_CREDENTIALS, consumerDataDefinition, sdncDesignerUserDetails, ActionStatus.RESTRICTED_OPERATION);
+ AuditValidationUtils.createEcompConsumerAuditFailure(ADD_ECOMP_USER_CREDENTIALS, consumerDataDefinition,
+ sdncDesignerUserDetails, ActionStatus.RESTRICTED_OPERATION);
}
@Test
- public void createEcompCredentialsByTester() throws Exception { // HttpCspUserId header contains Tester UserId
- RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition, sdncTesterUserDetails);
- assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION, createConsumerRest.getErrorCode().intValue());
+ public void createEcompCredentialsByTester() throws Exception { // HttpCspUserId
+ // header
+ // contains
+ // Tester
+ // UserId
+ RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition,
+ sdncTesterUserDetails);
+ assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION,
+ createConsumerRest.getErrorCode().intValue());
// Get Consumer
RestResponse getConsumerRest = ConsumerRestUtils.getConsumer(consumerDataDefinition, sdncAdminUserDetails);
- assertEquals("Check response code after get Consumer", STATUS_CODE_NOT_FOUND, getConsumerRest.getErrorCode().intValue());
+ assertEquals("Check response code after get Consumer", STATUS_CODE_NOT_FOUND,
+ getConsumerRest.getErrorCode().intValue());
// Audit validation
- AuditValidationUtils.createEcompConsumerAuditFailure(ADD_ECOMP_USER_CREDENTIALS, consumerDataDefinition, sdncTesterUserDetails, ActionStatus.RESTRICTED_OPERATION);
+ AuditValidationUtils.createEcompConsumerAuditFailure(ADD_ECOMP_USER_CREDENTIALS, consumerDataDefinition,
+ sdncTesterUserDetails, ActionStatus.RESTRICTED_OPERATION);
}
@Test
- public void createEcompCredentialsByOps() throws Exception { // HttpCspUserId header contains OPS UserId
+ public void createEcompCredentialsByOps() throws Exception { // HttpCspUserId
+ // header
+ // contains
+ // OPS
+ // UserId
RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition, sdncOpsUserDetails);
assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION,
createConsumerRest.getErrorCode().intValue());
@@ -227,7 +248,13 @@ public class ManageEcompConsumerCredentials extends ComponentBaseTest {
}
@Test
- public void createEcompCredentialsByGovernor() throws Exception { // HttpCspUserId header contains Governor UserId Create Consumer
+ public void createEcompCredentialsByGovernor() throws Exception { // HttpCspUserId
+ // header
+ // contains
+ // Governor
+ // UserId
+ // Create
+ // Consumer
RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition,
sdncGovernorUserDetails);
assertEquals("Check response code after create Consumer", STATUS_CODE_RESTRICTED_OPERATION,
@@ -751,11 +778,11 @@ public class ManageEcompConsumerCredentials extends ComponentBaseTest {
ADD_ECOMP_USER_CREDENTIALS);
}
- // USER_ID (USER_ID is taken from USER_ID header)
+ // UserId (UserId is taken from USER_ID header)
@Test
public void createEcompCredentialsHttpCspUserIdIsEmpty() throws Exception {
- // USER_ID is taken from USER_ID header
+ // UserId is taken from USER_ID header
sdncAdminUserDetails.setUserId("");
RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition,
sdncAdminUserDetails);
@@ -775,7 +802,12 @@ public class ManageEcompConsumerCredentials extends ComponentBaseTest {
}
@Test
- public void createEcompCredentialsHttpCspUserIdIsNull() throws Exception { // USER_ID is taken from USER_ID header
+ public void createEcompCredentialsHttpCspUserIdIsNull() throws Exception { // UserId
+ // is
+ // taken
+ // from
+ // USER_ID
+ // header
sdncAdminUserDetails.setUserId(null);
RestResponse createConsumerRest = ConsumerRestUtils.createConsumer(consumerDataDefinition,
sdncAdminUserDetails);
@@ -813,10 +845,10 @@ public class ManageEcompConsumerCredentials extends ComponentBaseTest {
ADD_ECOMP_USER_CREDENTIALS);
}
- // add USER_ID in json body
+ // add UserId in json body
@Test
public void createEcompCredentiaJsonBodyContainLastModfierAtuid() throws Exception {
- // Add USER_ID (not admin) to json - we will ignore and create the user
+ // Add UserId (not admin) to json - we will ignore and create the user
HashMap<String, String> jsonMap = new HashMap<String, String>();
jsonMap.put("consumerName", "benny");
jsonMap.put("consumerPassword", "123456789012345678901234567890ab123456789012345678901234567890ab");
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
index 7aae0e9a4e..e99ecc7303 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
@@ -57,96 +57,125 @@ import org.testng.annotations.Test;
import org.yaml.snakeyaml.Yaml;
public class CsarUtilsTest extends ComponentBaseTest {
-
+
public static final String ASSET_TOSCA_TEMPLATE = "assettoscatemplate";
-
+
@Rule
public static TestName name = new TestName();
-
+
public CsarUtilsTest() {
super(name, CsarUtilsTest.class.getName());
}
-
+
@Test(enabled = true)
public void createServiceCsarBasicTest() throws Exception {
-
+
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
Resource resourceVF = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
-
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.VENDOR_LICENSE, resourceVF, UserRoleEnum.DESIGNER, true, true);
- resourceVF = (Resource) AtomicOperationUtils.changeComponentState(resourceVF, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
+
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.VENDOR_LICENSE, resourceVF, UserRoleEnum.DESIGNER,
+ true, true);
+ resourceVF = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceVF, service, UserRoleEnum.DESIGNER, true);
-
+
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
+
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-
+
byte[] downloadCSAR = downloadCSAR(sdncModifierDetails, service);
-
+
csarBasicValidation(service, downloadCSAR);
}
-
+
@Test(enabled = true)
public void createResourceCsarBasicTest() throws Exception {
Resource resourceVF = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
- resourceVF = (Resource) AtomicOperationUtils.changeComponentState(resourceVF, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ resourceVF = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-
+
byte[] downloadCSAR = downloadCSAR(sdncModifierDetails, resourceVF);
-
+
csarBasicValidation(resourceVF, downloadCSAR);
}
-
+
@Test(enabled = true)
public void createServiceCsarInclDeploymentArtTest() throws Exception {
-
+
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
Resource resourceVF1 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
Resource resourceVF2 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
-
- resourceVF1 = (Resource) AtomicOperationUtils.changeComponentState(resourceVF1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
- resourceVF2 = (Resource) AtomicOperationUtils.changeComponentState(resourceVF2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
+
+ resourceVF1 = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ resourceVF2 = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceVF1, service, UserRoleEnum.DESIGNER, true);
AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceVF2, service, UserRoleEnum.DESIGNER, true);
-
+
AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, service, UserRoleEnum.DESIGNER, true, true);
-
+
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
+
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-
+
byte[] downloadCSAR = downloadCSAR(sdncModifierDetails, service);
-
+
csarBasicValidation(service, downloadCSAR);
-
- validateServiceCsar(resourceVF1, resourceVF2, service, downloadCSAR, 3, 5, 1);
+
+ validateServiceCsar(resourceVF1, resourceVF2, service, downloadCSAR, 3, 3, 1, 0);
}
-
- @Test(enabled = true)
+
+ @Test(enabled = true)
public void createResourceCsarInclDeploymentArtTest() throws Exception {
Resource resourceVF1 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+
AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceVF1, UserRoleEnum.DESIGNER, true, true);
AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT_ARTIFACT, resourceVF1, UserRoleEnum.DESIGNER, true, true);
- resourceVF1 = (Resource) AtomicOperationUtils.changeComponentState(resourceVF1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ resourceVF1 = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-
+
byte[] downloadCSAR = downloadCSAR(sdncModifierDetails, resourceVF1);
-
+
csarBasicValidation(resourceVF1, downloadCSAR);
- //TODO when feature is integrated to OS should modify expected deployment artifacts in csar Artifacts folder to (0,1,1)
- validateVFCsar(resourceVF1, downloadCSAR, 1, 0, 0, 0);
+
+ validateVFCsar(resourceVF1, downloadCSAR, 1, 0, 1, 1, 0, 0, 0);
}
+
+ @Test(enabled = true)
+ public void createResourceCsarInclInformationalArtTest() throws Exception {
+
+ Resource resourceVF1 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceVF1, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceVF1, UserRoleEnum.DESIGNER, false, true);
+
+ resourceVF1 = (Resource) AtomicOperationUtils
+ .changeComponentState(resourceVF1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ byte[] downloadCSAR = downloadCSAR(sdncModifierDetails, resourceVF1);
+
+ csarBasicValidation(resourceVF1, downloadCSAR);
+
+ validateVFCsar(resourceVF1, downloadCSAR, 1, 0, 0, 0, 1, 1, 0);
+ }
+
private void csarBasicValidation(Component mainComponent, byte[] downloadCSAR) {
- try (ByteArrayInputStream ins = new ByteArrayInputStream(downloadCSAR); ZipInputStream zip = new ZipInputStream(ins);) {
+ try (ByteArrayInputStream ins = new ByteArrayInputStream(downloadCSAR);
+ ZipInputStream zip = new ZipInputStream(ins);) {
String resourceYaml = null;
byte[] buffer = new byte[1024];
@@ -157,16 +186,15 @@ public class CsarUtilsTest extends ComponentBaseTest {
while ((len = zip.read(buffer)) > 0) {
sb.append(new String(buffer, 0, len));
}
+ assertTrue(nextEntry.getName().equals("csar.meta"));
- assertTrue(nextEntry.getName().equals("TOSCA-Metadata/TOSCA.meta"));
+ readNextEntry(sb, len, buffer, zip);
- sb.setLength(0);
nextEntry = zip.getNextEntry();
-
- while ((len = zip.read(buffer)) > 0) {
- sb.append(new String(buffer, 0, len));
- }
-
+ assertTrue(nextEntry.getName().equals("TOSCA-Metadata/TOSCA.meta"));
+
+ readNextEntry(sb, len, buffer, zip);
+ nextEntry = zip.getNextEntry();
resourceYaml = sb.toString();
YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
@@ -181,16 +209,22 @@ public class CsarUtilsTest extends ComponentBaseTest {
e.printStackTrace();
}
}
-
- private void validateServiceCsar(Component certifiedVFC1, Component certifiedVFC2, Service fetchedService, byte[] resultByte, int toscaEntryIndexToPass, int generatorEntryIndexToPass, int deploymentArtifactIndexToPass) {
-
+
+ private void validateServiceCsar(Component certifiedVFC1, Component certifiedVFC2, Service fetchedService,
+ byte[] resultByte, int toscaEntryIndexToPass, int generatorEntryIndexToPass,
+ int deploymentArtifactIndexToPass, int informationalArtifactIndexToPass) {
+
// TODO Test to validate everything is right (comment out after testing)
- /*
- * try { FileUtils.writeByteArrayToFile(new File("c:/TestCSAR/" + fetchedService.getName() + ".zip"), resultByte); } catch (IOException e) { // Auto-generated catch block e.printStackTrace(); }
- */
-
- try (ByteArrayInputStream ins = new ByteArrayInputStream(resultByte); ZipInputStream zip = new ZipInputStream(ins);) {
+ /*try {
+ FileUtils.writeByteArrayToFile(new File("c:/TestCSAR/" + fetchedService.getName() + ".zip"), resultByte);
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }*/
+ try (ByteArrayInputStream ins = new ByteArrayInputStream(resultByte);
+ ZipInputStream zip = new ZipInputStream(ins);) {
+
String resourceYaml = null;
byte[] buffer = new byte[1024];
ZipEntry nextEntry = zip.getNextEntry();
@@ -208,6 +242,7 @@ public class CsarUtilsTest extends ComponentBaseTest {
int toscaEntryIndex = 0;
int generatorEntryIndex = 0;
int deploymentArtifactIndex = 0;
+ int informationalArtifactIndex = 0;
String fileName = null;
ArtifactDefinition artifactDefinition;
Component componentToValidate = null;
@@ -232,18 +267,18 @@ public class CsarUtilsTest extends ComponentBaseTest {
if (entryName.contains(serviceFileName)) {
componentToValidate = fetchedService;
fileName = "Definitions/" + serviceFileName;
-
+
assertEquals("Validate entry Name", (fileName), nextEntry.getName());
assertTrue(yamlToObjectConverter.isValidYaml(resourceYaml.getBytes()));
validateContent(resourceYaml, componentToValidate);
++toscaEntryIndex;
continue;
}
-
+
if (entryName.contains(vfc1FileName)) {
componentToValidate = certifiedVFC1;
fileName = "Definitions/" + vfc1FileName;
-
+
assertEquals("Validate entry Name", (fileName), nextEntry.getName());
assertTrue(yamlToObjectConverter.isValidYaml(resourceYaml.getBytes()));
validateContent(resourceYaml, componentToValidate);
@@ -253,7 +288,7 @@ public class CsarUtilsTest extends ComponentBaseTest {
if (entryName.contains(vfc2FileName)) {
componentToValidate = certifiedVFC2;
fileName = "Definitions/" + vfc2FileName;
-
+
assertEquals("Validate entry Name", (fileName), nextEntry.getName());
assertTrue(yamlToObjectConverter.isValidYaml(resourceYaml.getBytes()));
validateContent(resourceYaml, componentToValidate);
@@ -261,38 +296,52 @@ public class CsarUtilsTest extends ComponentBaseTest {
continue;
}
- if (entryName.contains(".xml") && !entryName.startsWith("Artifacts/AAI")) {
+ if (entryName.startsWith("Artifacts/Deployment/MODEL_INVENTORY_PROFILE") && entryName.contains("AAI")) {
+ ++generatorEntryIndex;
+ continue;
+ }
+
+ if (entryName.contains(".xml") && entryName.startsWith("Artifacts/Deployment/") && !entryName.contains("AAI")) {
++deploymentArtifactIndex;
continue;
}
-
- if (entryName.startsWith("Artifacts/AAI")) {
- ++generatorEntryIndex;
+
+ if (entryName.contains(".xml") && entryName.startsWith("Artifacts/Informational/") && !entryName.contains("AAI")) {
+ ++informationalArtifactIndex;
continue;
}
-
+
assertTrue("Unexpected entry: " + entryName, true);
}
assertEquals("Validate amount of entries", toscaEntryIndexToPass, toscaEntryIndex);
assertEquals("Validate amount of generated AAI artifacts", generatorEntryIndexToPass, generatorEntryIndex);
- assertEquals("Validate amount of generated Deployment artifacts", deploymentArtifactIndexToPass, deploymentArtifactIndex);
-
+ assertEquals("Validate amount of Deployment artifacts entries", deploymentArtifactIndexToPass,
+ deploymentArtifactIndex);
+ assertEquals("Validate amount of Informational artifacts entries", informationalArtifactIndexToPass,
+ informationalArtifactIndex);
+
ins.close();
zip.close();
} catch (IOException e) {
e.printStackTrace();
}
}
-
- private void validateVFCsar(Component certifiedVF, byte[] resultByte, int toscaEntryIndexToPass, int ymlDeploymentArtifactIndexToPass, int xmlDeploymentArtifactIndexToPass, int heatEnvDeploymentArtifactIndexToPass) {
-
+
+ private void validateVFCsar(Component certifiedVF, byte[] resultByte, int toscaEntryIndexToPass,
+ int ymlDeploymentArtifactIndexToPass, int xmlDeploymentArtifactIndexToPass, int heatDeploymentArtifactIndexToPass,
+ int ymlInformationalArtifactIndexToPass, int xmlInformationalArtifactIndexToPass, int heatInformationalArtifactIndexToPass) {
+
// TODO Test to validate everything is right (comment out after testing)
- /*
- * try { FileUtils.writeByteArrayToFile(new File("c:/TestCSAR/" + fetchedService.getName() + ".zip"), resultByte); } catch (IOException e) { // Auto-generated catch block e.printStackTrace(); }
- */
-
- try (ByteArrayInputStream ins = new ByteArrayInputStream(resultByte); ZipInputStream zip = new ZipInputStream(ins);) {
+ /*try {
+ FileUtils.writeByteArrayToFile(new File("c:/TestCSAR/" + fetchedService.getName() + ".zip"), resultByte);
+ } catch (IOException e) {
+ // Auto-generated catch block
+ e.printStackTrace();
+ }*/
+ try (ByteArrayInputStream ins = new ByteArrayInputStream(resultByte);
+ ZipInputStream zip = new ZipInputStream(ins);) {
+
String resourceYaml = null;
byte[] buffer = new byte[1024];
ZipEntry nextEntry = zip.getNextEntry();
@@ -303,14 +352,23 @@ public class CsarUtilsTest extends ComponentBaseTest {
sb.append(new String(buffer, 0, len));
}
- assertTrue(nextEntry.getName().equals("TOSCA-Metadata/TOSCA.meta"));
+ assertTrue(nextEntry.getName().equals("csar.meta"));
+ readNextEntry(sb, len, buffer, zip);
+ nextEntry = zip.getNextEntry();
+ assertTrue(nextEntry.getName().equals("TOSCA-Metadata/TOSCA.meta"));
+
+ readNextEntry(sb, len, buffer, zip);
+
YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
int toscaEntryIndex = 0;
- int ymlEntryIndex = 0;
- int xmlArtifactsIndex = 0;
- int heatEnvDeploymentArtifactIndex = 0;
+ int ymlDeploymentArtifactsIndex = 0;
+ int xmlDeploymentArtifactsIndex = 0;
+ int heatDeploymentArtifactIndex = 0;
+ int ymlInformationalArtifactsIndex = 0;
+ int xmlInformationalArtifactsIndex = 0;
+ int heatInformationalArtifactIndex = 0;
String fileName = null;
ArtifactDefinition artifactDefinition;
Component componentToValidate = null;
@@ -319,11 +377,8 @@ public class CsarUtilsTest extends ComponentBaseTest {
String vfFileName = artifactDefinition.getArtifactName();
while ((nextEntry = zip.getNextEntry()) != null) {
- sb.setLength(0);
-
- while ((len = zip.read(buffer)) > 0) {
- sb.append(new String(buffer, 0, len));
- }
+
+ readNextEntry(sb, len, buffer, zip);
String entryName = nextEntry.getName();
@@ -331,7 +386,7 @@ public class CsarUtilsTest extends ComponentBaseTest {
if (entryName.contains(vfFileName)) {
componentToValidate = certifiedVF;
fileName = "Definitions/" + vfFileName;
-
+
assertEquals("Validate entry Name", (fileName), nextEntry.getName());
assertTrue(yamlToObjectConverter.isValidYaml(resourceYaml.getBytes()));
validateContent(resourceYaml, componentToValidate);
@@ -339,35 +394,72 @@ public class CsarUtilsTest extends ComponentBaseTest {
continue;
}
- if (entryName.contains(".xml") && entryName.startsWith("Artifacts/")) {
- ++xmlArtifactsIndex;
- continue;
+ if (entryName.contains(".xml") && entryName.contains("YANG_XML")) {
+ if(entryName.startsWith("Artifacts/Deployment")){
+ ++xmlDeploymentArtifactsIndex;
+ continue;
+ }else if(entryName.startsWith("Artifacts/Informational")){
+ ++xmlInformationalArtifactsIndex;
+ continue;
+ }
}
- if (entryName.contains(".sh") && entryName.startsWith("Artifacts/")) {
- ++heatEnvDeploymentArtifactIndex;
+ if (entryName.contains(".sh") && entryName.contains("HEAT_ARTIFACT")) {
+ if(entryName.startsWith("Artifacts/Deployment")){
+ ++heatDeploymentArtifactIndex;
+ continue;
+ }else if(entryName.startsWith("Artifacts/Informational")){
+ ++heatInformationalArtifactIndex;
+ continue;
+ }
+ }
+
+ if ((entryName.contains(".yml") || entryName.contains(".yaml")) && entryName.contains("HEAT")) {
+ if(entryName.startsWith("Artifacts/Deployment")){
+ ++ymlDeploymentArtifactsIndex;
+ continue;
+ }else if(entryName.startsWith("Artifacts/Informational")){
+ ++ymlInformationalArtifactsIndex;
+ continue;
+ }
+ }
+
+ if(entryName.contains("Definitions/") && entryName.contains("template-interface.yml")){
+ validateInterfaceContent(resourceYaml, certifiedVF);
continue;
}
-
- if (entryName.contains(".yml") && entryName.startsWith("Artifacts/")) {
- ++ymlEntryIndex;
+ if(entryName.contains("Definitions/")) {
+ if(isImportsFileValidation(entryName))
continue;
}
-
+
assertTrue("Unexpected entry: " + entryName, false);
}
+
+ //Definitions folder
assertEquals("Validate amount of entries", toscaEntryIndexToPass, toscaEntryIndex);
- assertEquals("Validate amount of YAML artifacts", ymlDeploymentArtifactIndexToPass, ymlEntryIndex);
- assertEquals("Validate amount of generated XML artifacts", xmlDeploymentArtifactIndexToPass, xmlArtifactsIndex);
- assertEquals("Validate amount of generated HEAT ENV artifacts", heatEnvDeploymentArtifactIndexToPass, heatEnvDeploymentArtifactIndex);
-
+
+ //Deployment folder
+ assertEquals("Validate amount of YAML Deployment artifacts", ymlDeploymentArtifactIndexToPass, ymlDeploymentArtifactsIndex);
+ assertEquals("Validate amount of XML Deployment artifacts", xmlDeploymentArtifactIndexToPass,
+ xmlDeploymentArtifactsIndex);
+ assertEquals("Validate amount of HEAT Deployment artifacts", heatDeploymentArtifactIndexToPass,
+ heatDeploymentArtifactIndex);
+
+ //Informational folder
+ assertEquals("Validate amount of YAML Informational artifacts", ymlInformationalArtifactIndexToPass, ymlInformationalArtifactsIndex);
+ assertEquals("Validate amount of XML Informational artifacts", xmlInformationalArtifactIndexToPass,
+ xmlInformationalArtifactsIndex);
+ assertEquals("Validate amount of HEAT Informational artifacts", heatInformationalArtifactIndexToPass,
+ heatInformationalArtifactIndex);
+
ins.close();
zip.close();
} catch (IOException e) {
e.printStackTrace();
}
}
-
+
private void validateContent(String content, Component component) {
Yaml yaml = new Yaml();
@@ -395,30 +487,34 @@ public class CsarUtilsTest extends ComponentBaseTest {
if (component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
assertEquals("Validate component type", component.getComponentType().getValue(), type);
} else {
- assertEquals("Validate component type", ((Resource) component).getResourceType(), ResourceTypeEnum.valueOf(type));
+ assertEquals("Validate component type", ((Resource) component).getResourceType(),
+ ResourceTypeEnum.valueOf(type));
}
}
-
+
private byte[] downloadCSAR(User sdncModifierDetails, Component createdComponent) throws Exception {
String artifactUniqeId = createdComponent.getToscaArtifacts().get("assettoscacsar").getUniqueId();
RestResponse getCsarResponse = null;
-
+
switch (createdComponent.getComponentType()) {
case RESOURCE:
- getCsarResponse = ArtifactRestUtils.downloadResourceArtifactInternalApi(createdComponent.getUniqueId(), sdncModifierDetails, artifactUniqeId);
- break;
+ getCsarResponse = ArtifactRestUtils.downloadResourceArtifactInternalApi(createdComponent.getUniqueId(),
+ sdncModifierDetails, artifactUniqeId);
+ break;
case SERVICE:
- getCsarResponse = ArtifactRestUtils.downloadServiceArtifactInternalApi(createdComponent.getUniqueId(), sdncModifierDetails, artifactUniqeId);
+ getCsarResponse = ArtifactRestUtils.downloadServiceArtifactInternalApi(createdComponent.getUniqueId(),
+ sdncModifierDetails, artifactUniqeId);
break;
default:
break;
}
-
+
assertNotNull(getCsarResponse);
BaseRestUtils.checkSuccess(getCsarResponse);
- ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(getCsarResponse.getResponse(), ArtifactUiDownloadData.class);
+ ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(getCsarResponse.getResponse(),
+ ArtifactUiDownloadData.class);
assertNotNull(artifactUiDownloadData);
@@ -427,4 +523,48 @@ public class CsarUtilsTest extends ComponentBaseTest {
return decodeBase64;
}
+
+ private void validateInterfaceContent(String content, Component component) {
+ Yaml yaml = new Yaml();
+
+ InputStream inputStream = new ByteArrayInputStream(content.getBytes());
+ @SuppressWarnings("unchecked")
+ Map<String, Object> load = (Map<String, Object>) yaml.load(inputStream);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> node_types = (Map<String, Object>) load.get("node_types");
+ assertNotNull(node_types);
+
+ String toscaInterfaceName = node_types.keySet().stream().filter(p -> p.startsWith("org.openecomp.")).findAny().get();
+ Map<String, Object> toscaInterface = (Map<String, Object>) node_types.get(toscaInterfaceName);
+ assertNotNull(toscaInterface);
+ String derived_from = (String) toscaInterface.get("derived_from");
+ assertNotNull(derived_from);
+ assertEquals("Validate derived from generic", component.getDerivedFromGenericType(), derived_from);
+
+ }
+
+ private void readNextEntry(StringBuffer sb, int len, byte[] buffer, ZipInputStream zip) throws IOException {
+ sb.setLength(0);
+
+ while ((len = zip.read(buffer)) > 0) {
+ sb.append(new String(buffer, 0, len));
+ }
+ }
+
+ private boolean isImportsFileValidation(String fileName) {
+
+ switch(fileName){
+ case "Definitions/artifacts.yml":
+ case "Definitions/capabilities.yml":
+ case "Definitions/data.yml":
+ case "Definitions/groups.yml":
+ case "Definitions/interfaces.yml":
+ case "Definitions/nodes.yml":
+ case "Definitions/policies.yml":
+ case "Definitions/relationships.yml":
+ return true;
+
+ }
+ return false;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
index e4360329ad..192f6759c3 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
@@ -31,130 +31,306 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.stream.Collectors;
import java.util.Optional;
import org.apache.commons.codec.binary.Base64;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstInputsMap;
import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
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.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
import org.openecomp.sdc.common.api.Constants;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.yaml.snakeyaml.Yaml;
import com.google.gson.Gson;
import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
public class ExportToscaTest extends ComponentBaseTest {
@Rule
public static TestName name = new TestName();
+ String rootPath = System.getProperty("user.dir");
+ private static final String CSARS_PATH = "/src/test/resources/CI/csars/";
+ public static String userDefinedNodeYaml = "CustomVL.yml";
public ExportToscaTest() {
super(name, ExportToscaTest.class.getName());
}
- @Test(enabled = true)
- public void exportVfModuleTest() throws Exception {
+ @DataProvider(name = "vfModuleCsar")
+ public static Object[][] csarNames() {
+ return new Object[][] { { "VSPPackage", true }, { "csar_1", true }, { "noArtifact", false }, {"noVfModule", false} };
+// return new Object[][] { { "VSPPackage", true }, { "csar_1", true }, { "noArtifact", false } };
+ }
+
+ @Test(dataProvider = "vfModuleCsar")
+ public void exportVfModuleTest(String csarname, boolean includeGroups) throws Exception {
+ System.out.println("run for csar " + csarname);
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- Resource createdResource = createVfFromCSAR(sdncModifierDetails, "VSPPackage");
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, csarname);
- Map<String, Object> load = downloadAndParseToscaTemplate(sdncModifierDetails, createdResource);
+ validateGroupsInResource(sdncModifierDetails, createdResource, includeGroups);
+ }
+
+ @Test(dataProvider = "vfModuleCsar")
+ public void exportVfModuleInstanceTest(String csarname, boolean includeGroups) throws Exception {
+ System.out.println("run for csar " + csarname);
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, csarname);
+
+ // change state to check in
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(createdResource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+
+ // 2 create service
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // 3 create vf instance in service
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(createdResource);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ List<GroupDefinition> groupsInResource = createdResource.getGroups();
+ int vfModuleCount = 0;
+ List<GroupDefinition> vfModulesInRes = groupsInResource.stream().filter(g -> g.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)).collect(Collectors.toList());
+
+ ComponentInstance componentInstance = service.getComponentInstances().get(0);
+ String normalizedName = componentInstance.getNormalizedName();
+
+ Map<String, Object> load = downloadAndParseToscaTemplate(sdncModifierDetails, service);
assertNotNull(load);
Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template");
assertNotNull(topology_template);
Map<String, Object> groups = (Map<String, Object>) topology_template.get("groups");
- assertNotNull(groups);
- List<GroupDefinition> groupsOrigin = createdResource.getGroups();
+ if (includeGroups) {
+ assertNotNull(vfModulesInRes);
+ assertNotNull(groups);
- assertEquals("Validate groups size", groupsOrigin.size(), groups.size());
- for (GroupDefinition group : groupsOrigin) {
- Map<String, Object> groupTosca = (Map<String, Object>) groups.get(group.getName());
- assertNotNull(groupTosca);
+ assertEquals("Validate count of vf module instanses", vfModulesInRes.size(), groups.size());
- Map<String, Object> metadata = (Map<String, Object>) groupTosca.get("metadata");
- assertNotNull(metadata);
+ vfModulesInRes.forEach(modInRes -> {
+ validateVfModuleVsInstance(normalizedName, groups, modInRes);
+ });
+ }else{
+ assertNull(groups);
+ }
+ }
- String invariantUUID;
- String name;
- String UUID;
- String version;
- Map<String, Object> properties = (Map<String, Object>) groupTosca.get("properties");
-
- if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) {
- invariantUUID = (String) metadata.get("vfModuleModelInvariantUUID");
- name = (String) metadata.get("vfModuleModelName");
- UUID = (String) metadata.get("vfModuleModelUUID");
- version = (String) metadata.get("vfModuleModelVersion");
- assertNotNull(properties);
-
- String vf_module_type = (String) properties.get("vf_module_type");
- List<GroupProperty> props = group.getProperties();
- for (GroupProperty prop : props) {
- if (prop.getName().equals(Constants.IS_BASE)) {
- String value = prop.getValue() == null ? prop.getDefaultValue() : prop.getValue();
- boolean bvalue = Boolean.parseBoolean(value);
- if (bvalue) {
- assertEquals("Validate vf_module_type", "Base", vf_module_type);
- } else {
- assertEquals("Validate vf_module_type", "Expansion", vf_module_type);
- }
- break;
- }
+ private void validateVfModuleVsInstance(String normalizedName, Map<String, Object> groups, GroupDefinition modInRes) {
+ String instName = normalizedName + ".." + modInRes.getName();
+ Map<String, Object> group = (Map<String, Object>) groups.get(instName);
+ assertNotNull(group);
+
+ String type = (String) group.get("type");
+ assertNotNull(type);
+ assertEquals("Validate group instance type", modInRes.getType(), type);
+
+ Map<String, Object> metadata = (Map<String, Object>) group.get("metadata");
+ assertNotNull(metadata);
+
+ String invariantUUID = (String) metadata.get("vfModuleModelInvariantUUID");
+ String name = (String) metadata.get("vfModuleModelName");
+ String UUID = (String) metadata.get("vfModuleModelUUID");
+ String version = (String) metadata.get("vfModuleModelVersion");
+
+ String customizationUUID = (String) metadata.get("vfModuleModelCustomizationUUID");
+ assertNotNull("Validate group instance customizationUUID", customizationUUID);
+
+ assertEquals("Validate group instance InvariantUUID", modInRes.getInvariantUUID(), invariantUUID);
+ assertEquals("Validate group instance name", modInRes.getName(), name);
+ assertEquals("Validate group instance UUID", modInRes.getGroupUUID(), UUID);
+ assertEquals("Validate group instance version", modInRes.getVersion(), version);
+
+ Map<String, Object> propertiesInInst = (Map<String, Object>) group.get("properties");
+ assertNotNull(propertiesInInst);
+
+ List<GroupProperty> propertiesInGroup = modInRes.convertToGroupProperties();
+ // property isBase not exist in tosca
+ assertEquals("Validate group instance properties size", propertiesInGroup.size() - 1, propertiesInInst.size());
+ propertiesInGroup.forEach(propInGroup -> {
+ String propName = propInGroup.getName();
+ if (!propName.equals("isBase")) {
+ Object propValue = propertiesInInst.get(propName);
+ String valueInGroup = propInGroup.getValue();
+ if (valueInGroup != null && !valueInGroup.isEmpty()) {
+ assertNotNull(propValue);
+ assertEquals("Validate group instance property value for " + propName, valueInGroup, propValue.toString());
+ } else {
+ assertNull(propValue);
}
- String vf_module_description = (String) properties.get("vf_module_description");
- assertEquals("Validate vf_module_description", group.getDescription(), vf_module_description);
-
- Boolean volume_group = (Boolean) properties.get("volume_group");
- boolean isVolume = false;
- List<String> artifactsList = group.getArtifacts();
- List<ArtifactDefinition> artifacts = new ArrayList<>();
- if (artifactsList != null && !artifactsList.isEmpty()) {
- ArtifactDefinition masterArtifact = findMasterArtifact(createdResource.getDeploymentArtifacts(),
- artifacts, artifactsList);
- if (masterArtifact.getArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType())) {
- isVolume = true;
- }
+ }
+ });
+ }
+
+ private void validateGroupsInResource(User sdncModifierDetails, Resource createdResource, boolean includeGroups) throws Exception {
+ Map<String, Object> load = downloadAndParseToscaTemplate(sdncModifierDetails, createdResource);
+ assertNotNull(load);
+ Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template");
+ assertNotNull(topology_template);
+ Map<String, Object> groups = (Map<String, Object>) topology_template.get("groups");
+ if (includeGroups) {
+ assertNotNull(groups);
+ List<GroupDefinition> groupsOrigin = createdResource.getGroups();
+
+ assertEquals("Validate groups size", groupsOrigin.size(), groups.size());
+ for (GroupDefinition group : groupsOrigin) {
+ Map<String, Object> groupTosca = (Map<String, Object>) groups.get(group.getName());
+ assertNotNull(groupTosca);
+
+ Map<String, Object> metadata = (Map<String, Object>) groupTosca.get("metadata");
+ assertNotNull(metadata);
+
+ String invariantUUID;
+ String name;
+ String UUID;
+ String version;
+ Map<String, Object> properties = (Map<String, Object>) groupTosca.get("properties");
+
+ if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) {
+ invariantUUID = (String) metadata.get("vfModuleModelInvariantUUID");
+ name = (String) metadata.get("vfModuleModelName");
+ UUID = (String) metadata.get("vfModuleModelUUID");
+ version = (String) metadata.get("vfModuleModelVersion");
+ assertNotNull(properties);
+
+ validateVfModuleProperties(createdResource, group, properties);
+ } else {
+ invariantUUID = (String) metadata.get("invariantUUID");
+ name = (String) metadata.get("name");
+ UUID = (String) metadata.get("UUID");
+ version = (String) metadata.get("version");
+ assertNull(properties);
+
}
- assertEquals("Validate volume_group", isVolume, volume_group);
+ assertEquals("Validate InvariantUUID", group.getInvariantUUID(), invariantUUID);
+ assertEquals("Validate name", group.getName(), name);
+ assertEquals("Validate UUID", group.getGroupUUID(), UUID);
+ assertEquals("Validate version", group.getVersion(), version);
+ }
+ } else {
+ assertEquals(null, groups);
+ }
+ }
+
+ private void validateVfModuleProperties(Resource createdResource, GroupDefinition group, Map<String, Object> properties) {
+ // vf_module_type
+ String vf_module_type = (String) properties.get("vf_module_type");
+ List<GroupProperty> props = group.convertToGroupProperties();
- } else {
- invariantUUID = (String) metadata.get("invariantUUID");
- name = (String) metadata.get("name");
- UUID = (String) metadata.get("UUID");
- version = (String) metadata.get("version");
- assertNull(properties);
+ GroupProperty isBaseProp = getGroupPropertyByName(group, Constants.IS_BASE);
+ assertNotNull(isBaseProp);
+ String value = isBaseProp.getValue() == null ? isBaseProp.getDefaultValue() : isBaseProp.getValue();
+ boolean bvalue = Boolean.parseBoolean(value);
+ if (bvalue) {
+ assertEquals("Validate vf_module_type", "Base", vf_module_type);
+ } else {
+ assertEquals("Validate vf_module_type", "Expansion", vf_module_type);
+ }
+
+ // vf_module_description
+ String vf_module_description = (String) properties.get("vf_module_description");
+ assertEquals("Validate vf_module_description", group.getDescription(), vf_module_description);
+
+ // volume_group
+ Boolean volume_group = (Boolean) properties.get("volume_group");
+ boolean isVolume = false;
+ List<String> artifactsList = group.getArtifacts();
+ List<ArtifactDefinition> artifacts = new ArrayList<>();
+ if (artifactsList != null && !artifactsList.isEmpty()) {
+ ArtifactDefinition masterArtifact = findMasterArtifact(createdResource.getDeploymentArtifacts(), artifacts, artifactsList);
+ if (masterArtifact.getArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType())) {
+ isVolume = true;
}
- assertEquals("Validate InvariantUUID", group.getInvariantUUID(), invariantUUID);
- assertEquals("Validate name", group.getName(), name);
- assertEquals("Validate UUID", group.getGroupUUID(), UUID);
- assertEquals("Validate version", group.getVersion(), version);
+ }
+ assertEquals("Validate volume_group", isVolume, volume_group);
+
+ // min_vf_module_instances
+ Integer min_vf_module_instances = (Integer) properties.get("min_vf_module_instances");
+ GroupProperty minInstProp = getGroupPropertyByName(group, "min_vf_module_instances");
+ assertNotNull(minInstProp);
+ assertEquals("Validate min_vf_module_instances", minInstProp.getValue(), min_vf_module_instances.toString());
+
+ // vf_module_label
+ String vf_module_label = (String) properties.get("vf_module_label");
+ GroupProperty labelProp = getGroupPropertyByName(group, "vf_module_label");
+ assertNotNull(labelProp);
+ assertEquals("Validate vf_module_label", labelProp.getValue(), vf_module_label);
+
+ // vf_module_label
+ Integer initial_count = (Integer) properties.get("initial_count");
+ GroupProperty initCountProp = getGroupPropertyByName(group, "initial_count");
+ assertNotNull(initCountProp);
+ assertEquals("Validate initial_count", initCountProp.getValue(), initial_count.toString());
+
+ // max_vf_module_instances
+ Integer max_vf_module_instances = (Integer) properties.get("max_vf_module_instances");
+ GroupProperty maxInstProp = getGroupPropertyByName(group, "max_vf_module_instances");
+ assertNotNull(maxInstProp);
+ if (max_vf_module_instances != null) {
+ assertEquals("Validate max_vf_module_instances", maxInstProp.getValue(), max_vf_module_instances.toString());
+ } else {
+ assertEquals("Validate max_vf_module_instances", maxInstProp.getValue(), max_vf_module_instances);
+ }
+ }
+ private GroupProperty getGroupPropertyByName(GroupDefinition group, String name) {
+ List<GroupProperty> props = group.convertToGroupProperties();
+ for (GroupProperty prop : props) {
+ if (prop.getName().equals(name)) {
+ return prop;
+ }
}
+ return null;
}
@Test(enabled = true)
@@ -179,8 +355,7 @@ public class ExportToscaTest extends ComponentBaseTest {
validateInput(inputDef, inputInFile);
}
List<ComponentInstance> componentInstances = createdResource.getComponentInstances();
- Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = createdResource
- .getComponentInstancesProperties();
+ Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = createdResource.getComponentInstancesProperties();
Map<String, Object> node_templates = (Map<String, Object>) topology_template.get("node_templates");
assertNotNull(node_templates);
@@ -188,8 +363,7 @@ public class ExportToscaTest extends ComponentBaseTest {
for (Map.Entry<String, List<ComponentInstanceProperty>> entry : componentInstancesProperties.entrySet()) {
- Optional<ComponentInstance> findFirst = componentInstances.stream()
- .filter(ci -> ci.getUniqueId().equals(entry.getKey())).findFirst();
+ Optional<ComponentInstance> findFirst = componentInstances.stream().filter(ci -> ci.getUniqueId().equals(entry.getKey())).findFirst();
assertTrue(findFirst.isPresent());
String resourceName = findFirst.get().getName();
Map<String, Object> instance = (Map<String, Object>) node_templates.get(resourceName);
@@ -234,10 +408,8 @@ public class ExportToscaTest extends ComponentBaseTest {
RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
BaseRestUtils.checkCreateResponse(createResource);
Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
- ComponentInstance pmaaServer = resource.getComponentInstances().stream()
- .filter(p -> p.getName().equals("pmaa_server_0")).findAny().get();
- ComponentInstanceProperty jsonProp = resource.getComponentInstancesProperties().get(pmaaServer.getUniqueId())
- .stream().filter(p -> p.getType().equals(ToscaPropertyType.JSON.getType())).findAny().get();
+ ComponentInstance pmaaServer = resource.getComponentInstances().stream().filter(p -> p.getName().equals("pmaa_server_0")).findAny().get();
+ ComponentInstanceProperty jsonProp = resource.getComponentInstancesProperties().get(pmaaServer.getUniqueId()).stream().filter(p -> p.getType().equals(ToscaPropertyType.JSON.getType())).findAny().get();
String jsonValue = "{\"pmaa.sb_nic\":{\"address\":{\"get_input\":\"pmaa_dpu_fixed_ip\"},\"cidr\":{\"get_input\":\"pmaa_dpu_cidr\"},\"gateway\":{\"get_input\":\"pmaa_dpu_gateway\"}}}";
assertEquals(jsonProp.getValue(), jsonValue);
// download and compare
@@ -258,6 +430,187 @@ public class ExportToscaTest extends ComponentBaseTest {
assertEquals(json, jsonValue);
}
+ @Test(enabled = true)
+ public void exportServiceInputValue() throws Exception {
+ // 1 create vf as certified
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csar_1");
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(createdResource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+
+ // 2 create service
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // 3 create vf instance in service
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(createdResource);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ // 4 download tosca template
+ Map<String, Object> tosca = downloadAndParseToscaTemplate(sdncModifierDetails, service);
+ assertNotNull(tosca);
+ Map<String, Object> topology_template = (Map<String, Object>) tosca.get("topology_template");
+ assertNotNull(topology_template);
+
+ // 5 validate no inputs in service
+ Map<String, Object> inputs = (Map<String, Object>) tosca.get("inputs");
+ assertNull(inputs);
+
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+ ComponentInstance vfi = componentInstances.get(0);
+
+ // 6 add instance inputs in service
+ RestResponse getComponentInstanceInputsResponse = InputsRestUtils.getComponentInstanceInputs(service, vfi);
+ BaseValidationUtils.checkSuccess(getComponentInstanceInputsResponse);
+ List<InputDefinition> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<InputDefinition>>() {
+ }.getType());
+ // Take only the 2 first inputs
+ List<InputDefinition> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList());
+
+ // 7 Build component instances input map to add to server
+ ComponentInstInputsMap buildComponentInstInputsMap = buildComponentInstInputsMap(vfi.getUniqueId(), inputsToAdd);
+ RestResponse addInputResponse = InputsRestUtils.addInput(service, buildComponentInstInputsMap, UserRoleEnum.DESIGNER);
+ BaseValidationUtils.checkSuccess(addInputResponse);
+
+ // 8 validate inputs in service
+ // 8.1 download tosca template
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ tosca = downloadAndParseToscaTemplate(sdncModifierDetails, service);
+ assertNotNull(tosca);
+ topology_template = (Map<String, Object>) tosca.get("topology_template");
+ assertNotNull(topology_template);
+
+ // 8.2 validate inputs in service
+ inputs = (Map<String, Object>) topology_template.get("inputs");
+ assertNotNull(inputs);
+ assertEquals(2, inputs.size());
+
+ // validate created inputs vs inputs in Tosca inputs section
+ final Map<String, Object> inputsFinal = inputs;
+ buildComponentInstInputsMap.getComponentInstanceInputsMap().values().forEach(listPerInstance -> {
+ listPerInstance.forEach(input -> {
+ Map<String, Object> inputInMap = (Map<String, Object>) inputsFinal.get(input.getName());
+ assertNotNull(inputInMap);
+ });
+ });
+ Map<String, List<ComponentInstanceInput>> componentInstancesInputs = service.getComponentInstancesInputs();
+
+ // validate created inputs vs inputs in Tosca instance input value
+ List<ComponentInstanceInput> vfiInputs = componentInstancesInputs.get(vfi.getUniqueId());
+ assertNotNull(vfiInputs);
+ assertEquals(2, vfiInputs.size());
+
+ Map<String, Object> node_templates = (Map<String, Object>) topology_template.get("node_templates");
+ assertNotNull(node_templates);
+
+ Map<String, Object> instance = (Map<String, Object>) node_templates.get(vfi.getName());
+ assertNotNull(instance);
+ Map<String, Object> properties = (Map<String, Object>) instance.get("properties");
+ assertNotNull(properties);
+
+ vfiInputs.forEach(vfiInput -> {
+ Map<String, Object> inputPropValueInTosca = (Map<String, Object>) properties.get(vfiInput.getName());
+ assertNotNull(inputPropValueInTosca);
+ String instaneInputName = (String) inputPropValueInTosca.get("get_input");
+ assertNotNull(instaneInputName);
+ Map<String, Object> inputInMap = (Map<String, Object>) inputsFinal.get(instaneInputName);
+ assertNotNull(inputInMap);
+ });
+
+ }
+
+ @Test(enabled = true)
+ public void exportComponentInstancesTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Resource createdResource = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ Map<String, Object> load = downloadAndParseToscaTemplate(sdncModifierDetails, createdResource);
+ assertNotNull(load);
+ Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template");
+ assertNotNull(topology_template);
+
+ Map<String, Object> node_templates = (Map<String, Object>) topology_template.get("node_templates");
+ assertNotNull(node_templates);
+
+ RestResponse getResource = ResourceRestUtils.getResource(createdResource.getUniqueId());
+ BaseRestUtils.checkSuccess(getResource);
+ Resource resource = ResponseParser.parseToObjectUsingMapper(getResource.getResponse(), Resource.class);
+ List<ComponentInstance> componentInstances = resource.getComponentInstances();
+
+ assertEquals(componentInstances.size(), node_templates.size());
+
+ for (ComponentInstance ci : componentInstances) {
+ Map<String, Object> instance = (Map<String, Object>) node_templates.get(ci.getName());
+ assertNotNull(instance);
+ Map<String, Object> metadata = (Map<String, Object>) instance.get("metadata");
+ assertNotNull(metadata);
+ String customizationUUD = (String) metadata.get("customizationUUID");
+ assertTrue(ci.getCustomizationUUID().equals(customizationUUD));
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void extendNodeTemplateWithDefaultPropertyValuesTest() throws Exception {
+
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
+ String payloadCsarName = "ToscaTemplateCsar.csar";
+ Path path = Paths.get(rootPath + CSARS_PATH + "ToscaTemplateCsar.csar");
+ byte[] data = Files.readAllBytes(path);
+ String payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadCsarName);
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource createdResource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+ Map<String, Object> load = downloadAndParseToscaTemplate(sdncModifierDetails, createdResource);
+ assertNotNull(load);
+
+ Map<String, Object> nodeTemplateProperties = findNodeTemplateProperties(load, "custom_vl");
+
+ assertTrue(nodeTemplateProperties != null);
+ assertTrue(nodeTemplateProperties.get("dhcp_enabled").equals(true));
+ assertTrue(nodeTemplateProperties.get("ip_version").equals(4));
+ assertTrue(nodeTemplateProperties.get("vl_name").equals("customvl"));
+ }
+
+ private Map<String, Object> findNodeTemplateProperties(Map<String, Object> load, String riName) {
+ // find properties of node template (RI)
+ return findToscaElement(
+ // find node template (RI) by name
+ findToscaElement(
+ // find node templates
+ findToscaElement(
+ // find topology template
+ findToscaElement(load, "topology_template"), "node_templates"),
+ riName),
+ "properties");
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> findToscaElement(Map<String, Object> load, String elementName) {
+ return (Map<String, Object>) load.get(elementName);
+ }
+
+ // ----------------------------------------
private void validateInput(InputDefinition inputDef, Map<String, Object> inputInFile) {
assertEquals("validate input type", inputDef.getType(), (String) inputInFile.get("type"));
@@ -273,15 +626,19 @@ public class ExportToscaTest extends ComponentBaseTest {
assertEquals("validate input description", inputDef.getDescription(), (String) inputInFile.get("description"));
}
- // ----------------------------------------
- private Map<String, Object> downloadAndParseToscaTemplate(User sdncModifierDetails, Resource createdResource)
- throws Exception {
- String artifactUniqeId = createdResource.getToscaArtifacts().get("assettoscatemplate").getUniqueId();
-
- RestResponse toscaTemplate = ArtifactRestUtils.downloadResourceArtifactInternalApi(
- createdResource.getUniqueId(), sdncModifierDetails, artifactUniqeId);
- ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(toscaTemplate.getResponse(),
- ArtifactUiDownloadData.class);
+ private Map<String, Object> downloadAndParseToscaTemplate(User sdncModifierDetails, Component createdComponent) throws Exception {
+ String artifactUniqeId = createdComponent.getToscaArtifacts().get("assettoscatemplate").getUniqueId();
+ RestResponse toscaTemplate;
+
+ if (createdComponent.getComponentType() == ComponentTypeEnum.RESOURCE) {
+ toscaTemplate = ArtifactRestUtils.downloadResourceArtifactInternalApi(createdComponent.getUniqueId(), sdncModifierDetails, artifactUniqeId);
+
+ } else {
+ toscaTemplate = ArtifactRestUtils.downloadServiceArtifactInternalApi(createdComponent.getUniqueId(), sdncModifierDetails, artifactUniqeId);
+ }
+ BaseRestUtils.checkSuccess(toscaTemplate);
+
+ ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(toscaTemplate.getResponse(), ArtifactUiDownloadData.class);
byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
Yaml yaml = new Yaml();
@@ -292,20 +649,7 @@ public class ExportToscaTest extends ComponentBaseTest {
return load;
}
- private Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
- // create new resource from Csar
- ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
-
- resourceDetails.setCsarUUID(csarId);
- resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
- BaseRestUtils.checkCreateResponse(createResource);
- Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
- return createdResource;
- }
-
- public ArtifactDefinition findMasterArtifact(Map<String, ArtifactDefinition> deplymentArtifact,
- List<ArtifactDefinition> artifacts, List<String> artifactsList) {
+ public ArtifactDefinition findMasterArtifact(Map<String, ArtifactDefinition> deplymentArtifact, List<ArtifactDefinition> artifacts, List<String> artifactsList) {
for (String artifactUid : artifactsList) {
for (Entry<String, ArtifactDefinition> entry : deplymentArtifact.entrySet()) {
ArtifactDefinition artifact = entry.getValue();
@@ -318,8 +662,7 @@ public class ExportToscaTest extends ComponentBaseTest {
ArtifactDefinition masterArtifact = null;
for (ArtifactDefinition artifactInfo : artifacts) {
String atrifactType = artifactInfo.getArtifactType();
- if (atrifactType.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType())
- || atrifactType.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType())) {
+ if (atrifactType.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType()) || atrifactType.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType())) {
masterArtifact = artifactInfo;
continue;
}
@@ -330,4 +673,13 @@ public class ExportToscaTest extends ComponentBaseTest {
}
return masterArtifact;
}
+
+ private ComponentInstInputsMap buildComponentInstInputsMap(String addToInput, List<InputDefinition> inputs) {
+ Map<String, List<InputDefinition>> map = new HashMap<>();
+ map.put(addToInput, inputs);
+ ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap();
+ componentInstInputsMap.setComponentInstanceInputsMap(map);
+ return componentInstInputsMap;
+ }
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
index eab4e5bed2..6bf3477c1f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
@@ -39,6 +39,8 @@ import java.util.stream.Collectors;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.WordUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -46,18 +48,24 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
@@ -66,12 +74,15 @@ import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.GroupRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +94,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
private static Logger log = LoggerFactory.getLogger(ImportCsarResourceTest.class.getName());
@Rule
public static TestName name = new TestName();
-
+ private static final String CSARS_PATH = "/src/test/resources/CI/csars/";
Gson gson = new Gson();
public ImportCsarResourceTest() {
@@ -757,7 +768,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
byte[] data = null;
String payloadData = null;
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -775,7 +786,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
// change composition (resource should be updated)
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_b.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_b.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -802,7 +813,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
// wrong RI (without node types, resource shouldn't be updated)
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_c.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_c.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -817,7 +828,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
// create new resource from other Csar
resourceDetails = ElementFactory.getDefaultImportResource();
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -833,7 +844,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
// wrong RI (with node types) resource shouldn't be created
resourceDetails.setCsarUUID("VF_RI2_G4_withArtifacts_b.csar");
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts_b.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -854,7 +865,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
byte[] data = null;
String payloadData = null;
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -871,7 +882,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
// change composition and update resource
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_b.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_b.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -899,7 +910,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
// try to update resource with wrong RI (without node types, resource
// shouldn't be updated)
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_c.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_c.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1079,7 +1090,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
byte[] data = null;
String payloadData = null;
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1097,7 +1108,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
// change composition (add new RI with specified property values)
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_d.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_d.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1112,7 +1123,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals("Check response code ", BaseRestUtils.STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
// change composition (add new specified property values to existing RI)
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/valid_vf_f.csar");
+ path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_f.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1268,7 +1279,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
Map<String, String> createdMembers = groupDefinition1.get(0).getMembers();
verifyMembers(createdMembers, compNameToUniqueId);
- List<GroupProperty> properties = groupDefinition1.get(0).getProperties();
+ List<GroupProperty> properties = groupDefinition1.get(0).convertToGroupProperties();
assertEquals("Verify number of members", 2, properties.size());
GroupProperty heatFiles = properties.stream().filter(p -> p.getName().equals("heat_files")).findFirst().get();
@@ -1465,7 +1476,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
byte[] data = null;
String payloadData = null;
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar");
+ path = Paths.get(rootPath + CSARS_PATH + "vmmc_relate_by_cap_name.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1491,7 +1502,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
byte[] data = null;
String payloadData = null;
- path = Paths.get(rootPath + "/src/test/resources/CI/csars/vf_relate_by_cap_name.csar");
+ path = Paths.get(rootPath + CSARS_PATH + "vf_relate_by_cap_name.csar");
data = Files.readAllBytes(path);
payloadData = Base64.encodeBase64String(data);
resourceDetails.setPayloadData(payloadData);
@@ -1514,6 +1525,310 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("link").getUniqueId());
}
+ @Test(enabled = true)
+ public void importCsarCheckVfHeatEnv() throws Exception {
+ ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
+ resourceDetails.setCsarUUID("csar_1");
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+ // 2 lisence, 1 heat, 1 heatenv
+ assertEquals(4, deploymentArtifacts.size());
+
+ ArtifactDefinition artifactHeat = deploymentArtifacts.get("heat0");
+ assertNotNull(artifactHeat);
+
+ ArtifactDefinition artifactHeatEnv = deploymentArtifacts.get("heat0env");
+ assertNotNull(artifactHeatEnv);
+
+ assertEquals(artifactHeat.getUniqueId(), artifactHeatEnv.getGeneratedFromId());
+ assertEquals("VF HEAT ENV", artifactHeatEnv.getArtifactDisplayName());
+ assertEquals("HEAT_ENV", artifactHeatEnv.getArtifactType());
+ assertEquals("VF Auto-generated HEAT Environment deployment artifact", artifactHeatEnv.getDescription());
+
+ String designerUserId = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER).getUserId();
+ String testerUserId = ElementFactory.getDefaultUser(UserRoleEnum.TESTER).getUserId();
+ RestResponse lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, designerUserId, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.STARTCERTIFICATION);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ lifecycleChangeResponse = LifecycleRestUtils.changeResourceState(resourceDetails, testerUserId, LifeCycleStatesEnum.CERTIFY);
+ LifecycleRestUtils.checkSuccess(lifecycleChangeResponse);
+ Resource certifiedResource = ResponseParser.parseToObjectUsingMapper(lifecycleChangeResponse.getResponse(), Resource.class);
+
+
+ User modifier = new User();
+ modifier.setUserId(designerUserId);
+
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("newtestservice1", ServiceCategoriesEnum.MOBILITY, designerUserId);
+
+ RestResponse serviceRes = ServiceRestUtils.createService(serviceDetails, modifier);
+ ResourceRestUtils.checkCreateResponse(serviceRes);
+ Service service = ResponseParser.parseToObjectUsingMapper(serviceRes.getResponse(), Service.class);
+
+ ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getComponentInstance(certifiedResource);
+ RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, modifier, service.getUniqueId(), service.getComponentType());
+ BaseRestUtils.checkCreateResponse(createResourceInstanceResponse);
+ RestResponse serviceByGet = ServiceRestUtils.getService(service.getUniqueId());
+ service = ResponseParser.parseToObjectUsingMapper(serviceByGet.getResponse(), Service.class);
+
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+
+ assertEquals(1, componentInstances.size());
+ ComponentInstance ci = componentInstances.get(0);
+ Map<String, ArtifactDefinition> instDepArtifacts = ci.getDeploymentArtifacts();
+ assertNotNull(instDepArtifacts);
+ ArtifactDefinition instArtifactHeat = instDepArtifacts.get("heat0");
+ assertNotNull(instArtifactHeat);
+
+ ArtifactDefinition instArtifactHeatEnv = instDepArtifacts.get("heat0env");
+ assertNotNull(instArtifactHeatEnv);
+ assertEquals(artifactHeat.getUniqueId(), instArtifactHeatEnv.getGeneratedFromId());
+ assertEquals("HEAT ENV", instArtifactHeatEnv.getArtifactDisplayName());
+ assertEquals("HEAT_ENV", instArtifactHeatEnv.getArtifactType());
+
+ assertEquals(artifactHeat.getUniqueId(), instArtifactHeat.getUniqueId());
+ //different artifacts
+ assertTrue( !artifactHeatEnv.getUniqueId().equals(instArtifactHeat.getUniqueId()) );
+
+
+ }
+
+ @Test(enabled = true)
+ public void createAndUpdateCsarCheckVfHeatEnv() throws Exception {
+ ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
+ resourceDetails.setCsarUUID("orig2G_org");
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+
+ assertEquals(13, deploymentArtifacts.size());
+
+ ArtifactDefinition artifactHeat = deploymentArtifacts.get("heat0");
+ assertNotNull(artifactHeat);
+
+ ArtifactDefinition artifactHeatEnv = deploymentArtifacts.get("heat0env");
+ assertNotNull(artifactHeatEnv);
+
+ assertEquals(artifactHeat.getUniqueId(), artifactHeatEnv.getGeneratedFromId());
+ assertEquals("VF HEAT ENV", artifactHeatEnv.getArtifactDisplayName());
+ assertEquals("HEAT_ENV", artifactHeatEnv.getArtifactType());
+ assertEquals("VF Auto-generated HEAT Environment deployment artifact", artifactHeatEnv.getDescription());
+
+ List<GroupDefinition> groups = resource.getGroups();
+ assertEquals(2, groups.size());
+ GroupDefinition group1 = groups.stream().filter(p -> p.getName().contains("module-0")).findAny().get();
+ GroupDefinition group2 = groups.stream().filter(p -> p.getName().contains("module-1")).findAny().get();
+ assertEquals(11, group1.getArtifacts().size());
+ assertEquals(3, group2.getArtifacts().size());
+
+ resourceDetails.setCsarUUID("orig2G_update");
+
+ RestResponse updateResource = ResourceRestUtils.updateResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), resourceDetails.getUniqueId());
+ BaseRestUtils.checkSuccess(updateResource);
+
+ resource = ResponseParser.parseToObjectUsingMapper(updateResource.getResponse(), Resource.class);
+
+
+ Map<String, ArtifactDefinition> deploymentArtifactsUpd = resource.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifactsUpd);
+
+ assertEquals(13, deploymentArtifactsUpd.size());
+
+ ArtifactDefinition artifactHeatUpd = deploymentArtifacts.get("heat0");
+ assertNotNull(artifactHeatUpd);
+
+ ArtifactDefinition artifactHeatEnvUpd = deploymentArtifacts.get("heat0env");
+ assertNotNull(artifactHeatEnvUpd);
+
+ groups = resource.getGroups();
+ assertEquals(2, groups.size());
+ assertEquals(7, groups.get(0).getArtifacts().size());
+ assertEquals(7, groups.get(1).getArtifacts().size());
+
+
+ }
+
+ @Test
+ public void importInnerVfcWithArtifactsSucceed() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ String rootPath = System.getProperty("user.dir");
+ ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
+
+ String payloadName = "ImportArtifactsToVFC.csar";
+ Path path = Paths.get(rootPath + CSARS_PATH + "ImportArtifactsToVFC.csar");
+ byte[] data = Files.readAllBytes(path);
+ String payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadName);
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+ List<ComponentInstance> componentInstances = resource.getComponentInstances();
+ List<ComponentInstance> reducedComponentInstances = componentInstances.stream()
+ .filter(ci->ci.getNormalizedName().contains("server_sm"))
+ .collect(Collectors.toList());
+ assertTrue(!reducedComponentInstances.isEmpty() && reducedComponentInstances.size() == 2);
+ reducedComponentInstances.stream().forEach(ci->isValidArtifacts(ci));
+
+ payloadName = "ImportArtifactsToVFC_empty.csar";
+ path = Paths.get(rootPath + CSARS_PATH + "ImportArtifactsToVFC_empty.csar");
+ data = Files.readAllBytes(path);
+ payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setName(resourceDetails.getName()+"2");
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadName);
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+
+ createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+ BaseRestUtils.checkCreateResponse(createResource);
+ resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+ componentInstances = resource.getComponentInstances();
+ reducedComponentInstances = componentInstances.stream()
+ .filter(ci->ci.getNormalizedName().contains("server_sm"))
+ .collect(Collectors.toList());
+ assertTrue(!reducedComponentInstances.isEmpty() && reducedComponentInstances.size() == 2);
+ reducedComponentInstances.stream()
+ .forEach(ci->assertTrue(
+ (ci.getDeploymentArtifacts()==null || ci.getDeploymentArtifacts().isEmpty()) &&
+ (ci.getArtifacts()==null || ci.getArtifacts().isEmpty()))
+ );
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void importInnerVfcWithArtifactsUpdateSucceed() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ String rootPath = System.getProperty("user.dir");
+ ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
+
+ String payloadName = "vfc_artifacts.csar";
+ Path path = Paths.get(rootPath + CSARS_PATH + payloadName);
+ byte[] data = Files.readAllBytes(path);
+ String payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadName);
+ resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
+
+ Map<String,String> validCreatedInformationalArtifactVersions = new HashMap<>();
+ validCreatedInformationalArtifactVersions.put("GuideInfoDelete.mib","1");
+ validCreatedInformationalArtifactVersions.put("GuideInfoUpdate.mib","1");
+ validCreatedInformationalArtifactVersions.put("OtherInfoIgnore.mib","1");
+
+ Map<String,String> validCreatedDeploymentArtifactVersions = new HashMap<>();
+ validCreatedDeploymentArtifactVersions.put("PollDelete.mib","1");
+ validCreatedDeploymentArtifactVersions.put("PollUpdate.mib","1");
+ validCreatedDeploymentArtifactVersions.put("TrapDelete.mib","1");
+ validCreatedDeploymentArtifactVersions.put("TrapUpdate.mib","1");
+
+ Map<String,String> validUpdatedInformationalArtifactVersions = new HashMap<>();
+ validUpdatedInformationalArtifactVersions.put("GuideInfoNew.mib","1");
+ validUpdatedInformationalArtifactVersions.put("GuideInfoUpdate.mib","2");
+ validUpdatedInformationalArtifactVersions.put("OtherInfoIgnore.mib","1");
+
+ Map<String,String> validUpdatedDeploymentArtifactVersions = new HashMap<>();
+ validUpdatedDeploymentArtifactVersions.put("PollNew.mib","1");
+ validUpdatedDeploymentArtifactVersions.put("PollUpdate.mib","2");
+ validUpdatedDeploymentArtifactVersions.put("TrapNew.mib","1");
+ validUpdatedDeploymentArtifactVersions.put("TrapUpdate.mib","2");
+
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
+ BaseRestUtils.checkCreateResponse(createResource);
+ Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+
+ List<ComponentInstance> componentInstances = resource.getComponentInstances().stream()
+ .filter(ci->ci.getNormalizedName().contains("ltm_server"))
+ .collect(Collectors.toList());
+ assertTrue(!componentInstances.isEmpty() && componentInstances.size() == 1);
+ ComponentInstance componentInstance = componentInstances.get(0);
+ assertTrue(!componentInstance.getArtifacts().isEmpty() && componentInstance.getArtifacts().size() == 3);
+ componentInstance.getArtifacts().values().stream()
+ .forEach(a->assertTrue(validCreatedInformationalArtifactVersions.containsKey(a.getArtifactName()) &&
+ validCreatedInformationalArtifactVersions.get(a.getArtifactName()).equals(a.getArtifactVersion())));
+
+ assertTrue(!componentInstance.getDeploymentArtifacts().isEmpty() && componentInstance.getDeploymentArtifacts().size() == 4);
+ componentInstance.getDeploymentArtifacts().values().stream()
+ .forEach(a->assertTrue(validCreatedDeploymentArtifactVersions.containsKey(a.getArtifactName()) &&
+ validCreatedDeploymentArtifactVersions.get(a.getArtifactName()).equals(a.getArtifactVersion())));
+
+ payloadName = "vfc_artifacts_update.csar";
+ path = Paths.get(rootPath + CSARS_PATH + payloadName);
+ data = Files.readAllBytes(path);
+ payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadName);
+
+ RestResponse updateResource = ResourceRestUtils.updateResource(resourceDetails, sdncModifierDetails, resource.getUniqueId());
+ BaseRestUtils.checkSuccess(updateResource);
+ resource = ResponseParser.parseToObjectUsingMapper(updateResource.getResponse(), Resource.class);
+
+ componentInstances = resource.getComponentInstances().stream()
+ .filter(ci->ci.getNormalizedName().contains("ltm_server"))
+ .collect(Collectors.toList());
+ assertTrue(!componentInstances.isEmpty() && componentInstances.size() == 1);
+ componentInstance = componentInstances.get(0);
+ assertTrue(!componentInstance.getArtifacts().isEmpty() && componentInstance.getArtifacts().size() == 3);
+ componentInstance.getArtifacts().values().stream()
+ .forEach(a->assertTrue(validUpdatedInformationalArtifactVersions.containsKey(a.getArtifactName()) &&
+ validUpdatedInformationalArtifactVersions.get(a.getArtifactName()).equals(a.getArtifactVersion())));
+
+ assertTrue(!componentInstance.getDeploymentArtifacts().isEmpty() && componentInstance.getDeploymentArtifacts().size() == 4);
+ componentInstance.getDeploymentArtifacts().values().stream()
+ .forEach(a->assertTrue(validUpdatedDeploymentArtifactVersions.containsKey(a.getArtifactName()) &&
+ validUpdatedDeploymentArtifactVersions.get(a.getArtifactName()).equals(a.getArtifactVersion())));
+
+
+ payloadName = "vfc_artifacts_delete_all.csar";
+ path = Paths.get(rootPath + CSARS_PATH + payloadName);
+ data = Files.readAllBytes(path);
+ payloadData = Base64.encodeBase64String(data);
+ resourceDetails.setPayloadData(payloadData);
+ resourceDetails.setPayloadName(payloadName);
+
+ updateResource = ResourceRestUtils.updateResource(resourceDetails, sdncModifierDetails, resource.getUniqueId());
+ BaseRestUtils.checkSuccess(updateResource);
+ resource = ResponseParser.parseToObjectUsingMapper(updateResource.getResponse(), Resource.class);
+
+ componentInstances = resource.getComponentInstances().stream()
+ .filter(ci->ci.getNormalizedName().contains("ltm_server"))
+ .collect(Collectors.toList());
+ assertTrue(!componentInstances.isEmpty() && componentInstances.size() == 1);
+ componentInstance = componentInstances.get(0);
+ assertTrue(componentInstance.getArtifacts() == null || componentInstance.getArtifacts().isEmpty());
+ assertTrue(componentInstance.getDeploymentArtifacts() == null || componentInstance.getDeploymentArtifacts().isEmpty());
+ }
+
+ private void isValidArtifacts(ComponentInstance ci) {
+ assertTrue(!ci.getDeploymentArtifacts().isEmpty() && ci.getDeploymentArtifacts().size() == 11);
+ ci.getDeploymentArtifacts().values().stream()
+ .forEach(a->assertTrue(a.getArtifactName().startsWith("Some")));
+
+ assertTrue(!ci.getArtifacts().isEmpty() && ci.getArtifacts().size() == 1);
+ ci.getArtifacts().values().stream()
+ .forEach(a->assertTrue(a.getArtifactName().startsWith("Process")));
+ }
+
private void verifyMembers(Map<String, String> createdMembers, Map<String, String> compNameToUniqueId) {
for (Map.Entry<String, String> entry : createdMembers.entrySet()) {
String key = entry.getKey();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
index 873d33979f..7957edc9a7 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java
@@ -46,9 +46,12 @@ import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
+
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
@@ -82,9 +85,10 @@ public class ImportGenericResourceCITest extends ComponentBaseTest {
private static Logger log = LoggerFactory.getLogger(ImportGenericResourceCITest.class.getName());
private static final String FILE_NAME_MY_COMPUTE = "tosca.nodes.MyCompute";
private static final String RESOURCE_NAME_UPDATE_COMPUTE = "userUpdateCompute";
- private static final String RESOURCE_NAME_MY_COMPUTE = "myCompute";
+ private static final String RESOURCE_NAME_MY_COMPUTE = "MyCompute";
private static final String RESOURCE_NAME_USER_COMPUTE = "userCompute";
private static final String FILE_NAME_USER_COMPUTE = "tosca.nodes.userCompute";
+ private static final String FILE_NAME_USER_VFC = "Derived_VFC";
@Rule
public static TestName name = new TestName();
@@ -503,7 +507,7 @@ public class ImportGenericResourceCITest extends ComponentBaseTest {
String fileName = FILE_NAME_MY_COMPUTE;
RestResponse response = ImportRestUtils.importNormativeResourceByName(RESOURCE_NAME_MY_COMPUTE, UserRoleEnum.ADMIN);
Integer statusCode = response.getErrorCode();
- assertTrue(statusCode == BaseRestUtils.STATUS_CODE_IMPORT_SUCCESS);
+ assertTrue(String.format("Expected code %s and got code %s",ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS,statusCode),statusCode == ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS);
String uid = ResponseParser.getUniqueIdFromResponse(response);
validateMyComputeResource(uid, fileName, "1.0", "CERTIFIED");
@@ -572,7 +576,7 @@ public class ImportGenericResourceCITest extends ComponentBaseTest {
String fileName = FILE_NAME_USER_COMPUTE;
RestResponse response = ImportRestUtils.importNormativeResourceByName(RESOURCE_NAME_USER_COMPUTE, UserRoleEnum.ADMIN);
Integer statusCode = response.getErrorCode();
- assertTrue(statusCode == ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS);
+ assertTrue(String.format("Expected code %s and got code %s",ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS,statusCode),statusCode == ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS);
String uid = ResponseParser.getUniqueIdFromResponse(response);
validateMyComputeResource(uid, fileName, "1.0", "CERTIFIED");
@@ -595,5 +599,22 @@ public class ImportGenericResourceCITest extends ComponentBaseTest {
Integer statusCode = ImportRestUtils.importNormativeResourceByName(RESOURCE_NAME_MY_COMPUTE, UserRoleEnum.DESIGNER).getErrorCode();
assertTrue(statusCode == 409);
}
+
+ @Test
+ public void testImportVFCDerivedFromGeneric() throws IOException {
+
+ RestResponse response = ImportRestUtils.importNewResourceByName(FILE_NAME_USER_VFC, UserRoleEnum.ADMIN);
+ Integer statusCode = response.getErrorCode();
+ assertTrue(String.format("Expected code %s and got code %s",ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS,statusCode),statusCode == ImportRestUtils.STATUS_CODE_IMPORT_SUCCESS);
+ String uid = ResponseParser.getUniqueIdFromResponse(response);
+ response = ResourceRestUtils.getResource(uid);
+ Resource VFC = ResponseParser.convertResourceResponseToJavaObject(response.getResponse());
+ List<PropertyDefinition> props = VFC.getProperties();
+ for (PropertyDefinition prop : props) {
+ assertTrue(null != prop.getOwnerId() && !uid.equals(prop.getOwnerId()));
+
+ }
+
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
index ec335fa65f..9e8a2a1f95 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
@@ -108,7 +108,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// init user
sdncModifierDetails.setUserId(UserRoleEnum.ADMIN.getUserId());
// init resource details
- resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
+ resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
}
@Test
@@ -119,8 +120,10 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
DbUtils.cleanAllAudits();
// import testResources trough newResource API
- RestResponse importResponse = ImportRestUtils.importNewResourceByName(currResource.getFolderName(), UserRoleEnum.ADMIN);
- System.err.println("import Resource " + "<" + currResource.getFolderName() + ">" + "response: " + importResponse.getErrorCode());
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName(currResource.getFolderName(),
+ UserRoleEnum.ADMIN);
+ System.err.println("import Resource " + "<" + currResource.getFolderName() + ">" + "response: "
+ + importResponse.getErrorCode());
// validate response
ImportRestUtils.validateImportTestTypesResp(currResource, importResponse);
@@ -143,7 +146,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
expectedResourceAuditJavaObject.setCurrState("");
expectedResourceAuditJavaObject.setComment(null);
expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString());
- List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams() : new ArrayList<String>());
+ List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams()
+ : new ArrayList<String>());
String auditDesc = AuditValidationUtils.buildAuditDescription(errorInfo, variables);
expectedResourceAuditJavaObject.setDesc(auditDesc);
AuditValidationUtils.validateAuditImport(expectedResourceAuditJavaObject, auditAction);
@@ -156,7 +160,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// init user
sdncModifierDetails.setUserId(userRoleEnum.getUserId());
// init resource details
- resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
+ resourceDetails = ElementFactory.getDefaultResource("importResource4test", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, "jh0003");
// clean ES DB
DbUtils.cleanAllAudits();
// import new resource (expected checkOut state)
@@ -166,14 +171,19 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
@Test(enabled = false)
public void importUIResource() throws IOException {
- String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n" + " org.openecomp.resource.importResource4test:\r\n" + " derived_from: tosca.nodes.Root\r\n" + " description: someDesc";
+ String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n"
+ + " org.openecomp.resource.importResource4test:\r\n" + " derived_from: tosca.nodes.Root\r\n"
+ + " description: someDesc";
String encodedPayload = new String(Base64.encodeBase64(payload.getBytes()));
- String json = "{\r\n" + " \"resourceName\": \"importResource4test\",\r\n" + " \"payloadName\": \"importResource4test.yml\",\r\n"
+ String json = "{\r\n" + " \"resourceName\": \"importResource4test\",\r\n"
+ + " \"payloadName\": \"importResource4test.yml\",\r\n"
+ " \"categories\": [{\"name\": \"Application L4+\",\"normalizedName\": \"application l4+\",\"uniqueId\": \"resourceNewCategory.application l4+\",\"subcategories\": [{\"name\": \"Web Server\"}]}],\r\n"
- + " \"description\": \"ResourceDescription\",\r\n" + " \"vendorName\": \"VendorName\",\r\n" + " \"vendorRelease\": \"VendorRelease\",\r\n" + " \"contactId\": \"AT1234\",\r\n" + " \"icon\": \"router\",\r\n" + " \"tags\": [\r\n"
- + " \"importResource4test\"\r\n" + " ],\r\n" + " \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
+ + " \"description\": \"ResourceDescription\",\r\n" + " \"vendorName\": \"VendorName\",\r\n"
+ + " \"vendorRelease\": \"VendorRelease\",\r\n" + " \"contactId\": \"AT1234\",\r\n"
+ + " \"icon\": \"router\",\r\n" + " \"tags\": [\r\n" + " \"importResource4test\"\r\n" + " ],\r\n"
+ + " \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
String md5 = GeneralUtility.calculateMD5ByString(json);
@@ -226,8 +236,10 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
// validate get response
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceRespJavaObject.getUniqueId());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// validate
@@ -235,7 +247,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// validate audit
resourceDetails.setVersion(resourceDetails.getVersion());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
@@ -275,7 +288,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
DbUtils.cleanAllAudits();
// import new resource while resource already exist in other state
- importResponse = ImportRestUtils.importNewResourceByName("importResource4testUpdateVendorNameAndCategory", UserRoleEnum.ADMIN);
+ importResponse = ImportRestUtils.importNewResourceByName("importResource4testUpdateVendorNameAndCategory",
+ UserRoleEnum.ADMIN);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
@@ -290,8 +304,10 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
// validate get response
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceRespJavaObject.getUniqueId());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// validate
@@ -299,7 +315,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// validate audit
resourceDetails.setVersion(resourceDetails.getVersion());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails);
auditAction = "ResourceImport";
resourceVersion = "0.1";
@@ -331,14 +348,17 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
String firstName = split[0];
String lastName = split[1];
- List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName, resourceFromImport.getLastUpdaterUserId());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables, importResponse.getResponse());
+ List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
+ resourceFromImport.getLastUpdaterUserId());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
+ importResponse.getResponse());
}
@@ -359,74 +379,88 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name());
assertEquals("Check response code after adding artifact", errorInfo.getCode(), importResponse.getErrorCode());
String[] split = resourceFromImport.getLastUpdaterFullName().split(" ");
String firstName = split[0];
String lastName = split[1];
- List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName, resourceFromImport.getLastUpdaterUserId());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables, importResponse.getResponse());
+ List<String> variables = Arrays.asList(resourceFromImport.getName(), "resource", firstName, lastName,
+ resourceFromImport.getLastUpdaterUserId());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CHECKOUT_STATE.name(), variables,
+ importResponse.getResponse());
}
@Test(enabled = false)
public void importNewResource_nameSpace_vf() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVF", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVF",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
- Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+ Resource resourceRespJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResponse.getResponse());
assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VF));
}
@Test
public void importNewResource_nameSpace_vfc() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVFC", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVFC",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
- Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+ Resource resourceRespJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResponse.getResponse());
assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
}
@Test
public void importNewResource_nameSpace_vl() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVL", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testVL",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
- Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+ Resource resourceRespJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResponse.getResponse());
assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VL));
}
@Test
public void importNewResource_nameSpace_cp() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testCP", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testCP",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
- Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+ Resource resourceRespJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResponse.getResponse());
assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.CP));
}
@Test
public void importNewResource_nameSpace_unknown() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4test",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
- Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResponse.getResponse());
+ Resource resourceRespJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResponse.getResponse());
assertTrue(resourceRespJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
}
@Test
public void importNewResource_MissingNameSpace() throws Exception {
- RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testMissingNameSpace", UserRoleEnum.DESIGNER);
+ RestResponse importResponse = ImportRestUtils.importNewResourceByName("importResource4testMissingNameSpace",
+ UserRoleEnum.DESIGNER);
assertNotNull("check response object is not null after import resource", importResponse);
assertNotNull("check error code exists in response after import resource", importResponse.getErrorCode());
assertEquals("Check response code after import resource", 400, importResponse.getErrorCode().intValue());
@@ -464,8 +498,10 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
// validate get response
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceRespJavaObject.getUniqueId());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// validate
@@ -473,7 +509,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// validate audit
resourceDetails.setVersion(resourceDetails.getVersion());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails);
auditAction = "ResourceImport";
resourceVersion = "0.1";
@@ -505,7 +542,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
@@ -530,8 +568,10 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
// validate get response
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceRespJavaObject.getUniqueId());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceRespJavaObject.getUniqueId());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// validate
@@ -539,7 +579,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// validate audit
resourceDetails.setVersion(resourceDetails.getVersion());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails);
resourceVersion = "0.2";
auditAction = "ResourceImport";
@@ -565,9 +606,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
// // resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
@@ -583,7 +626,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
@@ -593,7 +637,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails.setVersion(resourceFromGet.getVersion());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -614,11 +659,13 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables, importResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+ importResponse.getResponse());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
String auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
@@ -649,9 +696,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
@@ -667,12 +716,14 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -687,18 +738,22 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
// validate response
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name());
assertNotNull("check response object is not null after create resouce", importResponse);
assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
String[] split = resourceFromGet.getLastUpdaterFullName().split(" ");
String firstName = split[0];
String lastName = split[1];
- List<String> variables = Arrays.asList(resourceFromGet.getName(), "resource", firstName, lastName, resourceFromGet.getLastUpdaterUserId());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name(), variables, importResponse.getResponse());
+ List<String> variables = Arrays.asList(resourceFromGet.getName(), "resource", firstName, lastName,
+ resourceFromGet.getLastUpdaterUserId());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_SENT_FOR_CERTIFICATION.name(), variables,
+ importResponse.getResponse());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
String auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
@@ -727,9 +782,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
@@ -746,12 +803,14 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -790,7 +849,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
ResourceValidationUtils.validateModelObjects(resourceFromImport, resourceFromGet);
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setPrevState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
@@ -812,9 +872,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
@@ -831,12 +893,14 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -845,7 +909,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails.setVersion(resourceFromGet.getVersion());
// startCert
- RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
assertNotNull("check response object is not null after resource request start certification", startCert);
assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
@@ -866,10 +931,12 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables, importResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), variables,
+ importResponse.getResponse());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
String auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setResourceName("");
@@ -897,9 +964,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
@@ -916,12 +985,14 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -930,7 +1001,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails.setVersion(resourceFromGet.getVersion());
// startCert
- RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
assertNotNull("check response object is not null after resource request start certification", startCert);
assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
@@ -944,15 +1016,19 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// import new resource while resource already exist in other state
importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.DESIGNER);
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
assertNotNull("check response object is not null after create resouce", importResponse);
assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
- List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(), sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(), variables, importResponse.getResponse());
+ List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
+ sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
+ variables, importResponse.getResponse());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
String auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.DESIGNER.getUserId());
@@ -983,9 +1059,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertEquals("Check response code after import resource", 201, importResponse.getErrorCode().intValue());
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
@@ -1002,12 +1080,14 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceVersion = resourceDetails.getVersion();
String checkinComment = "good checkin";
String checkinComentJson = "{\"userRemarks\": \"" + checkinComment + "\"}";
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CHECKIN, checkinComentJson);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -1016,7 +1096,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails.setVersion(resourceFromGet.getVersion());
// startCert
- RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
assertNotNull("check response object is not null after resource request start certification", startCert);
assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
@@ -1032,15 +1113,19 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
importResponse = ImportRestUtils.importNewResourceByName("importResource4test", UserRoleEnum.ADMIN);
// validate response
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name());
assertNotNull("check response object is not null after create resouce", importResponse);
assertNotNull("check error code exists in response after create resource", importResponse.getErrorCode());
assertEquals("Check response code after create service", errorInfo.getCode(), importResponse.getErrorCode());
- List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(), sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(), variables, importResponse.getResponse());
+ List<String> variables = Arrays.asList(resourceDetails.getName(), "resource", sdncAdminUser.getFirstName(),
+ sdncAdminUser.getLastName(), sdncAdminUser.getUserId());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_IN_CERT_IN_PROGRESS_STATE.name(),
+ variables, importResponse.getResponse());
// validate audit
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceVersion);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resourceDetails, resourceVersion);
String auditAction = "ResourceImport";
expectedResourceAuditJavaObject.setAction(auditAction);
expectedResourceAuditJavaObject.setModifierUid(UserRoleEnum.ADMIN.getUserId());
@@ -1202,10 +1287,6 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
// DbUtils.cleanAllAudits();
//
// // change resource details
- // resourceDetails =
- // ElementFactory.getDefaultResource("tosca.nodes.importResource4test",
- // NormativeTypesEnum.COMPUTE, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS,
- // "jh0003");
//
// // import new resource while resource already exist in other state
// importResponse =
@@ -1279,9 +1360,11 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceVersion = resourceDetails.getVersion();
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails,
+ resourceDetails.getUniqueId());
assertEquals("Check response code after get resource", 200, resourceGetResponse.getErrorCode().intValue());
- Resource resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
+ Resource resourceFromGet = ResponseParser
+ .convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
assertNotNull(resourceFromGet);
// add mandatory artifacts
// resourceUtils.addResourceMandatoryArtifacts(sdncModifierDetails,
@@ -1293,7 +1376,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
resourceDetails = ResponseParser.parseToObject(importResponse.getResponse(), ResourceReqDetails.class);
resourceDetails.setVersion(resourceFromGet.getVersion());
- RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
+ RestResponse checkInResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ "0.1", LifeCycleStatesEnum.CHECKIN);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
@@ -1301,7 +1385,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid));
// req4cert resource
- RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse request4cert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertNotNull("check response object is not null after resource request for certification", request4cert);
assertEquals("Check response code after checkout resource", 200, request4cert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(request4cert.getResponse());
@@ -1313,7 +1398,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid2));
// startCert
- RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse startCert = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ resourceVersion, LifeCycleStatesEnum.STARTCERTIFICATION);
assertNotNull("check response object is not null after resource request start certification", startCert);
assertEquals("Check response code after checkout resource", 200, startCert.getErrorCode().intValue());
resourceFromGet = ResponseParser.convertResourceResponseToJavaObject(startCert.getResponse());
@@ -1324,14 +1410,16 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
String newUuid3 = ResponseParser.getValueFromJsonResponse(startCert.getResponse(), "uuid");
assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid3));
- RestResponse certify = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "0.1", LifeCycleStatesEnum.CERTIFY);
+ RestResponse certify = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "0.1",
+ LifeCycleStatesEnum.CERTIFY);
assertNotNull("check response object is not null after import resource", certify);
assertEquals("Check response code after checkout resource", 200, certify.getErrorCode().intValue());
String newUuid4 = ResponseParser.getValueFromJsonResponse(certify.getResponse(), "uuid");
assertTrue(ResourceValidationUtils.validateUuidAfterChangingStatus(oldUuid, newUuid4));
- RestResponse checkoutResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails, "1.0", LifeCycleStatesEnum.CHECKOUT);
+ RestResponse checkoutResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncModifierDetails,
+ "1.0", LifeCycleStatesEnum.CHECKOUT);
assertNotNull("check response object is not null after import resource", checkInResponse);
assertEquals("Check response code after checkout resource", 200, checkInResponse.getErrorCode().intValue());
@@ -1349,7 +1437,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
List<PropertyDefinition> properties = resource.getProperties();
assertEquals("check properties size", 3, properties.size());
- PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test")).findFirst().get();
+ PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
+ .findFirst().get();
String defaultValue = propertyDefinition.getDefaultValue();
Map mapValue = gson.fromJson(defaultValue, Map.class);
@@ -1371,7 +1460,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
List<PropertyDefinition> properties = resource.getProperties();
assertEquals("check properties size", 3, properties.size());
- PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test")).findFirst().get();
+ PropertyDefinition propertyDefinition = properties.stream().filter(p -> p.getName().equals("validation_test"))
+ .findFirst().get();
String defaultValue = propertyDefinition.getDefaultValue();
List listValue = gson.fromJson(defaultValue, List.class);
@@ -1385,7 +1475,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
assertEquals("check properties size", 2, attributes.size());
// Verify attribute from type map
- AttributeDefinition attributeMapDefinition = attributes.stream().filter(p -> p.getName().equals("validation_test_map")).findFirst().get();
+ AttributeDefinition attributeMapDefinition = attributes.stream()
+ .filter(p -> p.getName().equals("validation_test_map")).findFirst().get();
String defaultMapValue = attributeMapDefinition.getDefaultValue();
Map attributeMapValue = gson.fromJson(defaultMapValue, Map.class);
assertEquals("check Map value size", 2, attributeMapValue.size());
@@ -1393,7 +1484,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
checkMapValues(attributeMapValue, "key", 2, SPECIAL_CHARACTERS);
// Verify attribute from type list
- AttributeDefinition attributeListDefinition = attributes.stream().filter(p -> p.getName().equals("validation_test_list")).findFirst().get();
+ AttributeDefinition attributeListDefinition = attributes.stream()
+ .filter(p -> p.getName().equals("validation_test_list")).findFirst().get();
String defaultListValue = attributeListDefinition.getDefaultValue();
List attributeListValue = gson.fromJson(defaultListValue, List.class);
@@ -1408,7 +1500,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
private void checkListValues(Object object, int index, String suffix) {
Map map = (Map) object;
- assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix), map.get("protocol"));
+ assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
+ map.get("protocol"));
assertEquals("check Map token value", "token" + index, map.get("token"));
}
@@ -1424,7 +1517,8 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
private void checkMapValues(Map mapValue, String key, int index, String suffix) {
Map map1 = (Map) mapValue.get(key + index);
- assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix), map1.get("protocol"));
+ assertEquals("check Map protocol value", "protocol" + index + (suffix == null ? "" : suffix),
+ map1.get("protocol"));
assertEquals("check Map token value", "token" + index, map1.get("token"));
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
index b78bf3de36..0973135295 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java
@@ -95,6 +95,8 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import aj.org.objectweb.asm.Attribute;
+
/**
*
* @author Andrey + Pavel + Shay
@@ -135,10 +137,15 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
@DataProvider
private static final Object[][] getYmlWithInValidListProperties() throws IOException, Exception {
- return new Object[][] { { "ListPropertyFalure02.yml", "[false,\"truee\"]", "boolean" }, { "ListPropertyFalure03.yml", "[false,3]", "boolean" }, { "ListPropertyFalure04.yml", "[false,3.56]", "boolean" },
- { "ListPropertyFalure05.yml", "[10000,3.56]", "integer" }, { "ListPropertyFalure06.yml", "[10000,\"aaaa\"]", "integer" }, { "ListPropertyFalure07.yml", "[10000,true]", "integer" },
- { "ListPropertyFalure08.yml", "[10.5,true]", "float" }, { "ListPropertyFalure09.yml", "[10.5,\"asdc\"]", "float" }, // type
- // float
+ return new Object[][] { { "ListPropertyFalure02.yml", "[false,\"truee\"]", "boolean" },
+ { "ListPropertyFalure03.yml", "[false,3]", "boolean" },
+ { "ListPropertyFalure04.yml", "[false,3.56]", "boolean" },
+ { "ListPropertyFalure05.yml", "[10000,3.56]", "integer" },
+ { "ListPropertyFalure06.yml", "[10000,\"aaaa\"]", "integer" },
+ { "ListPropertyFalure07.yml", "[10000,true]", "integer" },
+ { "ListPropertyFalure08.yml", "[10.5,true]", "float" },
+ { "ListPropertyFalure09.yml", "[10.5,\"asdc\"]", "float" }, // type
+ // float
{ "ListPropertyFalure11.yml", "[10.5,\"500.0@\"]", "float" }, // property
// list
// float
@@ -166,20 +173,26 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// in
// default
// value
- { "ListPropertyFalure14.yml", "[false,\"falsee\",true]", "boolean" }, { "ListPropertyFalure15.yml", "[10.5,\"10.6x\",20.5,30.5]", "float" } // float
- // with
- // value
- // 10.6x
- // instead
- // 10.6f
+ { "ListPropertyFalure14.yml", "[false,\"falsee\",true]", "boolean" },
+ { "ListPropertyFalure15.yml", "[10.5,\"10.6x\",20.5,30.5]", "float" } // float
+ // with
+ // value
+ // 10.6x
+ // instead
+ // 10.6f
};
}
@DataProvider
private static final Object[][] getYmlWithInValidMapProperties() throws IOException, Exception {
- return new Object[][] { { "MapPropertyFalure02.yml", "[false,\"truee\"]", "boolean" }, { "MapPropertyFalure03.yml", "[false,3]", "boolean" }, { "MapPropertyFalure04.yml", "[false,3.56]", "boolean" },
- { "MapPropertyFalure05.yml", "[10000,3.56]", "integer" }, { "MapPropertyFalure06.yml", "[10000,\"aaaa\"]", "integer" }, { "MapPropertyFalure07.yml", "[10000,true]", "integer" }, { "MapPropertyFalure08.yml", "[10.5,true]", "float" },
+ return new Object[][] { { "MapPropertyFalure02.yml", "[false,\"truee\"]", "boolean" },
+ { "MapPropertyFalure03.yml", "[false,3]", "boolean" },
+ { "MapPropertyFalure04.yml", "[false,3.56]", "boolean" },
+ { "MapPropertyFalure05.yml", "[10000,3.56]", "integer" },
+ { "MapPropertyFalure06.yml", "[10000,\"aaaa\"]", "integer" },
+ { "MapPropertyFalure07.yml", "[10000,true]", "integer" },
+ { "MapPropertyFalure08.yml", "[10.5,true]", "float" },
{ "MapPropertyFalure09.yml", "[10.5,\"asdc\"]", "float" }, // type
// float
{ "MapPropertyFalure11.yml", "[10.5,\"500.0@\"]", "float" }, // property
@@ -209,12 +222,13 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// in
// default
// value
- { "MapPropertyFalure14.yml", "[false,\"falsee\",true]", "boolean" }, { "MapPropertyFalure15.yml", "[10.5,\"10.6x\",20.5,30.5]", "float" } // float
- // with
- // value
- // 10.6x
- // instead
- // 10.6f
+ { "MapPropertyFalure14.yml", "[false,\"falsee\",true]", "boolean" },
+ { "MapPropertyFalure15.yml", "[10.5,\"10.6x\",20.5,30.5]", "float" } // float
+ // with
+ // value
+ // 10.6x
+ // instead
+ // 10.6f
};
}
@@ -289,67 +303,93 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// US558432 - Support for Capability/Requirement "occurences" Import
@Test(dataProvider = "getYmlWithInValidOccurrences")
- public void importToscaResourceWithOccurrencesFailuresFlow01(String ymlFileWithInvalidCapReqOccurrences) throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFileWithInvalidCapReqOccurrences);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ public void importToscaResourceWithOccurrencesFailuresFlow01(String ymlFileWithInvalidCapReqOccurrences)
+ throws Exception {
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFileWithInvalidCapReqOccurrences);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_OCCURRENCES.name(), new ArrayList<String>(), importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_OCCURRENCES.name(), new ArrayList<String>(),
+ importResourceResponse.getResponse());
}
@Test(dataProvider = "getInvalidYmlWithOccurrences")
- public void importToscaResourceWithOccurrencesFailuresFlow02(String ymlFileWithInvalidCapReqOccurrences) throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFileWithInvalidCapReqOccurrences);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ public void importToscaResourceWithOccurrencesFailuresFlow02(String ymlFileWithInvalidCapReqOccurrences)
+ throws Exception {
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFileWithInvalidCapReqOccurrences);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_YAML_FILE.name(), new ArrayList<String>(), importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_YAML_FILE.name(), new ArrayList<String>(),
+ importResourceResponse.getResponse());
}
@Test
public void importToscaResource() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importSuccessFile);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- AssertJUnit.assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- AssertJUnit.assertTrue("validate toscaResourceName field", resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
- AssertJUnit.assertTrue("validate resourceType field", resourceJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importSuccessFile);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ AssertJUnit.assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ AssertJUnit.assertTrue("validate toscaResourceName field",
+ resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
+ AssertJUnit.assertTrue("validate resourceType field",
+ resourceJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
// find derived from resource details
// Validate resource details after import-create resource including
// capabilities, interfaces from derived_from resource
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceWithOccurrencesSuccessFlow() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importWithOccurrences);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- AssertJUnit.assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- AssertJUnit.assertTrue("validate toscaResourceName field", resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
- AssertJUnit.assertTrue("validate resourceType field", resourceJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importWithOccurrences);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ AssertJUnit.assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ AssertJUnit.assertTrue("validate toscaResourceName field",
+ resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
+ AssertJUnit.assertTrue("validate resourceType field",
+ resourceJavaObject.getResourceType().equals(ResourceTypeEnum.VFC));
String requirementsType = "tosca.capabilities.Attachment";
String capabilitType = "tosca.capabilities.Endpoint.Admin";
// Verify Occurrences of requirements and capabilities in resource
verifyRequirementsOccurrences(resourceJavaObject, requirementsType);
verifyCapabilitiesOccurrences(resourceJavaObject, capabilitType);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
// ------------------------------Success---------------------------------
@@ -359,23 +399,34 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String resourceType = ResourceTypeEnum.VF.toString();
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importSuccessVFFile);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importSuccessVFFile);
// importReqDetails.setResourceType(resourceType);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- assertTrue("validate toscaResourceName field", resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
- assertTrue("validate resourceType field, expected - " + resourceType + ", actual - " + resourceJavaObject.getResourceType(), resourceJavaObject.getResourceType().toString().equals(resourceType));
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ assertTrue("validate toscaResourceName field",
+ resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
+ assertTrue(
+ "validate resourceType field, expected - " + resourceType + ", actual - "
+ + resourceJavaObject.getResourceType(),
+ resourceJavaObject.getResourceType().toString().equals(resourceType));
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
// ------------------------------Failure---------------------------------
@@ -384,195 +435,255 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
public void importToscaResourceDerivedFromNotExist() throws Exception {
String fileName = importNoDerivedFromFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
// List<String> derivedFrom = new ArrayList<String>() ;
// derivedFrom.add("hh");
// importReqDetails.setDerivedFrom(derivedFrom);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.PARENT_RESOURCE_NOT_FOUND.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PARENT_RESOURCE_NOT_FOUND.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PARENT_RESOURCE_NOT_FOUND.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceIncorrectDefinitionVersion() throws Exception {
String fileName = importInvalidDefinitionVersionFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_TOSCA_TEMPLATE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceIncorrectSpaceNameFormat() throws Exception {
String fileName = importIncorrectNameSpaceFormatFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_RESOURCE_NAMESPACE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_NAMESPACE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_NAMESPACE.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceNoDefinitionVersion() throws Exception {
String fileName = importNoDefenitionVersionFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_TOSCA_TEMPLATE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceNoContent() throws Exception {
String fileName = importNoContentFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_RESOURCE_PAYLOAD.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_PAYLOAD.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_PAYLOAD.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceWithTopologyTemplate() throws Exception {
String fileName = importTopologyTemplateFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.NOT_RESOURCE_TOSCA_TEMPLATE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.NOT_RESOURCE_TOSCA_TEMPLATE.name());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_RESOURCE_TOSCA_TEMPLATE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_RESOURCE_TOSCA_TEMPLATE.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceWithNodeTypesTwice() throws Exception {
String fileName = importNodeTypesTwiceFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.NOT_SINGLE_RESOURCE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_SINGLE_RESOURCE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.NOT_SINGLE_RESOURCE.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
// failed case - uniqueness of toscaResourceName - RESOURCE_ALREADY_EXISTS
@Test
public void importToscaResourceTwice() throws Exception {
String fileName = importSuccessFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- RestResponse checkInresponse = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKIN);
- assertTrue("checkIn resource request returned status:" + checkInresponse.getErrorCode(), checkInresponse.getErrorCode() == 200);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ RestResponse checkInresponse = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKIN);
+ assertTrue("checkIn resource request returned status:" + checkInresponse.getErrorCode(),
+ checkInresponse.getErrorCode() == 200);
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
// import the same tosca resource with different resourceName
DbUtils.cleanAllAudits();
@@ -582,23 +693,27 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
tags.add(importReqDetails.getName());
importReqDetails.setTags(tags);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_ALREADY_EXISTS.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name(), variables,
+ importResourceResponse.getResponse());
expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(importReqDetails.getToscaResourceName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@@ -607,7 +722,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// create resource
String fileName = importSuccessFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
resourceDetails = ElementFactory.getDefaultResource();
resourceDetails.setName(importReqDetails.getName());
@@ -622,50 +738,63 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// import the same tosca resource
DbUtils.cleanAllAudits();
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESOURCE_ALREADY_EXISTS.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceInvalidChecksum() throws Exception {
String fileName = importSuccessFile;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), "invalidMd5Sum");
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, headersMap);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ headersMap);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
assertNotNull("check response object is not null after import tosca resource", importResourceResponse);
- assertNotNull("check error code exists in response after import tosca resource", importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import tosca resource",
+ importResourceResponse.getErrorCode());
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_RESOURCE_CHECKSUM.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = Arrays.asList();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_CHECKSUM.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_RESOURCE_CHECKSUM.name(), variables,
+ importResourceResponse.getResponse());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
@@ -673,48 +802,67 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String resourceType = "invalidResourceType";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importSuccessFile);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importSuccessFile);
importReqDetails.setResourceType(resourceType);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_CONTENT.name());
assertNotNull("check response object is not null after import resouce", importResourceResponse);
- assertNotNull("check error code exists in response after import resource", importResourceResponse.getErrorCode());
- assertEquals("Check response code after import resource", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ assertNotNull("check error code exists in response after import resource",
+ importResourceResponse.getErrorCode());
+ assertEquals("Check response code after import resource", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
List<String> variables = new ArrayList<>();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_CONTENT.name(), variables,
+ importResourceResponse.getResponse());
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void derivedTemplateImportedSecondResourceAsFirstImportedNodeType() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importSuccessFile);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- assertTrue("validate toscaResourceName field", resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
- assertTrue("validate resourceType field, expected - " + importReqDetails.getResourceType() + ", actual - " + resourceJavaObject.getResourceType(), resourceJavaObject.getResourceType().toString().equals(importReqDetails.getResourceType()));
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importSuccessFile);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ assertTrue("validate toscaResourceName field",
+ resourceJavaObject.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
+ assertTrue(
+ "validate resourceType field, expected - " + importReqDetails.getResourceType() + ", actual - "
+ + resourceJavaObject.getResourceType(),
+ resourceJavaObject.getResourceType().toString().equals(importReqDetails.getResourceType()));
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
RestResponse certifyResource = LifecycleRestUtils.certifyResource(importReqDetails);
- assertTrue("certify resource request returned status:" + certifyResource.getErrorCode(), certifyResource.getErrorCode() == 200);
+ assertTrue("certify resource request returned status:" + certifyResource.getErrorCode(),
+ certifyResource.getErrorCode() == 200);
// import second resource template derived from first resource
DbUtils.cleanAllAudits();
@@ -722,23 +870,32 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
List<String> tags = new ArrayList<String>();
tags.add(importReqDetails.getName());
importReqDetails.setTags(tags);
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, derivedFromMyCompute);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ derivedFromMyCompute);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
+ assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
- Resource resourceJavaObject2 = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- assertTrue("validate toscaResourceName field", resourceJavaObject2.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
- assertTrue("validate resourceType field, expected - " + importReqDetails.getResourceType() + ", actual - " + resourceJavaObject2.getResourceType(), resourceJavaObject2.getResourceType().toString().equals(importReqDetails.getResourceType()));
+ Resource resourceJavaObject2 = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ assertTrue("validate toscaResourceName field",
+ resourceJavaObject2.getToscaResourceName().equals(parseToscaNodeYaml.getNodeName()));
+ assertTrue(
+ "validate resourceType field, expected - " + importReqDetails.getResourceType() + ", actual - "
+ + resourceJavaObject2.getResourceType(),
+ resourceJavaObject2.getResourceType().toString().equals(importReqDetails.getResourceType()));
// Validate audit message
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject2 = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject2 = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject2.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject2.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject2.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject2.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject2, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject2,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@@ -746,16 +903,25 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
public void importToscaResourceListPropertyGoodDefault() throws Exception {
String fileName = importListPropertyGoodDefault;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
- assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(), importResourceResponse.getErrorCode() == 201);
+ assertTrue("response code is not 201, returned :" + importResourceResponse.getErrorCode(),
+ importResourceResponse.getErrorCode() == 201);
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- assertTrue("Properties size : " + resourceJavaObject.getProperties().size(), resourceJavaObject.getProperties().size() == 1);
- assertTrue("Property type : " + resourceJavaObject.getProperties().get(0).getType(), resourceJavaObject.getProperties().get(0).getType().equals(ToscaPropertyType.LIST.getType()));
- assertTrue("actual Default values : " + resourceJavaObject.getProperties().get(0).getDefaultValue() + " , expected : " + "[false, true]", resourceJavaObject.getProperties().get(0).getDefaultValue().equals("[\"false\",\"true\"]"));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ assertTrue("Properties size : " + resourceJavaObject.getProperties().size(),
+ resourceJavaObject.getProperties().size() == 1);
+ assertTrue("Property type : " + resourceJavaObject.getProperties().get(0).getType(),
+ resourceJavaObject.getProperties().get(0).getType().equals(ToscaPropertyType.LIST.getType()));
+ assertTrue(
+ "actual Default values : " + resourceJavaObject.getProperties().get(0).getDefaultValue()
+ + " , expected : " + "[false, true]",
+ resourceJavaObject.getProperties().get(0).getDefaultValue().equals("[\"false\",\"true\"]"));
}
@@ -763,18 +929,23 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
public void importToscaResourceListPropertyBadDefault() throws Exception {
String fileName = importListPropertyBadDefault;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
-
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name());
- assertEquals("Check response code after tosca resource import", errorInfo.getCode(), importResourceResponse.getErrorCode());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name());
+ assertEquals("Check response code after tosca resource import", errorInfo.getCode(),
+ importResourceResponse.getErrorCode());
ArrayList<String> variables = new ArrayList<>();
variables.add("my_prop");
variables.add("list");
variables.add("boolean");
variables.add("[12,true]");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
+ importResourceResponse.getResponse());
}
@@ -783,47 +954,60 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
@Test
public void importToscaResourceListPropertySuccessFlow() throws Exception {
String fileName = importListPropertySuccess;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
ResourceRestUtils.checkCreateResponse(importResourceResponse);
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
// Verify Properties List in resource
verifyResourcePropertiesList(resourceJavaObject);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
// DE198534
@Test(dataProvider = "getYmlWithInValidListProperties") // invalid default
// values
- public void importToscaResourceListPropertyFailureFlows(String ymlFileWithInvalidPropertyDefualtValues, String defualtValues, String enterySchemaType) throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFileWithInvalidPropertyDefualtValues);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ public void importToscaResourceListPropertyFailureFlows(String ymlFileWithInvalidPropertyDefualtValues,
+ String defualtValues, String enterySchemaType) throws Exception {
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFileWithInvalidPropertyDefualtValues);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("my_property");
variables.add("list");
variables.add(enterySchemaType);
variables.add(defualtValues);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
+ importResourceResponse.getResponse());
}
// BUG DE198650
@Test
public void importToscaResourceListPropertyNonSupportEntrySchemaType() throws Exception {
String ymlFile = "ListPropertyFalure01.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFile);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFile);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("booolean"); // property entry_schema data type
variables.add("my_boolean");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_INNER_TYPE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_INNER_TYPE.name(), variables,
+ importResourceResponse.getResponse());
}
// BUG DE198676
@@ -832,46 +1016,59 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// "list"
// type
String ymlFile = "ListPropertyFalure16.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFile);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFile);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("koko"); // property data type (koko instead list)
variables.add("my_boolean");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables,
+ importResourceResponse.getResponse());
}
/// US656928 - [BE] - Add support for TOSCA "map" type - Phase 1 import
@Test
public void importToscaResourceMapPropertySuccessFlow() throws Exception {
String fileName = importMapPropertySuccess;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
ResourceRestUtils.checkCreateResponse(importResourceResponse);
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
// Verify Properties MAP in resource
verifyResourcePropertiesMap(resourceJavaObject);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test(dataProvider = "getYmlWithInValidMapProperties") // invalid default
// values
- public void importToscaResourceMapPropertyFailureFlows(String ymlFileWithInvalidPropertyDefualtValues, String defualtValues, String enterySchemaType) throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFileWithInvalidPropertyDefualtValues);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ public void importToscaResourceMapPropertyFailureFlows(String ymlFileWithInvalidPropertyDefualtValues,
+ String defualtValues, String enterySchemaType) throws Exception {
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFileWithInvalidPropertyDefualtValues);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("my_property");
variables.add("map");
variables.add(enterySchemaType);
variables.add(defualtValues);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
+ importResourceResponse.getResponse());
}
@Test
@@ -879,142 +1076,181 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// "Map"
// type
String ymlFile = "MapPropertyFalure16.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, ymlFile);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ ymlFile);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("koko"); // property data type (koko instead list)
variables.add("my_boolean");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables,
+ importResourceResponse.getResponse());
}
@Test
public void importToscaResourceMissingCapabilityInReqDefinition() throws Exception {
String fileName = missingCapInReqDef;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_CAPABILITY_TYPE.name());
String missingCapName = "org.openecomp.capabilities.networkInterfaceNotFound";
BaseRestUtils.checkErrorResponse(importResourceResponse, ActionStatus.MISSING_CAPABILITY_TYPE, missingCapName);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, Arrays.asList(missingCapName));
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, Arrays.asList(missingCapName));
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType("org.openecomp.resource.vSCP-03-16");
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceMissingCapabilityInCapDefinition() throws Exception {
String fileName = missingCapInCapDef;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
- logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
+ logger.debug("import tosca resource response: {}", importResourceResponse.getResponseMessage());
// Validate audit message
ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_CAPABILITY_TYPE.name());
String missingCapName = "org.openecomp.capabilities.networkInterfaceNotFound";
BaseRestUtils.checkErrorResponse(importResourceResponse, ActionStatus.MISSING_CAPABILITY_TYPE, missingCapName);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, Arrays.asList(missingCapName));
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, Arrays.asList(missingCapName));
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType("org.openecomp.resource.vSCP-03-16");
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceDuplicateRequirements() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importDuplicateRequirements);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importDuplicateRequirements);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("requirement");
variables.add("local_storage");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name(), variables, importResourceResponse.getResponse());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name(), variables,
+ importResourceResponse.getResponse());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceDuplicateCapabilities() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importDuplicateCapability);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importDuplicateCapability);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("capability");
variables.add("scalable");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name(), variables, importResourceResponse.getResponse());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name(), variables,
+ importResourceResponse.getResponse());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.IMPORT_DUPLICATE_REQ_CAP_NAME.name());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceRequirementNameExistsOnParent() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importRequirementNameExistsOnParent);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importRequirementNameExistsOnParent);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("requirement");
variables.add("local_storage");
variables.add("Compute");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(), variables, importResourceResponse.getResponse());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(),
+ variables, importResourceResponse.getResponse());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceCapabilityNameExistsOnParent() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importCapabilityNameExistsOnParent);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importCapabilityNameExistsOnParent);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertTrue(importResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
ArrayList<String> variables = new ArrayList<>();
variables.add("capability");
variables.add("binding");
variables.add("Compute");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(), variables, importResourceResponse.getResponse());
- ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name());
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(),
+ variables, importResourceResponse.getResponse());
+ ErrorInfo errorInfo = ErrorValidationUtils
+ .parseErrorConfigYaml(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgFailure(errorInfo, variables);
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
@Test
public void importToscaResourceReqCapDerivedFromParent() throws Exception {
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, importToscaResourceReqCapDerivedFromParent);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ importToscaResourceReqCapDerivedFromParent);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
BaseRestUtils.checkCreateResponse(importResourceResponse);
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType("org.openecomp.resource.MyWebApp");
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
/************************ Shay ************************/
@@ -1023,31 +1259,39 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
public void caseRequirementInsensitiveTest() throws Exception {
String fileName = "CaseInsensitiveReqTest_1.yml";
int expectedNumOfRequirements = 2;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
importReqDetails.setRequirements(testResourcesPath, fileName, sdncUserDetails, null);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String fileName2 = "CaseInsensitiveReqTest_2.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName2);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName2);
importReqDetails.setName("secondImportedResource");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, null);
requirements = importReqDetails.getRequirements();
- requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
@@ -1058,20 +1302,26 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
private void checkImportedAssetAssociated(ImportReqDetails importDetails) throws IOException, Exception {
RestResponse importResourceResponse;
ImportReqDetails importReqDetails2 = ElementFactory.getDefaultImportResource();
- importReqDetails2 = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails2, testResourcesPath, "BindingAsset.yml");
+ importReqDetails2 = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails2, testResourcesPath,
+ "BindingAsset.yml");
importReqDetails2.setName("bindingAsset");
importReqDetails2.setTags(Arrays.asList(importReqDetails2.getName()));
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails2, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- ResourceReqDetails vf = ElementFactory.getDefaultResourceByType("VF100", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncUserDetails.getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceReqDetails vf = ElementFactory.getDefaultResourceByType("VF100", NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, sdncUserDetails.getUserId(),
+ ResourceTypeEnum.VF.toString());
RestResponse createResourceResponse = ResourceRestUtils.createResource(vf, sdncUserDetails);
ResourceRestUtils.checkCreateResponse(createResourceResponse);
- LifecycleRestUtils.changeResourceState(importDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- LifecycleRestUtils.changeResourceState(importReqDetails2, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ LifecycleRestUtils.changeResourceState(importDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ LifecycleRestUtils.changeResourceState(importReqDetails2, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- RestResponse response = ResourceRestUtils.createResourceInstance(importDetails, sdncUserDetails, vf.getUniqueId());
+ RestResponse response = ResourceRestUtils.createResourceInstance(importDetails, sdncUserDetails,
+ vf.getUniqueId());
ResourceRestUtils.checkCreateResponse(response);
ComponentInstance riCap = ResponseParser.parseToObject(response.getResponse(), ComponentInstance.class);
@@ -1079,11 +1329,14 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
ResourceRestUtils.checkCreateResponse(response);
ComponentInstance riReq = ResponseParser.parseToObject(response.getResponse(), ComponentInstance.class);
- RestResponse getResourceBeforeAssociate = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncUserDetails, vf);
+ RestResponse getResourceBeforeAssociate = ComponentRestUtils
+ .getComponentRequirmentsCapabilities(sdncUserDetails, vf);
CapReqDef capReqDef = ResponseParser.parseToObject(getResourceBeforeAssociate.getResponse(), CapReqDef.class);
- String capbilityUid = capReqDef.getCapabilities().get("tosca.capabilities.network.Bindable").get(0).getUniqueId();
- String requirementUid = capReqDef.getRequirements().get("tosca.capabilities.network.Bindable").get(0).getUniqueId();
+ String capbilityUid = capReqDef.getCapabilities().get("tosca.capabilities.network.Bindable").get(0)
+ .getUniqueId();
+ String requirementUid = capReqDef.getRequirements().get("tosca.capabilities.network.Bindable").get(0)
+ .getUniqueId();
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
requirementDef.setFromNode(riReq.getUniqueId());
@@ -1102,7 +1355,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
relationships.add(pair);
requirementDef.setRelationships(relationships);
- RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncUserDetails, vf.getUniqueId(), ComponentTypeEnum.RESOURCE);
+ RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncUserDetails,
+ vf.getUniqueId(), ComponentTypeEnum.RESOURCE);
assertEquals("Check response code ", STATUS_CODE_SUCCESS, associateInstances.getErrorCode().intValue());
}
@@ -1111,25 +1365,32 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fileName = "CaseInsensitiveCapTest_1.yml";
int expectedNumOfCapabilities = 6;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
importReqDetails.setCapabilities(testResourcesPath, fileName, sdncUserDetails, null);
Map<String, Object> capabilities = importReqDetails.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String fileName2 = "CaseInsensitiveCapTest_2.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName2);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName2);
importReqDetails.setName("secondImportedResource");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
@@ -1137,7 +1398,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails.setCapabilities(testResourcesPath, fileName2, sdncUserDetails, null);
capabilities = importReqDetails.getCapabilities();
- capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
@@ -1148,13 +1410,16 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fileName = "DifferentReqFromCompute.yml";
int expectedNumOfRequirements = 3;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
importReqDetails.setRequirements(testResourcesPath, fileName, sdncUserDetails, "Compute");
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
@@ -1169,28 +1434,36 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails.setName("father");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String derivedFromResourceName = importReqDetails.getName();
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromResourceName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromResourceName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
@@ -1203,13 +1476,16 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, null);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
}
@@ -1221,13 +1497,17 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, "Compute");
+ importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ "Compute");
Map<String, Object> capabilities = importReqDetails.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
}
@@ -1239,15 +1519,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DifferentReqFromCompute.yml";
importReqDetails.setName("father");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String derivedFromName = importReqDetails.getName();
@@ -1255,13 +1540,16 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
@@ -1274,15 +1562,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DifferentReqFromCompute.yml";
importReqDetails.setName("father");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String derivedFromName = importReqDetails.getName();
@@ -1290,13 +1583,16 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
}
@@ -1310,15 +1606,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DifferentReqFromCompute.yml";
importReqDetails.setName(fatherName);
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String fatherUniqueId = importReqDetails.getUniqueId();
@@ -1328,26 +1629,30 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_INVALID_CONTENT, importResourceResponse.getErrorCode().intValue());
ArrayList<String> variables = new ArrayList<>();
variables.add("requirement");
variables.add("local_storage");
variables.add(fatherName);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(),
+ variables, importResourceResponse.getResponse());
importReqDetails.setUniqueId(fatherUniqueId);
importReqDetailsFather.setRequirements(testResourcesPath, fatherFileName, sdncUserDetails, "Compute");
Map<String, Object> requirements = importReqDetailsFather.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetailsFather, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetailsFather,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetailsFather.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
importReqDetailsFather.setCapabilities(testResourcesPath, fatherFileName, sdncUserDetails, "Compute");
Map<String, Object> capabilities = importReqDetailsFather.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetailsFather, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetailsFather,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetailsFather.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
}
@@ -1360,15 +1665,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DifferentReqFromCompute.yml";
importReqDetails.setName("father");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String derivedFromName = importReqDetails.getName();
@@ -1376,19 +1686,24 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
- importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> capabilities = importReqDetails.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
}
@@ -1401,15 +1716,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "MyFatherCompute_NoReqCap.yml";
importReqDetails.setName("father");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String derivedFromName = importReqDetails.getName();
@@ -1417,19 +1737,24 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
- importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> capabilities = importReqDetails.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
}
@@ -1443,15 +1768,20 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "myFatherWebApp_derviedFromDocker.yml";
importReqDetails.setName(fatherName);
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String fatherUniqueId = importReqDetails.getUniqueId();
@@ -1460,25 +1790,29 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_INVALID_CONTENT, importResourceResponse.getErrorCode().intValue());
ArrayList<String> variables = new ArrayList<>();
variables.add("requirement");
variables.add("host");
variables.add(fatherName);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED.name(),
+ variables, importResourceResponse.getResponse());
importReqDetails.setUniqueId(fatherUniqueId);
importReqDetailsFather.setRequirements(testResourcesPath, fatherFileName, sdncUserDetails, "Root");
Map<String, Object> requirements = importReqDetailsFather.getRequirements();
- Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetailsFather, expectedNumOfRequirements);
+ Map<String, Object> requirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetailsFather,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), requirementsFromResponse.keySet().size());
importReqDetailsFather.compareRequirementsOrCapabilities(requirements, requirementsFromResponse);
importReqDetailsFather.setCapabilities(testResourcesPath, fatherFileName, sdncUserDetails, "Root");
Map<String, Object> capabilities = importReqDetailsFather.getCapabilities();
- Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetailsFather, expectedNumOfCapabilities);
+ Map<String, Object> capabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetailsFather,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), capabilitiesFromResponse.keySet().size());
importReqDetailsFather.compareRequirementsOrCapabilities(capabilities, capabilitiesFromResponse);
}
@@ -1490,12 +1824,15 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DerivedFromWebApplication_HasNoReqType.yml";
importReqDetails.setName(fatherName);
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_INVALID_CONTENT, importResourceResponse.getErrorCode().intValue());
ArrayList<String> variables = new ArrayList<>();
variables.add("diff");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_CAPABILITY_TYPE.name(), variables, importResourceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_CAPABILITY_TYPE.name(), variables,
+ importResourceResponse.getResponse());
}
@@ -1508,45 +1845,58 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
String fatherFileName = "DifferentReqFromCompute.yml";
importReqDetails.setName(derivedFromName);
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fatherFileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fatherFileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse changeResourceState1 = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState1.getErrorCode().intValue());
- RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
+ RestResponse changeResourceState2 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState2.getErrorCode().intValue());
- RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
+ RestResponse changeResourceState3 = LifecycleRestUtils.changeResourceState(importReqDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.TESTER), LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState3.getErrorCode().intValue());
String childFileName = "DifferentReqCapFromCompute1.yml";
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("child");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, childFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ childFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- Map<String, Object> childRequirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
- Map<String, Object> childCapabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities - 1);
+ Map<String, Object> childRequirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
+ Map<String, Object> childCapabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities - 1);
String twinFileName = "DifferentReqCapFromCompute2.yml";
importReqDetails = ElementFactory.getDefaultImportResource();
importReqDetails.setName("twin");
importReqDetails.setTags(Arrays.asList(importReqDetails.getName()));
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, twinFileName);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ twinFileName);
importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
- importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setRequirements(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> requirements = importReqDetails.getRequirements();
- Map<String, Object> twinRequirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails, expectedNumOfRequirements);
+ Map<String, Object> twinRequirementsFromResponse = parseReqOrCapFromResponse("requirements", importReqDetails,
+ expectedNumOfRequirements);
assertEquals(requirements.keySet().size(), twinRequirementsFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(requirements, twinRequirementsFromResponse);
- importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails, derivedFromName);
+ importReqDetails.setCapabilities(testResourcesPath, importReqDetails.getPayloadName(), sdncUserDetails,
+ derivedFromName);
Map<String, Object> capabilities = importReqDetails.getCapabilities();
- Map<String, Object> twinCapabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails, expectedNumOfCapabilities);
+ Map<String, Object> twinCapabilitiesFromResponse = parseReqOrCapFromResponse("capabilities", importReqDetails,
+ expectedNumOfCapabilities);
assertEquals(capabilities.keySet().size(), twinCapabilitiesFromResponse.keySet().size());
importReqDetails.compareRequirementsOrCapabilities(capabilities, twinCapabilitiesFromResponse);
@@ -1562,7 +1912,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// create resource
importReqDetails.setName("import");
String invariantUuidDefinedByUser = "abcd1234";
- RestResponse importResourceResponse = importResourceWithRequestedInvariantUuid(importReqDetails, invariantUuidDefinedByUser);
+ RestResponse importResourceResponse = importResourceWithRequestedInvariantUuid(importReqDetails,
+ invariantUuidDefinedByUser);
String invariantUUIDcreation = ResponseParser.getInvariantUuid(importResourceResponse);
assertFalse(checkInvariantUuidEqual(invariantUuidDefinedByUser, importResourceResponse));
@@ -1571,94 +1922,114 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, getResource));
// checkin resource
- RestResponse changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKIN);
+ RestResponse changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKIN);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// checkout resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKOUT);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKOUT);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// checkin resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKIN);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKIN);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// checkout resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKOUT);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKOUT);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// checkin resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKIN);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKIN);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// certification request
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// start certification
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.STARTCERTIFICATION);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// certify
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.CERTIFY);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.CERTIFY);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
String certifiedUniqueId = importReqDetails.getUniqueId();
// update resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKOUT);
- ResourceReqDetails updatedResourceReqDetails = new ResourceReqDetails(importReqDetails, importReqDetails.getVersion());
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKOUT);
+ ResourceReqDetails updatedResourceReqDetails = new ResourceReqDetails(importReqDetails,
+ importReqDetails.getVersion());
updatedResourceReqDetails.setDescription("updatedDescription");
updatedResourceReqDetails.setVendorRelease("1.2.3.4");
- RestResponse updateResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceReqDetails, sdncUserDetails, importReqDetails.getUniqueId());
+ RestResponse updateResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceReqDetails,
+ sdncUserDetails, importReqDetails.getUniqueId());
assertEquals(STATUS_CODE_SUCCESS, updateResponse.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, updateResponse));
// certification request
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// checkout resource
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKOUT);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKOUT);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// certification request
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// start certification
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.STARTCERTIFICATION);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// cancel certification
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.CANCELCERTIFICATION);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.CANCELCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// start certification
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.STARTCERTIFICATION);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.STARTCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// failure
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser, LifeCycleStatesEnum.FAILCERTIFICATION);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, testerUser,
+ LifeCycleStatesEnum.FAILCERTIFICATION);
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
// upload artifact
- changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails, LifeCycleStatesEnum.CHECKOUT);
+ changeResourceState = LifecycleRestUtils.changeResourceState(importReqDetails, sdncUserDetails,
+ LifeCycleStatesEnum.CHECKOUT);
ArtifactReqDetails artifactDetails = ElementFactory.getDefaultArtifact();
- ArtifactRestUtils.addInformationalArtifactToResource(artifactDetails, sdncUserDetails, importReqDetails.getUniqueId());
+ ArtifactRestUtils.addInformationalArtifactToResource(artifactDetails, sdncUserDetails,
+ importReqDetails.getUniqueId());
assertEquals(STATUS_CODE_SUCCESS, changeResourceState.getErrorCode().intValue());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, changeResourceState));
@@ -1666,8 +2037,10 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
resourceDetails.setResourceType(ResourceTypeEnum.VF.toString());
ResourceRestUtils.createResource(resourceDetails, sdncUserDetails);
importReqDetails.setUniqueId(certifiedUniqueId);
- ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getComponentResourceInstance(importReqDetails);
- RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, sdncUserDetails, resourceDetails.getUniqueId(), ComponentTypeEnum.RESOURCE);
+ ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory
+ .getComponentResourceInstance(importReqDetails);
+ RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(
+ resourceInstanceReqDetails, sdncUserDetails, resourceDetails.getUniqueId(), ComponentTypeEnum.RESOURCE);
assertEquals(STATUS_CODE_CREATED, createResourceInstanceResponse.getErrorCode().intValue());
getResource = ResourceRestUtils.getResource(importReqDetails.getUniqueId());
assertTrue(checkInvariantUuidEqual(invariantUUIDcreation, getResource));
@@ -1681,14 +2054,16 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
@Test
public void checkCPHasImmutableInvariantUuidTest() throws Exception {
String filename = "FatherHasNoReqCap.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, filename);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ filename);
checkResourceHasImmutableInvariantUuidTest(importReqDetails);
}
@Test
public void checkVFCHasImmutableInvariantUuidTest() throws Exception {
String filename = "computeCap11.yml";
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, filename);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ filename);
checkResourceHasImmutableInvariantUuidTest(importReqDetails);
}
@@ -1713,17 +2088,21 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
checkInvariantUuidIsImmutableInDifferentAction(importReqDetails);
}
- private static RestResponse importResourceWithRequestedInvariantUuid(ImportReqDetails importDetails, String invariantUuid) throws Exception {
+ private static RestResponse importResourceWithRequestedInvariantUuid(ImportReqDetails importDetails,
+ String invariantUuid) throws Exception {
importDetails.setInvariantUUID(invariantUuid);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importDetails, sdncUserDetails, null);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importDetails, sdncUserDetails,
+ null);
assertEquals(STATUS_CODE_CREATED, importResourceResponse.getErrorCode().intValue());
return importResourceResponse;
}
- private Map<String, Object> parseReqOrCapFromResponse(String parsedFieldName, ImportReqDetails importReqDetails, int expectedNumOfReqCap) throws ClientProtocolException, IOException {
+ private Map<String, Object> parseReqOrCapFromResponse(String parsedFieldName, ImportReqDetails importReqDetails,
+ int expectedNumOfReqCap) throws ClientProtocolException, IOException {
RestResponse getResource = ResourceRestUtils.getResource(importReqDetails.getUniqueId());
assertTrue(getResource.getErrorCode().equals(STATUS_CODE_SUCCESS));
- Map<String, Object> parsedFieldFromResponseToMap = ResponseParser.getJsonValueAsMap(getResource, parsedFieldName);
+ Map<String, Object> parsedFieldFromResponseToMap = ResponseParser.getJsonValueAsMap(getResource,
+ parsedFieldName);
Iterator<String> iterator = parsedFieldFromResponseToMap.keySet().iterator();
actualNumOfReqOrCap = 0;
while (iterator.hasNext()) {
@@ -1746,81 +2125,98 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
case "my_boolean":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[false,true]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "my_boolean_array":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[true,false]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "duplicate_boolean_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[true,false,true]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_values_Insensitive":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[true,false,true]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "my_integers":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[0,1000,-1000,50]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "my_integers_array":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[10,-1000,0]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "duplicate_integers_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[10,10,-1000,0]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "my_string":
assertTrue("Check Property Type ", pro.getType().equals("list"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"asdc\",\"$?^@ecomp$!#%()_-~@+*^...;;/w#\",\"uc\"]"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("[\"asdc\",\"$?^@ecomp$!#%()_-~@+*^...;;/w#\",\"uc\"]"));
// assertTrue("Check Property default values ",
// pro.getDefaultValue().equals("[\"asdc\",\"@=~!@#$%^&*()_+=?><:-w\",\"uc\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "my_string_array":
assertTrue("Check Property Type ", pro.getType().equals("list"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"AAA\",\"~$~#bbb%^*_-\",\"qwe\",\"1.3\",\"500\",\"true\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("[\"AAA\",\"~$~#bbb%^*_-\",\"qwe\",\"1.3\",\"500\",\"true\"]"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "duplicate_string_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"asdc\",\"asdc\",\"uc\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("[\"asdc\",\"asdc\",\"uc\"]"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_null_value":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"asdc\",\"uc\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_space_value":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"asdc\",\"uc\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_array_null_value":
assertTrue("Check Property Type ", pro.getType().equals("list"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("[\"aaa\",\"bbb\",\"500\"]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("[\"aaa\",\"bbb\",\"500\"]"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "my_float":
@@ -1850,31 +2246,36 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
case "integer_no_default_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "string_no_default_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "boolean_no_default_values":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "integer_null_value":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[1000,2000]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "boolean_null_value":
assertTrue("Check Property Type ", pro.getType().equals("list"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("[true,false]"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "float_null_value":
@@ -2001,307 +2402,391 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
switch (pro.getName()) {
case "string_prop01":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop02":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop03":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"val1\",\"keyB\":\"val2\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop04":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"10\",\"keyB\":\"true\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"10\",\"keyB\":\"true\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop05":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":\"Big\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":\"Big\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop06":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"aaaA\",\"keyB\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"aaaA\",\"keyB\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop07":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop08":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"\",\"keyB\":\"abcd\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"\",\"keyB\":\"abcd\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop09":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\" \",\"keyB\":\"abcd\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\" \",\"keyB\":\"abcd\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop10":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\" aaaa\",\"keyB\":\" bbbb\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\" aaaa\",\"keyB\":\" bbbb\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop11":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"aaaa \",\"keyB\":\"bbbb \"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\"aaaa \",\"keyB\":\"bbbb \"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop12":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\" aaaa \",\"keyB\":\" bbbb ccccc \"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":\" aaaa \",\"keyB\":\" bbbb ccccc \"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop13":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"aaaa\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop14":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\" aaaa \"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop15":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"AbcD\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop16":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"AbcD\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop17":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"AbcD\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop18":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"AbcD\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop19":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"AbcD\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop20":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":\"aaaa\",\"keya\":\"aaaa\",\"Keya\":\"Aaaa\",\"KEYA\":\"nnnn\"}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ", pro.getDefaultValue()
+ .equals("{\"keyA\":\"aaaa\",\"keya\":\"aaaa\",\"Keya\":\"Aaaa\",\"KEYA\":\"nnnn\"}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop21":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "string_prop22":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("string"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("string"));
isPropertyAppear = true;
break;
case "integer_prop01":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":1,\"keyB\":1000}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":1,\"keyB\":1000}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop02":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop03":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":800,\"keyB\":-600}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":800,\"keyB\":-600}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop04":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":-600}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":-600}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop05":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":0}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":0}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop06":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":0}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":0}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop07":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":100}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":100}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop08":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":200}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":200}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop09":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":200}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":100,\"keyB\":200}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop10":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":2222}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":2222}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop11":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop12":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "integer_prop13":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":200}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("integer"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("integer"));
isPropertyAppear = true;
break;
case "boolean_prop01":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop02":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop03":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop04":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop05":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false,\"keyC\":false}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop06":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":true,\"keyC\":false}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":true,\"keyC\":false}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop07":
assertTrue("Check Property Type ", pro.getType().equals("map"));
assertEquals("Check Property default values ", pro.getDefaultValue(), null);
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop08":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":true,\"keyB\":false}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "boolean_prop09":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":false,\"keyB\":true}"));
- assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("boolean"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":false,\"keyB\":true}"));
+ assertTrue("Check entrySchema Property Type ",
+ pro.getSchema().getProperty().getType().equals("boolean"));
isPropertyAppear = true;
break;
case "float_prop01":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":1.2,\"keyB\":3.56,\"keyC\":33}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":1.2,\"keyB\":3.56,\"keyC\":33}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop02":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":0.0,\"keyB\":0.0,\"keyC\":0}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":0.0,\"keyB\":0.0,\"keyC\":0}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop03":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop04":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":1.2,\"keyB\":3.56,\"keyC\":33}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":1.2,\"keyB\":3.56,\"keyC\":33}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop05":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":33,\"keyB\":1.2,\"keyC\":3.607,\"keyD\":0}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":33,\"keyB\":1.2,\"keyC\":3.607,\"keyD\":0}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop06":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":33,\"keyB\":1.2,\"keyC\":3.607}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":33,\"keyB\":1.2,\"keyC\":3.607}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
case "float_prop07":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":null,\"keyB\":null,\"keyC\":null,\"keyD\":null}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
@@ -2313,7 +2798,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
break;
case "float_prop09":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":0.01,\"keyB\":null}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":0.01,\"keyB\":null}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
@@ -2325,7 +2811,8 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
break;
case "float_prop11":
assertTrue("Check Property Type ", pro.getType().equals("map"));
- assertTrue("Check Property default values ", pro.getDefaultValue().equals("{\"keyA\":3.56,\"keyB\":33}"));
+ assertTrue("Check Property default values ",
+ pro.getDefaultValue().equals("{\"keyA\":3.56,\"keyB\":33}"));
assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType().equals("float"));
isPropertyAppear = true;
break;
@@ -2340,11 +2827,15 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
public void importToscaResourceAttributeSuccessFlow() throws Exception {
String fileName = importAttributeSuccess;
- importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath, fileName);
- RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails, null);
+ importReqDetails = ImportUtils.getImportResourceDetailsByPathAndName(importReqDetails, testResourcesPath,
+ fileName);
+ RestResponse importResourceResponse = ResourceRestUtils.createImportResource(importReqDetails, sdncUserDetails,
+ null);
ResourceRestUtils.checkCreateResponse(importResourceResponse);
- Resource resourceJavaObject = ResponseParser.convertResourceResponseToJavaObject(importResourceResponse.getResponse());
- ToscaNodeTypeInfo parseToscaNodeYaml = utils.parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
+ Resource resourceJavaObject = ResponseParser
+ .convertResourceResponseToJavaObject(importResourceResponse.getResponse());
+ ToscaNodeTypeInfo parseToscaNodeYaml = utils
+ .parseToscaNodeYaml(Decoder.decode(importReqDetails.getPayloadData()));
HashMap<String, AttributeDefinition> attr = new HashMap<>();
@@ -2379,13 +2870,14 @@ public class ImportToscaResourceTest extends ComponentBaseTest {
// verify Resource Attributes
validateResourceAttribute(resourceJavaObject, attr);
- // TO DO
- ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory.getDefaultImportResourceAuditMsgSuccess();
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = ElementFactory
+ .getDefaultImportResourceAuditMsgSuccess();
expectedResourceAuditJavaObject.setResourceName(importReqDetails.getName());
expectedResourceAuditJavaObject.setModifierName(sdncUserDetails.getFullName());
expectedResourceAuditJavaObject.setModifierUid(sdncUserDetails.getUserId());
expectedResourceAuditJavaObject.setToscaNodeType(parseToscaNodeYaml.getNodeName());
- AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
+ AuditingActionEnum.IMPORT_RESOURCE.getName(), null, false);
}
private void validateResourceAttribute(Resource resource, Map<String, AttributeDefinition> attr) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
index 9e8b94e5a8..464ebe12ed 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.ci.tests.execute.imports;
import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
index 345b81eb3e..b71240b527 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java
@@ -20,24 +20,33 @@
package org.openecomp.sdc.ci.tests.execute.inputs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstInputsMap;
import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstancePropInput;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
@@ -48,6 +57,7 @@ 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.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils;
@@ -55,6 +65,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils;
import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -164,6 +175,69 @@ public class InputsApiTests extends ComponentBaseTest {
}
/**
+ * Test to check deletion of inputs related to CP/VL property values
+ * @throws Exception
+ */
+ @Test
+ public void testDeleteInputsRelatedToPropertyValues() throws Exception {
+ Service service = createServiceWithVLinstance();
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ String simplePropName = "network_technology";
+ String complexPropName = "network_assignments";
+ String propertiesName = "network_assignments#ipv6_subnet_default_assignment#ip_network_address_plan";
+ String vlInstanceId = service.getComponentInstances().get(0).getUniqueId();
+
+ // Take a simple property type and a complex property type
+ List<ComponentInstanceProperty> inputsToAdd = service.getComponentInstancesProperties().get(vlInstanceId)
+ .stream()
+ .filter(p -> simplePropName.equals(p.getName()) || complexPropName.equals(p.getName()))
+ .collect(Collectors.toList());
+
+ List<ComponentInstancePropInput> propInputList = new ArrayList<>();
+ for (ComponentInstanceProperty prop : inputsToAdd) {
+ if (simplePropName.equals(prop.getName())) {
+ propInputList.add(new ComponentInstancePropInput(prop));
+ } else {
+ propInputList.add(buildComponentInstNetworkAssignmentIpv6AssignmentComplexPropertyInput(prop, propertiesName));
+ }
+ }
+ // Set component instance property input map and add to inputs service
+ ComponentInstInputsMap componentInstInputsMap = buildComponentInstPropertyInputsMap(vlInstanceId, propInputList);
+ RestResponse addInputResponse = InputsRestUtils.addInput(service, componentInstInputsMap, UserRoleEnum.DESIGNER);
+ BaseValidationUtils.checkSuccess(addInputResponse);
+
+ // Get the updated service
+ ServiceReqDetails serviceDetails = new ServiceReqDetails(service);
+ RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails, user);
+ service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+
+ // validate instance get_input property values in service and tosca template
+ ComponentInstance vlInstance = service.getComponentInstances().get(0);
+ String simplePropValue = "{\"get_input\":\"" + vlInstance.getNormalizedName() + "_" + simplePropName + "\"}";
+ String complexPropValue = "{\"ipv6_subnet_default_assignment\":{\"ip_network_address_plan\":{\"get_input\":\"" + vlInstance.getNormalizedName() + "_" + propertiesName.replaceAll("#", "_") + "\"}}}";
+ // download and compare
+ Map<String, Object> load = downloadAndParseServiceToscaTemplate(user, service);
+ validateGetInputInstancePropertyValues(load, service, simplePropName, simplePropValue, complexPropName, complexPropValue, vlInstance);
+
+ // Delete inputs from service
+ RestResponse deleteInputResponse = InputsRestUtils.deleteInputFromComponent(service, service.getInputs().get(0).getUniqueId());
+ BaseValidationUtils.checkSuccess(deleteInputResponse);
+ deleteInputResponse = InputsRestUtils.deleteInputFromComponent(service, service.getInputs().get(1).getUniqueId());
+ BaseValidationUtils.checkSuccess(deleteInputResponse);
+
+ // Get the updated service
+ getServiceResponse = ServiceRestUtils.getService(serviceDetails, user);
+ service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+
+ // download and compare (get_input property values removed)
+ load = downloadAndParseServiceToscaTemplate(user, service);
+ simplePropValue = "{}";
+ complexPropValue = "{\"ipv6_subnet_default_assignment\":{\"ip_network_address_plan\":{}}}";
+ validateGetInputInstancePropertyValues(load, service, simplePropName, simplePropValue, complexPropName, complexPropValue, vlInstance);
+
+ }
+
+ /**
* Private method to create service with VF instance that has inputs
* This is private method to be used by multiple tests
*
@@ -207,7 +281,40 @@ public class InputsApiTests extends ComponentBaseTest {
return service;
}
- /**
+
+ private Service createServiceWithVLinstance() throws Exception, IOException {
+ // Create default service
+ Either<Service, RestResponse> createDefaultServiceEither = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
+ if (createDefaultServiceEither.isRight()){
+ assertTrue("Error creating default service", false);
+ }
+ Service service = createDefaultServiceEither.left().value();
+
+ Resource vl = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "ExtVL", "1.0");
+
+ // add VL instance to service
+ Either<ComponentInstance, RestResponse> vlInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vl, service, UserRoleEnum.DESIGNER, true);
+ if (vlInstDetails.isRight()){
+ assertTrue("Error adding VF to service", false);
+ }
+
+ // Get service response
+ ServiceReqDetails serviceDetails = new ServiceReqDetails(service);
+ RestResponse getServiceResponse = ServiceRestUtils.getService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ service = ResponseParser.parseToObjectUsingMapper(getServiceResponse.getResponse(), Service.class);
+
+ // Get instances from service
+ ComponentInstance instance = service.getComponentInstances().get(0);
+ if (instance != null){
+ assertTrue("Success creating service with VF instance", true);
+ } else {
+ assertTrue("Error creating service with VF instance", false);
+ }
+
+ return service;
+ }
+
+ /**
* Return default ComponentInstInputsMap
*
* @param addToInput
@@ -221,5 +328,80 @@ public class InputsApiTests extends ComponentBaseTest {
componentInstInputsMap.setComponentInstanceInputsMap(map);
return componentInstInputsMap;
}
+
+ private ComponentInstInputsMap buildComponentInstPropertyInputsMap (String instanceId, List<ComponentInstancePropInput> props) {
+ Map<String, List<ComponentInstancePropInput>> map = new HashMap<>();
+ map.put(instanceId, props);
+ ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap();
+ componentInstInputsMap.setComponentInstancePropInput(map);
+ return componentInstInputsMap;
+ }
+
+
+ private ComponentInstancePropInput buildComponentInstNetworkAssignmentIpv6AssignmentComplexPropertyInput (ComponentInstanceProperty prop, String propertiesName) {
+ ComponentInstancePropInput componentInstancePropInput = new ComponentInstancePropInput(prop);
+ componentInstancePropInput.setPropertiesName(propertiesName);
+ PropertyDefinition input = new PropertyDefinition();
+ input.setUniqueId("org.openecomp.datatypes.network.SubnetAssignments.datatype.ip_network_address_plan");
+ input.setName("ip_network_address_plan");
+ input.setParentUniqueId("org.openecomp.datatypes.network.SubnetAssignments.datatype");
+ input.setType("string");
+ componentInstancePropInput.setInput(input);
+ return componentInstancePropInput;
+
+ }
+
+ private Map<String, Object> downloadAndParseServiceToscaTemplate(User user, Service service) throws Exception {
+ String artifactUniqeId = service.getToscaArtifacts().get("assettoscatemplate").getUniqueId();
+ RestResponse toscaTemplate = ArtifactRestUtils.downloadServiceArtifactInternalApi(service.getUniqueId(), user, artifactUniqeId);
+ BaseRestUtils.checkSuccess(toscaTemplate);
+ ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(toscaTemplate.getResponse(), ArtifactUiDownloadData.class);
+ byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
+ byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+ Yaml yaml = new Yaml();
+ InputStream inputStream = new ByteArrayInputStream(decodeBase64);
+ Map<String, Object> load = (Map<String, Object>) yaml.load(inputStream);
+ return load;
+ }
+
+ private void validateGetInputInstancePropertyValues (Map<String, Object> load, Service service, String simplePropName, String simplePropValue, String complexPropName, String complexPropValue, ComponentInstance instance) {
+
+ String instanceName = instance.getName();
+ String instanceId = instance.getUniqueId();
+ ComponentInstanceProperty simpleProp = service.getComponentInstancesProperties().get(instanceId).stream().filter(p -> p.getName().equals(simplePropName)).findAny().get();
+ ComponentInstanceProperty complexProp = service.getComponentInstancesProperties().get(instanceId).stream().filter(p -> p.getName().equals(complexPropName)).findAny().get();
+
+ assertEquals(simpleProp.getValue(), simplePropValue);
+ assertEquals(complexProp.getValue(), complexPropValue);
+ // compare with downloaded tosca template
+ assertNotNull(load);
+ Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template");
+ assertNotNull(topology_template);
+ Map<String, Object> nodes = (Map<String, Object>) topology_template.get("node_templates");
+ assertNotNull(nodes);
+ Map<String, Object> vlInstanceObj = (Map<String, Object>) nodes.get(instanceName);
+ assertNotNull(vlInstanceObj);
+ Map<String, Object> props = (Map<String, Object>) vlInstanceObj.get("properties");
+ assertNotNull(props);
+ Map<String, Object> complexPropObj = (Map<String, Object>) props.get(complexPropName);
+ assertNotNull(complexPropObj);
+ Gson gson = new Gson();
+ assertEquals(gson.toJson(complexPropObj), complexProp.getValue());
+
+ // if simpleProp has an empty value it will not be generated in the tosca map
+ if (!simpleProp.getValue().equals("{}")){
+ Map<String, Object> simplePropObj = (Map<String, Object>) props.get(simplePropName);
+ assertNotNull(simplePropObj);
+ assertEquals(gson.toJson(simplePropObj), simpleProp.getValue());
+ }
+
+
+
+
+
+
+ }
+
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
index e15652dddf..84bb5421ab 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/LCSbaseTest.java
@@ -56,7 +56,7 @@ import org.testng.annotations.BeforeMethod;
/**
*
- * @author al714h
+ * @author alitvinsky
*
* resourceDetails - create, Add Heat, certify resourceDetails1 - create
* resource, LCS - CheckOut serviceDetails - create, add RI from
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/ServiceCertWithoutDeploymentArtifacts.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/ServiceCertWithoutDeploymentArtifacts.java
new file mode 100644
index 0000000000..53f1fd20d5
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/lifecycle/ServiceCertWithoutDeploymentArtifacts.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.lifecycle;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+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.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.Test;
+
+public class ServiceCertWithoutDeploymentArtifacts extends LCSbaseTest {
+ protected ServiceReqDetails serviceDetails;
+ protected User sdncDesignerDetails;
+ protected User sdncAdminDetails;
+ protected Service serviceServ;
+
+ @Rule
+ public static TestName testName = new TestName();
+
+ public ServiceCertWithoutDeploymentArtifacts() {
+ super(testName, ServiceCertWithoutDeploymentArtifacts.class.getName());
+ }
+
+ @Test
+ /**
+ * checks possibility to certify service without of deployment artifacts
+ * @throws Exception
+ */
+ public void testDeploymentArtifactsRestriction() throws Exception {
+
+ sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ serviceServ = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+ assertTrue(serviceServ.getDeploymentArtifacts() == null || serviceServ.getDeploymentArtifacts().isEmpty());
+ assertTrue(serviceServ.getComponentInstances() == null || serviceServ.getComponentInstances().isEmpty());
+ serviceDetails = new ServiceReqDetails(serviceServ);
+ RestResponse changeServiceState = LCSbaseTest.certifyService(serviceDetails, sdncDesignerDetails);
+ assertTrue("certify service request returned status:" + changeServiceState.getErrorCode(),
+ changeServiceState.getErrorCode() == 200);
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
index 7891f4a46b..623b29b8e6 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductBaseTest.java
@@ -85,9 +85,11 @@ public abstract class ProductBaseTest extends ComponentBaseTest {
defaultCategories = createCategoriesChain(definitionsList);
}
- private List<CategoryDefinition> createCategoriesChain(List<CategoryDefinition> categoryDefinitions) throws Exception {
+ private List<CategoryDefinition> createCategoriesChain(List<CategoryDefinition> categoryDefinitions)
+ throws Exception {
for (CategoryDefinition categoryDefinition : categoryDefinitions) {
- RestResponse createCategory = CategoryRestUtils.createCategory(categoryDefinition, productStrategistUser1, PRODUCT_COMPONENT_TYPE);
+ RestResponse createCategory = CategoryRestUtils.createCategory(categoryDefinition, productStrategistUser1,
+ PRODUCT_COMPONENT_TYPE);
int status = createCategory.getErrorCode().intValue();
if (status == BaseRestUtils.STATUS_CODE_CREATED) {
String categoryId = ResponseParser.getUniqueIdFromResponse(createCategory);
@@ -95,7 +97,8 @@ public abstract class ProductBaseTest extends ComponentBaseTest {
}
List<SubCategoryDefinition> subcategories = categoryDefinition.getSubcategories();
for (SubCategoryDefinition subCategoryDefinition : subcategories) {
- RestResponse createSubCategory = CategoryRestUtils.createSubCategory(subCategoryDefinition, categoryDefinition, productStrategistUser1, PRODUCT_COMPONENT_TYPE);
+ RestResponse createSubCategory = CategoryRestUtils.createSubCategory(subCategoryDefinition,
+ categoryDefinition, productStrategistUser1, PRODUCT_COMPONENT_TYPE);
status = createSubCategory.getErrorCode().intValue();
if (status == BaseRestUtils.STATUS_CODE_CREATED) {
String subCategoryId = ResponseParser.getUniqueIdFromResponse(createSubCategory);
@@ -103,7 +106,8 @@ public abstract class ProductBaseTest extends ComponentBaseTest {
}
List<GroupingDefinition> groupings = subCategoryDefinition.getGroupings();
for (GroupingDefinition groupingDefinition : groupings) {
- RestResponse createGroupingRest = CategoryRestUtils.createGrouping(groupingDefinition, subCategoryDefinition, categoryDefinition, productStrategistUser1, PRODUCT_COMPONENT_TYPE);
+ RestResponse createGroupingRest = CategoryRestUtils.createGrouping(groupingDefinition,
+ subCategoryDefinition, categoryDefinition, productStrategistUser1, PRODUCT_COMPONENT_TYPE);
status = createGroupingRest.getErrorCode().intValue();
if (status == BaseRestUtils.STATUS_CODE_CREATED) {
String groupingId = ResponseParser.getUniqueIdFromResponse(createGroupingRest);
@@ -114,8 +118,9 @@ public abstract class ProductBaseTest extends ComponentBaseTest {
}
RestResponse allCategories = CategoryRestUtils.getAllCategories(productStrategistUser1, PRODUCT_COMPONENT_TYPE);
Gson gson = new Gson();
- List<CategoryDefinition> res = gson.fromJson(allCategories.getResponse(), new TypeToken<List<CategoryDefinition>>() {
- }.getType());
+ List<CategoryDefinition> res = gson.fromJson(allCategories.getResponse(),
+ new TypeToken<List<CategoryDefinition>>() {
+ }.getType());
return res;
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
index ec1f7ad38d..efb4a15255 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java
@@ -34,6 +34,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.Convertor;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
index ec3d9b75a5..fe5a6e34f9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductComponentInstanceCRUDTest.java
@@ -106,17 +106,13 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// addresourceDetailsCP_02 ,resourceDetailsVFC_02 and
// resourceDetailsVL_02 to resourceDetailsVF_02 check-in VF
- RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02,
- resourceDetailsVFC_02, sdncDesignerDetails);
+ RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVFC_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsCP_02,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsCP_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVL_02,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVL_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
- RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetailsVF_02, sdncDesignerDetails,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetailsVF_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
resourceDetailsVF_02.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
// addresourceDetailsCP_01 ,resourceDetailsVFC_01 and
// resourceDetailsVL_01 to resourceDetailsVF_01 and certify
@@ -130,19 +126,16 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// has
// check-in
// VF
- restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
- LifeCycleStatesEnum.CHECKIN);
+ restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails,
- LifeCycleStatesEnum.CHECKIN);
+ restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_02, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
}
// pass
@Test
public void createServiceInstanceTest() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@@ -151,33 +144,27 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test(enabled = false)
public void createServiceInstanceFromCheckedOutState() throws Exception {
// can't create instance of checked-out component
- RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
- LifeCycleStatesEnum.CHECKOUT);
+ RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceInToAnotherServiceInstance() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String uniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails,
- sdncPmDetails1, uniqueIdFromResponse, ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, uniqueIdFromResponse, ComponentTypeEnum.PRODUCT);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_NOT_FOUND);
}
@Test
public void createSeveralServiceInstanceFromSameServices() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
@@ -186,8 +173,7 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createSeveralServiceInstanceFromDifferentServices() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
@@ -197,22 +183,18 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createCertifiedServiceInstance() throws Exception {
changeServiceStateToCertified(serviceDetails_01);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceByPm() throws Exception {
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@@ -220,51 +202,43 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createServiceInstanceWithoutVf() throws Exception {
LifecycleRestUtils.changeServiceState(serviceDetails_03, sdncAdminDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_02, serviceDetails_03,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_02, serviceDetails_03, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_02, 1, 0);
}
@Test
public void createServiceInstanceByNonProductOwner() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails2);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceByNonAsdcUser() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
;
nonExistingSdncUser.setUserId("bt1234");
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonExistingSdncUser);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceToNotCheckOutProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@@ -274,25 +248,19 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String expectedServiceInstanceName = serviceDetails_01.getName() + " 1";
String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "1";
serviceDetails_01.setName("");
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(),
- "normalizedName");
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
- assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(),
- instanceNormalizedName);
+ assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
getComponentAndValidateRIs(productDetails_01, 1, 0);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
- assertEquals((expectedServiceInstancenormalizedName).toLowerCase(),
- actualComponentInstance.getNormalizedName());
+ assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
}
// pass
@@ -301,116 +269,91 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String expectedServiceInstanceName = serviceDetails_01.getName() + " 1";
String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "1";
serviceDetails_01.setName(null);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(),
- "normalizedName");
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
String instanceName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
- assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(),
- instanceNormalizedName);
+ assertEquals("check Resource Instance normalizedName ", (expectedServiceInstancenormalizedName).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", expectedServiceInstanceName, instanceName);
getComponentAndValidateRIs(productDetails_01, 1, 0);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(expectedServiceInstanceName, actualComponentInstance.getName());
- assertEquals((expectedServiceInstancenormalizedName).toLowerCase(),
- actualComponentInstance.getNormalizedName());
+ assertEquals((expectedServiceInstancenormalizedName).toLowerCase(), actualComponentInstance.getNormalizedName());
}
@Test(enabled = false)
public void createServiceInstanceToNonExistingProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
- ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails,
- sdncPmDetails1, "blabla", ComponentTypeEnum.PRODUCT);
- AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
- createServiceInstanceResp.getErrorCode().intValue());
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
+ ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blabla", ComponentTypeEnum.PRODUCT);
+ AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, createServiceInstanceResp.getErrorCode().intValue());
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("blabla");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales,
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceToNonSupportedComponentType() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails,
- sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("null");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales,
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
// pass
@Test
public void createServiceInstancePositionIsEmpty() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
serviceInstanceReqDetails.setPosX("");
serviceInstanceReqDetails.setPosY("");
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- ComponentInstance componentInstance = ResponseParser
- .parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
+ ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstancePositionIsNull() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
serviceInstanceReqDetails.setPosX(null);
serviceInstanceReqDetails.setPosY(null);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
- ComponentInstance componentInstance = ResponseParser
- .parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
+ ComponentInstance componentInstance = ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(), ComponentInstance.class);
addCompInstReqCapToExpected(componentInstance, ComponentTypeEnum.PRODUCT);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceByDesigner() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncDesignerDetails);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void createServiceInstanceUserIdIsEmpty() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
nonSdncDetails.setUserId("");
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, nonSdncDetails);
assertTrue(createServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(),
- createServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), createServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@@ -419,34 +362,25 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void updateServiceInstanceNameByPm() throws Exception {
// Check-in Product by PM and Check-out by PM
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
// Create service instance by PM
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "abcD";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", newName, instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(newName, actualComponentInstance.getName());
assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
@@ -454,23 +388,18 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void updateServiceInstanceNewNameAndLocation() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "updaatedName100";
serviceInstanceReqDetails.setPosX("100");
serviceInstanceReqDetails.setPosY("100");
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
@@ -480,29 +409,21 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test(enabled = false)
public void updateServiceInstanceNameRemoveSpacesFromBiginningAndEnd() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = " Abcd ";
String expectedNewName = " Abcd ";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
- assertEquals("check Resource Instance normalizedName ", (expectedNewName).toLowerCase(),
- instanceNormalizedName);
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+ assertEquals("check Resource Instance normalizedName ", (expectedNewName).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", expectedNewName, instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(expectedNewName, actualComponentInstance.getName());
assertEquals((expectedNewName).toLowerCase(), actualComponentInstance.getNormalizedName());
@@ -511,28 +432,21 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// pass
@Test
public void updateServiceInstanceNameAllowedCharacters() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "qwer-TYUIOP_asd_0987654321.Abcd";
String ExpectedNormalizName = "qwertyuiopasd0987654321abcd";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
assertEquals("check Resource Instance normalizedName ", ExpectedNormalizName, instanceNormalizedName);
assertEquals("check Resource Instance Name ", newName, instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(newName, actualComponentInstance.getName());
assertEquals(ExpectedNormalizName, actualComponentInstance.getNormalizedName());
@@ -541,54 +455,40 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void updateInstanceNameInvalidCharacters() throws Exception {
- char invalidChars[] = { '~', '!', '$', '%', '^', '*', '(', ')', '"', '{', '}', '[', ']', '?', '>', '<', '/',
- '|', '\\', ',' };
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ char invalidChars[] = { '~', '!', '$', '%', '^', '*', '(', ')', '"', '{', '}', '[', ']', '?', '>', '<', '/', '|', '\\', ',' };
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "Abcd1";
String updateName;
for (int i = 0; i < invalidChars.length; i++) {
updateName = newName + invalidChars[i];
serviceInstanceReqDetails.setName(updateName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(),
- ComponentTypeEnum.PRODUCT);
- assertEquals("Check response code ", STATUS_CODE_INVALID_CONTENT,
- updateServiceInstanceResponse.getErrorCode().intValue());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ assertEquals("Check response code ", STATUS_CODE_INVALID_CONTENT, updateServiceInstanceResponse.getErrorCode().intValue());
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("Service Instance");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), varibales,
- updateServiceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPONENT_NAME.name(), varibales, updateServiceInstanceResponse.getResponse());
}
}
// pass
@Test
public void updateInstanceNameMaxLength() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "Qwertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl12345";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
assertEquals("check Resource Instance normalizedName ", (newName).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", newName, instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(newName, actualComponentInstance.getName());
assertEquals((newName).toLowerCase(), actualComponentInstance.getNormalizedName());
@@ -596,30 +496,22 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void updateInstanceNameExceedMaxLength() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String expectedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "name");
- String expectedNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(),
- "normalizedName");
+ String expectedNormalizedName = ResponseParser.getValueFromJsonResponse(createServiceInstanceResp.getResponse(), "normalizedName");
String newName = "Qwertyuiop1234567890asdfAhjklzxcvbnmasdfghjkl123456";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
- assertEquals("Check response code ", STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT,
- updateServiceInstanceResponse.getErrorCode().intValue());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ assertEquals("Check response code ", STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT, updateServiceInstanceResponse.getErrorCode().intValue());
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("Service Instance");
varibales.add("50");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), varibales,
- updateServiceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT.name(), varibales, updateServiceInstanceResponse.getResponse());
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(expectedName, actualComponentInstance.getName());
assertEquals(expectedNormalizedName, actualComponentInstance.getNormalizedName());
@@ -630,28 +522,20 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// see US534663 In case a PS/PM removes the current service instance
// name then BE has to generate again the "default" service instance
// name
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
- assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(),
- instanceNormalizedName);
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+ assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 2"), instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(instanceName, actualComponentInstance.getName());
assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
@@ -663,28 +547,20 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// see US534663 In case a PS/PM removes the current service instance
// name then BE has to generate again the "default" service instance
// name
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = null;
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
- assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(),
- instanceNormalizedName);
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+ assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + "2").toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance normalizedName ", (serviceDetails_01.getName() + " 2"), instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(instanceName, actualComponentInstance.getName());
assertEquals(instanceNormalizedName, actualComponentInstance.getNormalizedName());
@@ -695,125 +571,93 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// see US534663 In case a PS/PM removes the current service instance
// name then BE has to generate again the "default" service instance
// name
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "blabla";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails2, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
- assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
- updateServiceInstanceResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- updateServiceInstanceResponse.getResponse());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails2, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
}
@Test
public void updateServiceInstance_UserIdIsNonAsdcUser() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "blabla";
serviceInstanceReqDetails.setName(newName);
User nonSdncUserDetails = new User();
nonSdncUserDetails.setUserId("bt4567");
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, nonSdncUserDetails, productDetails_01.getUniqueId(),
- ComponentTypeEnum.PRODUCT);
- assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION,
- updateServiceInstanceResponse.getErrorCode().intValue());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- updateServiceInstanceResponse.getResponse());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, nonSdncUserDetails, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ assertEquals("Check response code ", STATUS_CODE_RESTRICTED_OPERATION, updateServiceInstanceResponse.getErrorCode().intValue());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), updateServiceInstanceResponse.getResponse());
}
@Test
public void updateServiceInstanceNameToAlreadyExisting() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String ServiceName1 = ResponseParser.getNameFromResponse(createServiceInstanceResp);
- createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails,
- sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
// Update service instance2 name to service instance1
serviceInstanceReqDetails.setName(ServiceName1);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
- assertEquals("Check response code ", STATUS_CODE_ALREADY_EXISTS,
- updateServiceInstanceResponse.getErrorCode().intValue());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ assertEquals("Check response code ", STATUS_CODE_ALREADY_EXISTS, updateServiceInstanceResponse.getErrorCode().intValue());
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("Service Instance");
varibales.add(ServiceName1);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name(), varibales,
- updateServiceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_NAME_ALREADY_EXIST.name(), varibales, updateServiceInstanceResponse.getResponse());
}
@Test
public void updateServiceInstanceForNonExistingProduct() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "blabla";
serviceInstanceReqDetails.setName(newName);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, "blablabla", ComponentTypeEnum.PRODUCT);
- AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
- updateServiceInstanceResponse.getErrorCode().intValue());
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, "blablabla", ComponentTypeEnum.PRODUCT);
+ AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales,
- updateServiceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
}
@Test
public void updateNonExistingServiceInstance() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String newName = "blabla";
serviceInstanceReqDetails.setName(newName);
serviceInstanceReqDetails.setUniqueId("11111111");
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add(newName);
varibales.add("service instance");
- AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND,
- updateServiceInstanceResponse.getErrorCode().intValue());
+ AssertJUnit.assertEquals("Check response code ", STATUS_CODE_NOT_FOUND, updateServiceInstanceResponse.getErrorCode().intValue());
// need to change ActionStatus.RESOURCE_INSTANCE_NOT_FOUND.name() to
// ActionStatus.SERVICE_INSTANCE_NOT_FOUND.name()
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND.name(), varibales,
- updateServiceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND.name(), varibales, updateServiceInstanceResponse.getResponse());
}
@Test
public void updateServiceInstanceLocation() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
serviceInstanceReqDetails.setPosX("50");
serviceInstanceReqDetails.setPosY("100");
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
@@ -821,23 +665,18 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void updateServiceInstanceToNonExistingLocation() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
String nameFromResponse = ResponseParser.getNameFromResponse(createServiceInstanceResp);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
serviceInstanceReqDetails.setPosX("-50");
serviceInstanceReqDetails.setPosY("-100");
serviceInstanceReqDetails.setName(nameFromResponse);
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
@@ -848,16 +687,13 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void updateServiceInstanceLocationNameIsEmpty() throws Exception {
String expectedServiceInstanceName = serviceDetails_01.getName() + " 2";
String expectedServiceInstancenormalizedName = serviceDetails_01.getName() + "2";
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
serviceInstanceReqDetails.setPosX("100");
serviceInstanceReqDetails.setPosY("200");
serviceInstanceReqDetails.setName("");
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
String nameFromResponse = ResponseParser.getNameFromResponse(updateServiceInstanceResponse);
String postX = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "posX");
@@ -866,10 +702,8 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
assertEquals(postX, "100");
assertEquals(postY, "200");
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(serviceInstanceReqDetails.getPosX(), actualComponentInstance.getPosX());
assertEquals(serviceInstanceReqDetails.getPosY(), actualComponentInstance.getPosY());
@@ -880,10 +714,8 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// pass
@Test
public void updateServiceInstanceNameToProductName() throws Exception {
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_01);
- RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_01);
+ RestResponse createServiceInstanceResp = ComponentInstanceRestUtils.createComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
// ComponentInstance componentInstance =
// ResponseParser.parseToObjectUsingMapper(createServiceInstanceResp.getResponse(),
@@ -891,21 +723,15 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// addCompInstReqCapToExpected(componentInstance,
// ComponentTypeEnum.PRODUCT);
serviceInstanceReqDetails.setName(productDetails_01.getName());
- RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateServiceInstanceResponse = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ResourceRestUtils.checkSuccess(updateServiceInstanceResponse);
- String instanceNormalizedName = ResponseParser
- .getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
- String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(),
- "name");
- assertEquals("check Resource Instance normalizedName ", (serviceInstanceReqDetails.getName()).toLowerCase(),
- instanceNormalizedName);
+ String instanceNormalizedName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "normalizedName");
+ String instanceName = ResponseParser.getValueFromJsonResponse(updateServiceInstanceResponse.getResponse(), "name");
+ assertEquals("check Resource Instance normalizedName ", (serviceInstanceReqDetails.getName()).toLowerCase(), instanceNormalizedName);
assertEquals("check Resource Instance Name ", serviceInstanceReqDetails.getName(), instanceName);
// get product and verify that service instanceName is correct
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
assertEquals(serviceInstanceReqDetails.getName(), actualComponentInstance.getName());
assertEquals((serviceInstanceReqDetails.getName()).toLowerCase(), actualComponentInstance.getNormalizedName());
@@ -915,35 +741,29 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void deleteAllServiceInstanceFromProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 0, 0);
}
@Test
public void deleteServiceWhileServiceInstanceExistInProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
// Delete service while service instance of it exist in product
- RestResponse deleteServiceResponse = ServiceRestUtils.deleteServiceById(serviceDetails_01.getUniqueId(),
- sdncDesignerDetails.getUserId());
+ RestResponse deleteServiceResponse = ServiceRestUtils.deleteServiceById(serviceDetails_01.getUniqueId(), sdncDesignerDetails.getUserId());
assertTrue(deleteServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
// Get product and verify that service instance still exists
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
// ComponentInstance actualComponentInstance =
// actualProduct.getComponentInstances().get(0);
// assertTrue(serviceInstanceUniqueIdFromResponse ==
@@ -954,89 +774,72 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// pass
@Test
public void deleteServiceInstanceByPm() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void deleteServiceInstanceByPmCreatedByPm() throws Exception {
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void deleteServiceInstanceByPmWhichIsCheckedOutByAnotherPm() throws Exception {
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails2);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails2);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
// DE190189
@Test
public void deleteServiceInstanceByPmCreatedByPs() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
String productOldUniqueId = productDetails_01.getUniqueId();
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
// get product and get service instance new uniquId
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPmDetails1.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPmDetails1.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 0, 0);
}
@@ -1044,120 +847,97 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// DE190189
@Test
public void deleteServiceInstanceByAdminCreatedByPs() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
String productOldUniqueId = productDetails_01.getUniqueId();
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
String productNewUniqueId = ResponseParser.getUniqueIdFromResponse(restResponse);
updateExpectedReqCapAfterChangeLifecycleState(productOldUniqueId, productNewUniqueId);
// get product and get service instance new uniquId
- RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncAdminDetails.getUserId());
- Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(),
- Product.class);
+ RestResponse getActualProductResponse = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncAdminDetails.getUserId());
+ Product actualProduct = ResponseParser.parseToObjectUsingMapper(getActualProductResponse.getResponse(), Product.class);
ComponentInstance actualComponentInstance = actualProduct.getComponentInstances().get(0);
String serviceInstanceUniqueId = actualComponentInstance.getUniqueId();
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncAdminDetails);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 0, 0);
}
@Test
public void createAndDeleteServiceInstanceByAdmin() throws Exception {
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails,
- LifeCycleStatesEnum.CHECKOUT);
+ restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncAdminDetails, LifeCycleStatesEnum.CHECKOUT);
ResourceRestUtils.checkSuccess(restResponse);
// productDetails_01.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse));
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncAdminDetails);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncAdminDetails);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncAdminDetails);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncAdminDetails);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void deleteServiceInstanceFromNonCheckOutProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeProductState(productDetails_01, sdncPmDetails1, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void deleteServiceInstanceByDesigner() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncDesignerDetails);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncDesignerDetails);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteServiceInstanceByTester() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncTesterDetails);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncTesterDetails);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteServiceInstanceByPsWhichIsCheckedOutByAnotherPs() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPsDetails2);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPsDetails2);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@@ -1167,96 +947,80 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
User nonExistingSdncUser = ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1);
;
nonExistingSdncUser.setUserId("bt1234");
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- nonExistingSdncUser);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonExistingSdncUser);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_RESTRICTED_OPERATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteServiceInstanceFromNonExistingProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1,
- "1234567890", serviceInstanceUniqueId, ComponentTypeEnum.PRODUCT);
+ RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, "1234567890", serviceInstanceUniqueId, ComponentTypeEnum.PRODUCT);
assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales,
- deleteResourceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteNonExistingServiceInstanceFromProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
// String serviceInstanceUniqueId =
// ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1,
- productDetails_01.getUniqueId(), "1234567890123456unExistingServiceInstance",
- ComponentTypeEnum.PRODUCT);
+ RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), "1234567890123456unExistingServiceInstance", ComponentTypeEnum.PRODUCT);
assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("1234567890123456unExistingServiceInstance");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales,
- deleteResourceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PRODUCT_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteServiceInstanceFromNonSupportedComponentType() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1,
- productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.RESOURCE_INSTANCE);
+ RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.RESOURCE_INSTANCE);
assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_UNSUPPORTED_ERROR);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("null");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales,
- deleteResourceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(), varibales, deleteResourceInstanceResponse.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@Test
public void deleteServiceInstanceComponentTypeIsNotProduct() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1,
- productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.SERVICE);
+ RestResponse deleteResourceInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncPmDetails1, productDetails_01.getUniqueId(), serviceInstanceUniqueId, ComponentTypeEnum.SERVICE);
assertTrue(deleteResourceInstanceResponse.getErrorCode() == STATUS_CODE_NOT_FOUND);
ArrayList<String> varibales = new ArrayList<String>();
varibales.add("");
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales,
- deleteResourceInstanceResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), varibales, deleteResourceInstanceResponse.getResponse());
getComponentAndValidateRIs(productDetails_01, 2, 0);
}
@@ -1264,31 +1028,26 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void deleteServiceInstanceUserIdIsEmpty() throws Exception {
User nonSdncDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
nonSdncDetails.setUserId("");
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- nonSdncDetails);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, nonSdncDetails);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_MISSING_INFORMATION);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(),
- deleteServiceInstanceResp.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(), deleteServiceInstanceResp.getResponse());
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@Test
public void deleteCertifiedServiceInstance() throws Exception {
changeServiceStateToCertified(serviceDetails_01);
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_02, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 2, 0);
- RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01,
- sdncPmDetails1);
+ RestResponse deleteServiceInstanceResp = deleteServiceInstance(serviceInstanceUniqueId, productDetails_01, sdncPmDetails1);
assertTrue(deleteServiceInstanceResp.getErrorCode() == STATUS_CODE_SUCCESS_DELETE);
getComponentAndValidateRIs(productDetails_01, 1, 0);
}
@@ -1296,18 +1055,15 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
////////////////////////////////////
private void certifyVf(ResourceReqDetails resource) throws Exception {
- RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01,
- sdncDesignerDetails);
+ RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_02,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVFC_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
String computeCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resource, resourceDetailsVL_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
String vlCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
@@ -1317,35 +1073,29 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
fulfillCpRequirement(resource, cpCompInstId, computeCompInstId, computeCompInstId, user, containerCompType);
consumeVlCapability(resource, cpCompInstId, vlCompInstId, cpCompInstId, user, containerCompType);
- RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails,
- sdncDesignerDetails, resource.getUniqueId());
+ RestResponse response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails, resource.getUniqueId());
ResourceRestUtils.checkSuccess(response);
RestResponse changeResourceStateToCertified = changeResourceStateToCertified(resource);
ResourceRestUtils.checkSuccess(changeResourceStateToCertified);
}
private RestResponse changeResourceStateToCertified(ResourceReqDetails resourceDetails) throws Exception {
- RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
- LifeCycleStatesEnum.CHECKIN);
+ RestResponse restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
ResourceRestUtils.checkSuccess(restResponse);
- restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails,
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
if (restResponse.getErrorCode() == 200) {
- restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
- LifeCycleStatesEnum.STARTCERTIFICATION);
+ restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails, LifeCycleStatesEnum.STARTCERTIFICATION);
} else
return restResponse;
if (restResponse.getErrorCode() == 200) {
- restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails,
- LifeCycleStatesEnum.CERTIFY);
+ restResponse = LifecycleRestUtils.changeResourceState(resourceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
if (restResponse.getErrorCode() == 200) {
String newVersion = ResponseParser.getVersionFromResponse(restResponse);
resourceDetails.setVersion(newVersion);
resourceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
resourceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
resourceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
- String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
- "uniqueId");
+ String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
resourceDetails.setUniqueId(uniqueIdFromRresponse);
}
}
@@ -1354,28 +1104,21 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
private RestResponse changeServiceStateToCertified(ServiceReqDetails serviceDetails) throws Exception {
/*
- * RestResponse restResponse =
- * LifecycleRestUtils.changeServiceState(serviceDetails,
- * sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
- * ResourceRestUtils.checkSuccess(restResponse);
+ * RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN); ResourceRestUtils.checkSuccess(restResponse);
*/
- RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails,
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
if (restResponse.getErrorCode() == 200) {
- restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
- LifeCycleStatesEnum.STARTCERTIFICATION);
+ restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.STARTCERTIFICATION);
} else
return restResponse;
if (restResponse.getErrorCode() == 200) {
- restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails,
- LifeCycleStatesEnum.CERTIFY);
+ restResponse = LifecycleRestUtils.changeServiceState(serviceDetails, sdncTesterDetails, LifeCycleStatesEnum.CERTIFY);
if (restResponse.getErrorCode() == 200) {
serviceDetails.setVersion("1.0");
serviceDetails.setLifecycleState(LifecycleStateEnum.CERTIFIED);
serviceDetails.setLastUpdaterUserId(sdncTesterDetails.getUserId());
serviceDetails.setLastUpdaterFullName(sdncTesterDetails.getFullName());
- String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(),
- "uniqueId");
+ String uniqueIdFromRresponse = ResponseParser.getValueFromJsonResponse(restResponse.getResponse(), "uniqueId");
serviceDetails.setUniqueId(uniqueIdFromRresponse);
}
}
@@ -1384,8 +1127,7 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void deleteServiceInstanceTest() throws Exception {
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
getComponentAndValidateRIs(productDetails_01, 1, 0);
String compInstId = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
@@ -1408,14 +1150,12 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void returnedServiceInstanceTypeAttributeTest() throws Exception {
String expectedServiceType = ComponentTypeEnum.SERVICE.getValue().toUpperCase();
- RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01,
- sdncPmDetails1);
+ RestResponse createServiceInstanceResp = createServiceInstance(productDetails_01, serviceDetails_01, sdncPmDetails1);
ResourceRestUtils.checkCreateResponse(createServiceInstanceResp);
String serviceUniqueIdFromResponse = ResponseParser.getUniqueIdFromResponse(createServiceInstanceResp);
ComponentInstanceRestUtils.checkComponentInstanceType(createServiceInstanceResp, expectedServiceType);
- RestResponse getProductResp = ProductRestUtils.getProduct(productDetails_01.getUniqueId(),
- sdncPsDetails1.getUserId());
+ RestResponse getProductResp = ProductRestUtils.getProduct(productDetails_01.getUniqueId(), sdncPsDetails1.getUserId());
ProductRestUtils.checkSuccess(getProductResp);
Product productObject = ResponseParser.parseToObjectUsingMapper(getProductResp.getResponse(), Product.class);
List<ComponentInstance> productComponentInstances = productObject.getComponentInstances();
@@ -1424,12 +1164,10 @@ public class ProductComponentInstanceCRUDTest extends ComponentInstanceBaseTest
assertTrue(expectedServiceType.equals(actualOriginType));
}
- ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(serviceDetails_02);
+ ComponentInstanceReqDetails serviceInstanceReqDetails = ElementFactory.getComponentResourceInstance(serviceDetails_02);
serviceInstanceReqDetails.setUniqueId(serviceUniqueIdFromResponse);
serviceInstanceReqDetails.setComponentUid(serviceDetails_01.getUniqueId());
- RestResponse updateResourceInstance = ComponentInstanceRestUtils.updateComponentInstance(
- serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
+ RestResponse updateResourceInstance = ComponentInstanceRestUtils.updateComponentInstance(serviceInstanceReqDetails, sdncPmDetails1, productDetails_01.getUniqueId(), ComponentTypeEnum.PRODUCT);
ComponentInstanceRestUtils.checkSuccess(updateResourceInstance);
ComponentInstanceRestUtils.checkComponentInstanceType(updateResourceInstance, expectedServiceType);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
index d2c2dfe77f..7ac24bdd69 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java
@@ -38,6 +38,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.Convertor;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
index f234708b7a..d91391d967 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java
@@ -34,10 +34,13 @@ import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Product;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
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.expected.ExpectedProductAudit;
@@ -49,10 +52,13 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ProductValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils;
import org.openecomp.sdc.common.api.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -310,7 +316,7 @@ public class ProductCrudTest extends ProductBaseTest {
productManager1.setUserId(null);
RestResponse getProductRes = ProductRestUtils.getProduct(productReqDetails.getUniqueId(), productManager1.getUserId());
- assertEquals("Check response code after getting created Producuct with userId extracted from header", BaseRestUtils.STATUS_CODE_MISSING_INFORMATION, getProductRes.getErrorCode().intValue());
+ assertEquals("Check response code after getting created Producuct with UserId extracted from header", BaseRestUtils.STATUS_CODE_MISSING_INFORMATION, getProductRes.getErrorCode().intValue());
}
@@ -337,8 +343,8 @@ public class ProductCrudTest extends ProductBaseTest {
// US594753 - Update Product metadata
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductAllFieldsByPM() throws Exception {
createProducrByPSAndCheckIn();
@@ -558,8 +564,8 @@ public class ProductCrudTest extends ProductBaseTest {
ProductValidationUtils.compareExpectedAndActualProducts(expectedProduct, actualProduct, ComponentOperationEnum.UPDATE_COMPONENT);
}
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameHasMinLength() throws Exception {
createProducrByPSAndCheckIn();
@@ -581,8 +587,8 @@ public class ProductCrudTest extends ProductBaseTest {
ProductValidationUtils.compareExpectedAndActualProducts(expectedProduct, actualProduct, ComponentOperationEnum.UPDATE_COMPONENT);
}
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
// DE193857 - Normalized Name is not removing special characters
@Test(enabled = false)
public void updateProductNameMaxLength() throws Exception {
@@ -641,7 +647,7 @@ public class ProductCrudTest extends ProductBaseTest {
Product product1 = ResponseParser.parseToObjectUsingMapper(createProduct.getResponse(), Product.class);
RestResponse changeProductLifeCycle = ProductRestUtils.changeProductLifeCycle(product1, productManager2, LifeCycleStatesEnum.CHECKIN);
ProductRestUtils.checkSuccess(changeProductLifeCycle);
- productReqDetails.setName("CiProduct2000");
+ productReqDetails.setName("Product2000");
// productReqDetails.setTags(Arrays.asList(productReqDetails.getName()));
createProduct = ProductRestUtils.createProduct(productReqDetails, productManager2);
ProductRestUtils.checkCreateResponse(createProduct);
@@ -670,8 +676,8 @@ public class ProductCrudTest extends ProductBaseTest {
}
// DE193857 - Normalized Name is not removing special characters
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameAllowedCharacters() throws Exception {
createProducrByPSAndCheckIn();
@@ -686,7 +692,7 @@ public class ProductCrudTest extends ProductBaseTest {
// , ‘ ‘
// (space),
// ampersand
- // dash
+ // "&", dash
// “-“, plus
// "+", period
// ".",
@@ -697,7 +703,7 @@ public class ProductCrudTest extends ProductBaseTest {
// ":", at "@",
// and
// underscore
- //
+ // "_"
String newNormalizedName = "abu4km&kobujuggp";
String newName = "A_BU4k M&K=o#b-u.j-uG'g+P";
RestResponse updateProduct = ProductRestUtils.updateProduct(productReqDetails, productManager1);
@@ -714,8 +720,8 @@ public class ProductCrudTest extends ProductBaseTest {
ProductValidationUtils.compareExpectedAndActualProducts(expectedProduct, actualProduct, ComponentOperationEnum.UPDATE_COMPONENT);
}
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameRemoveSpaceFromBeginning() throws Exception {
createProducrByPSAndCheckIn();
@@ -741,8 +747,8 @@ public class ProductCrudTest extends ProductBaseTest {
ProductValidationUtils.compareExpectedAndActualProducts(expectedProduct, actualProduct, ComponentOperationEnum.UPDATE_COMPONENT);
}
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameRemoveSpaceFromEnd() throws Exception {
createProducrByPSAndCheckIn();
@@ -769,8 +775,8 @@ public class ProductCrudTest extends ProductBaseTest {
}
//// DE193857 - Normalized Name is not removing special characters
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ //// "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameRemoveExtraNonAlphanumericChars() throws Exception {
createProducrByPSAndCheckIn();
@@ -796,8 +802,8 @@ public class ProductCrudTest extends ProductBaseTest {
ProductValidationUtils.compareExpectedAndActualProducts(expectedProduct, actualProduct, ComponentOperationEnum.UPDATE_COMPONENT);
}
- // If user update Product Name we need to remove the old product name from
- // Tags and add the new product name instead - will be handled in new US
+ // If user update "product name" we need to remove the old product name from
+ // "Tags" and add the new product name instead - will handled in mew US
@Test(enabled = false)
public void updateProductNameValidationStartWithNumber() throws Exception {
createProducrByPSAndCheckIn();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
index 8c3409342b..26bb3e29e9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductLifecycleTest.java
@@ -48,7 +48,8 @@ public abstract class ProductLifecycleTest extends ProductBaseTest {
public void init() throws Exception {
ProductReqDetails defaultProduct = ElementFactory.getDefaultProduct(defaultCategories);
RestResponse createProduct = ProductRestUtils.createProduct(defaultProduct, productManager1);
- assertEquals("Check response code after create Product", BaseRestUtils.STATUS_CODE_CREATED, createProduct.getErrorCode().intValue());
+ assertEquals("Check response code after create Product", BaseRestUtils.STATUS_CODE_CREATED,
+ createProduct.getErrorCode().intValue());
expectedProduct = ResponseParser.parseToObjectUsingMapper(createProduct.getResponse(), Product.class);
}
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
index 303be77f92..1cf16978e4 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/AdditionalInformationServletTest.java
@@ -35,8 +35,8 @@ import java.util.Map;
import org.json.simple.parser.JSONParser;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.AdditionalInfoParameterInfo;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.PropertyConstraint;
import org.openecomp.sdc.be.model.Resource;
@@ -1459,7 +1459,7 @@ public class AdditionalInformationServletTest extends ComponentBaseTest {
assertEquals("check returned id", fromJson.getUniqueId(), updatedJson.getUniqueId());
fromJson.setKey(updatedKey);
- fromJson.setValue("");
+ fromJson.setValue("\uC2B5");
updatedProperty = updateServiceAdditionalInformation(serviceId, fromJson, user, fromJson.getUniqueId());
assertNotNull("check response object is not null after update additional information", updatedProperty);
@@ -1990,7 +1990,7 @@ public class AdditionalInformationServletTest extends ComponentBaseTest {
assertEquals("Check response code after create resource", 201, createResourceResponse.getErrorCode().intValue());
String key = "AAA AAA";
- String value = "";
+ String value = "\uC2B5";
AdditionalInfoParameterInfo additionalInfoParameterInfo = new AdditionalInfoParameterInfo(null, key, value);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
index 6ba1b2ccca..c9aa44a6c0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentInstancePropertyTest.java
@@ -25,16 +25,19 @@ import static org.testng.AssertJUnit.assertTrue;
import java.util.ArrayList;
import java.util.List;
+import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
@@ -46,6 +49,9 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -96,11 +102,9 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// first res
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
// second resource
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
// third resource
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
// verify property
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, actualPropertyList);
@@ -115,23 +119,17 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
public void nestedVfResourceProperty3Levels() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
// verify property
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -142,18 +140,14 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
public void nestedVfResourceProperty3LevelsAndCpWithProp() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// four resource
- Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
- NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
cpStringProperty.setName("Different Name");
cpStringProperty.setPropertyDefaultValue("Different value from default");
@@ -162,19 +156,13 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList, vfResource);
// verify property
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -184,28 +172,21 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
@Test
public void nestedCertifiedVfResourceProperty3Levels() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
// verify property
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
}
@@ -214,31 +195,22 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
public void nestedVfResourceProperty3Levels2SameResInstances() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
// verify property
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
@@ -250,32 +222,23 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
@Test
public void nestedVfResourceProperty3LevelsUpdateFirstLevelProperty() throws Exception {
// first res
- basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
- NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
+ basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -284,25 +247,19 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedStringValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(vfResource, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
@@ -311,31 +268,22 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
// second resource
- vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
- basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
- UserRoleEnum.DESIGNER, true);
+ vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
- AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
- true);
+ AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -343,26 +291,19 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedIntegerValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue(
- "expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS
- + " ,but was " + updatePropertyValueOnResourceInstance.getErrorCode(),
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(vfResource, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS + " ,but was " + updatePropertyValueOnResourceInstance.getErrorCode(),
updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated properly",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated properly", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
@@ -370,32 +311,23 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
public void nestedVfResourceProperty3LevelsUpdateThirdLevelProperty() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
// third resource
- vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
- vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
- UserRoleEnum.DESIGNER, true);
+ vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
- AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
- true);
+ AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -403,24 +335,18 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedBooleanValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(vfResource, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
@@ -433,57 +359,41 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
public void serviceWithNestedResourceProperty3Levels() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
}
/**
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1)
+ * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1)
*/
@Test
public void serviceWithNestedResourceProperty3LevelsAndVfProperty() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
PropertyReqDetails propDetails = ElementFactory.getDefaultBooleanProperty();
propDetails.setName(newBooleanPropName);
propDetails.setPropertyDefaultValue(newBooleanPropValue);
@@ -501,36 +411,28 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfResource, expectedPropertyList);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
}
/**
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1) CP(VF inst) (p5)
+ * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1) CP(VF inst) (p5)
*/
@Test
public void serviceWithNestedResourceProperty3LevelsAndCp() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// four resource
- Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
- NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
cpStringProperty.setName("Different Name");
cpStringProperty.setPropertyDefaultValue("Different value from default");
@@ -539,54 +441,40 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList, vfResource);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
}
/**
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1) CP(inst) (p5)
+ * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1) CP(inst) (p5)
*/
@Test
public void serviceWithNestedResourceProperty3LevelsAndCpResInst() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// expectedPropertyList =
// PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
// expectedPropertyList);
// four resource
- Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
- NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
cpStringProperty.setName("Different Name");
cpStringProperty.setPropertyDefaultValue("Different value from default");
@@ -594,75 +482,55 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
}
/**
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3) (p2) (p1)
- * | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
+ * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3) (p2) (p1) | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
*
- * VF2(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3') (p2') (p1') |
- * (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
+ * VF2(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3') (p2') (p1') | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
*/
@Test
public void serviceNestedVfResourceProperty3Levels2SameResInstances() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
// verify property
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
- vfResource);
+ PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList, vfResource);
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
@@ -671,23 +539,15 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
@@ -696,25 +556,19 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// service test template
/**
- * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1)
+ * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1)
*/
@Test
public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
newProp.setName(newStringPropName);
@@ -726,15 +580,11 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
@@ -745,32 +595,25 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
* update property(p4)
*
*
- * VFC(p1) ^ | VFC(p2) ^ | Service-->VF(inst)-->VF-->(VFC(inst)-->VFC(p3)
- * (p4)
+ * VFC(p1) ^ | VFC(p2) ^ | Service-->VF(inst)-->VF-->(VFC(inst)-->VFC(p3) (p4)
*/
@Test
public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty_UpdateVfproperty() throws Exception {
// Create VFC(check-in state) derived from another resource
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
// add property to VF
PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
newProp.setName(newStringPropName);
newProp.setPropertyDefaultValue(newStringPropValue);
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
@@ -779,72 +622,51 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update VF instance property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedStringValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
/**
- * update property(p1)
- * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1)
+ * update property(p1) Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1)
*/
@Test
- public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance1LevelProperty()
- throws Exception {
-
- basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
- NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
+ public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance1LevelProperty() throws Exception {
+
+ basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
// verify property
PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
newProp.setName(newStringPropName);
@@ -856,72 +678,51 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update VF property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedStringValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
/**
- * update property(p2)
- * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1)
+ * update property(p2) Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1)
*/
@Test
- public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance2LevelProperty()
- throws Exception {
+ public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance2LevelProperty() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
- basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
- UserRoleEnum.DESIGNER, true);
+ vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
- AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
- true);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
// verify property
PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
@@ -934,70 +735,49 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update VF property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedIntegerValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
/**
- * update property(p3)
- * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1)
+ * update property(p3) Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1)
*/
@Test
- public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance3LevelProperty()
- throws Exception {
+ public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance3LevelProperty() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
- vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
- Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
- .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
- UserRoleEnum.DESIGNER, true);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils.addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1, UserRoleEnum.DESIGNER, true);
String propNameToUpdate = propDetailsToUpdate.left().value().getName();
String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
- AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
- true);
+ AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
// verify property
PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
newProp.setName(newStringPropName);
@@ -1009,64 +789,48 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
// update VF property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
- .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedBooleanValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
/**
- * update property p5'
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1) CP(inst on VF) (p5) CP(inst) (p5')
+ * update property p5' Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1) CP(inst on VF) (p5) CP(inst) (p5')
*/
@Test
public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfService() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// expectedPropertyList =
// PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
// expectedPropertyList);
// four resource
- Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
- NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
cpStringProperty.setName("Different Name");
cpStringProperty.setPropertyDefaultValue("Different value from default");
@@ -1074,36 +838,26 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
// create VF + add RI
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
// service = AtomicOperationUtils.getServiceObject(service,
// UserRoleEnum.DESIGNER);
@@ -1114,49 +868,37 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
String propTypeToUpdate = "string";
// update CP property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
- service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedStringValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
List<String> path = expectedUpdatePropDetails.getPath();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
/**
- * update property p5
- * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
- * (p1) CP(inst on VF) (p5) CP(inst) (p5')
+ * update property p5 Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2) (p1) CP(inst on VF) (p5) CP(inst) (p5')
*/
@Test
public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfVf() throws Exception {
basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
- vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
- ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
- vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
- LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
+ vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
+ vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(), LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
// expectedPropertyList =
// PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
// expectedPropertyList);
// four resource
- Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
- NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
cpStringProperty.setName("Different Name");
cpStringProperty.setPropertyDefaultValue("Different value from default");
@@ -1164,36 +906,26 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
// create VF + add RI
cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
- vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
- .value();
- ComponentInstance componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
- .value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ ComponentInstance componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left().value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
// Service
expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
actualPropertyList = new ArrayList<ComponentInstanceProperty>();
- expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
- null);
+ expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList, null);
expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
- .value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
- componentInstDetails = AtomicOperationUtils
- .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
+ componentInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
- PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
- expectedPropertyList);
+ PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service, expectedPropertyList);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
@@ -1203,27 +935,61 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
String propTypeToUpdate = "string";
// update CP property
- ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
- service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
+ ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
expectedUpdatePropDetails.setValue(updatedStringValue);
String propUniqeId = expectedUpdatePropDetails.getUniqueId();
List<String> path = expectedUpdatePropDetails.getPath();
- RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
- .updatePropertyValueOnResourceInstance(service, componentInstDetails,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
- assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
- updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, componentInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS, updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
actualPropertyList = new ArrayList<>();
actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
- ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
- .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
- assertTrue("property was not updated propely",
- PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
+ ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils.getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
+ assertTrue("property was not updated propely", PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
}
+
+ @Test // US833308
+ public void serviceWithVLINetworkRoleProperty() throws Exception {
+
+ String propName = PropertyNames.NETWORK_ROLE.getPropertyName();
+ String propType = "string";
+ String propValue = "myValue";
+
+ // create service
+ Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+ Resource vl = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "ExtVL", "1.0");
+ // add ExtVL instance
+ ComponentInstance vlInstDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(vl, service, UserRoleEnum.DESIGNER, true).left().value();
+ // fetch updated service
+ service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
+
+ // update ExtVL network_role property value
+ ComponentInstanceProperty propDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(service, vlInstDetails, propName, propType);
+ propDetails.setValue(propValue);
+ RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, vlInstDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), propDetails);
+ assertTrue("expected updatePropertyValueOnResourceInstance response code: " + HttpStatus.SC_OK, updatePropertyValueOnResourceInstance.getErrorCode() == HttpStatus.SC_OK);
+
+ service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
+ // expected property value after update has service systemName prefixed to user defined value.
+ ComponentInstanceProperty updatedPropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(service, vlInstDetails, propName, propType);
+ String generatedValue = service.getSystemName() + "." + propValue;
+ assertTrue("property value was updated properly", updatedPropDetails.getValue().equals(generatedValue));
+
+ // update service name
+ ServiceReqDetails updatedServiceDetails = new ServiceReqDetails(service);
+ String newServiceName = "ciServiceWithVLIPropertyValueTest";
+ updatedServiceDetails.setName(newServiceName);
+ RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ service = ResponseParser.convertServiceResponseToJavaObject(updateServiceResponse.getResponse());
+ // expected property value after update has service (updated) systemName prefixed to user defined value.
+ generatedValue = newServiceName + "." + propValue;
+ updatedPropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(service, vlInstDetails, propName, propType);
+ assertTrue("property value was updated properly", updatedPropDetails.getValue().equalsIgnoreCase(generatedValue));
+ }
+
// -------------------Methods--------------------------
public static PropertyDataDefinition convertToPropertyDataDefinitionObject(PropertyReqDetails prop) {
@@ -1235,11 +1001,8 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
return propDataDef;
}
- protected Resource createResourceWithPropertyDerivedFromOtherResource(PropertyReqDetails propertyReqDetails,
- LifeCycleStatesEnum state, Resource derivedFromResource) throws Exception {
- Resource resource = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
- derivedFromResource, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left()
- .value();
+ protected Resource createResourceWithPropertyDerivedFromOtherResource(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state, Resource derivedFromResource) throws Exception {
+ Resource resource = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, derivedFromResource, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
if (propertyReqDetails != null) {
AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
}
@@ -1248,11 +1011,8 @@ public class ComponentInstancePropertyTest extends ComponentBaseTest {
// return resource;
}
- protected Resource createResourceWithProperty(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state)
- throws Exception {
- Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
- NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
- .value();
+ protected Resource createResourceWithProperty(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state) throws Exception {
+ Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left().value();
if (propertyReqDetails != null) {
AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
index e1c4c18270..7ecdcf457f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/ComponentProperty.java
@@ -99,8 +99,8 @@ public class ComponentProperty extends ComponentBaseTest {
{ "boolean", "[true,,false]", "[true,false]" }, { "boolean", "[true,false,]", "[true,false]" },
{ "boolean", "[,true,false]", "[true,false]" }, { "boolean", null, null },
// DE199713 - Default value for property type Boolean should
- // support also the following values: true, t , one , 1 ,
- // false, f , off , 0
+ // support also the following values: "true", "t" , "on" , "1" ,
+ // "false", "f" , "off" , "0"
{ "boolean", "[on,off]", "[true,false]" }, { "boolean", "[ON,OFF]", "[true,false]" },
{ "boolean", "[On,Off]", "[true,false]" }, { "boolean", "[yes,no]", "[true,false]" },
{ "boolean", "[YES,NO]", "[true,false]" }, { "boolean", "[Yes,No]", "[true,false]" },
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
index d1302c8d8c..6a5aeec5c9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import org.junit.Rule;
@@ -45,6 +46,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.preRequisites.SimpleOneRsrcOneServiceTest;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
@@ -55,6 +57,8 @@ import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import com.google.gson.Gson;
+
public class PropertyApisTest extends SimpleOneRsrcOneServiceTest {
protected static final String RESOURCE_CATEGORY = "Generic/Databases";
@@ -79,10 +83,6 @@ public class PropertyApisTest extends SimpleOneRsrcOneServiceTest {
@BeforeMethod
public void init() throws Exception {
- // //Create user
- // sdncDesignerDetails = createUser("tu1234", "Test", "User",
- // "tu1234@intl.sdc.com", "DESIGNER");
- //
// //Delete resource
//
// resourceDetails = new ResourceReqDetails();
@@ -117,7 +117,7 @@ public class PropertyApisTest extends SimpleOneRsrcOneServiceTest {
// Create property
// System.out.println ("---- Create Property (POST) ----");
- String propertyId = UniqueIdBuilder.buildPropertyUniqueId(getResourceId(resourceDetails), property.getName());
+ String propertyId = UniqueIdBuilder.buildComponentPropertyUniqueId(getResourceId(resourceDetails), property.getName());
PropertyRestUtils.deleteProperty(getResourceId(resourceDetails), propertyId, sdncDesignerDetails);
RestResponse createPropertyResponse = PropertyRestUtils.createProperty(getResourceId(resourceDetails), body,
@@ -194,7 +194,7 @@ public class PropertyApisTest extends SimpleOneRsrcOneServiceTest {
protected String getPropertyId(ResourceReqDetails resource, PropertyReqDetails property) {
// return
// resource.getResourceName().toLowerCase()+".0.1."+property.getPropertyName();
- return UniqueIdBuilder.buildPropertyUniqueId(resource.getUniqueId(), property.getName());
+ return UniqueIdBuilder.buildComponentPropertyUniqueId(resource.getUniqueId(), property.getName());
}
protected String getResourceId(ResourceReqDetails resource) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
index 85dfe4e13a..0ec6b00fdc 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java
@@ -25,6 +25,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.common.util.SerializationUtils;
+import org.testng.annotations.Test;
import fj.data.Either;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
index d05dd1039a..4847491759 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java
@@ -91,7 +91,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest {
designerUser.getUserId(), ResourceTypeEnum.CP.toString()); // resourceType
// =
// VFC
- resourceDetailsCap = ElementFactory.getDefaultResourceByType("MyCompute", NormativeTypesEnum.COMPUTE,
+ resourceDetailsCap = ElementFactory.getDefaultResourceByType("ciMyCompute", NormativeTypesEnum.COMPUTE,
ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, designerUser.getUserId(), ResourceTypeEnum.CP.toString()); // resourceType
// =
// VFC
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
index a9ed54ef15..f4e51b14d9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.ci.tests.execute.resource;
import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -30,13 +31,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.validation.constraints.AssertTrue;
+
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
@@ -46,6 +52,7 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
@@ -58,6 +65,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.DbUtils;
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.Convertor;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
@@ -70,6 +78,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
@@ -884,7 +893,7 @@ public class CreateResourceApiTest extends ComponentBaseTest {
ResourceReqDetails resourceDetails = createRandomResource();
- // set null in userId header
+ // set null in UserId header
sdncModifierDetails.setUserId(null);
// create resource
@@ -1177,6 +1186,19 @@ public class CreateResourceApiTest extends ComponentBaseTest {
// init ADMIN user
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+
+ // // set resource details
+ // String resourceName = "CISCO4";
+ // String description = "description";
+ // ArrayList<String> resourceTags = new ArrayList<String>();
+ // resourceTags.add(resourceName);
+ // resourceTags.add("tag2");
+ // String category = ResourceServiceCategoriesEnum.VOIP.getValue();
+ // ArrayList<String> derivedFrom = new ArrayList<String>();
+ // derivedFrom.add(NormativeTypesEnum.ROOT.getNormativeName());
+ // String vendorName = "Oracle";
+ // String vendorRelease = "1.5";
+ // String icon = "myICON";
ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
resourceDetails.setTags(Arrays.asList(resourceDetails.getName(), "tag2"));
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CustomizationUUIDTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CustomizationUUIDTest.java
new file mode 100644
index 0000000000..cd87ea5265
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CustomizationUUIDTest.java
@@ -0,0 +1,433 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.resource;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+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.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.Test;
+
+public class CustomizationUUIDTest extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public CustomizationUUIDTest() {
+ super(name, CustomizationUUIDTest.class.getName());
+ }
+
+ @Test(enabled = true)
+ public void resourceCustomUUIDTestUpdateMeta() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource in checkin status
+ Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // create service
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // create instance 1
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci1.getCustomizationUUID());
+ String ci1CustUUID = ci1.getCustomizationUUID();
+
+ // get service with 1 instance
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+
+ // change name of instance 1 and check custom UUID
+ String newCi1Name = "newCi1Name";
+ ci1.setName(newCi1Name);
+ RestResponse updateComponentInstance = ComponentInstanceRestUtils.updateComponentInstance(ci1, sdncModifierDetails, service.getUniqueId(), ComponentTypeEnum.SERVICE);
+ ResourceRestUtils.checkSuccess(updateComponentInstance);
+ ComponentInstance ci1AfterChange = ResponseParser.parseToObjectUsingMapper(updateComponentInstance.getResponse(), ComponentInstance.class);
+
+ // must be different
+ assertFalse(ci1.getCustomizationUUID().equals(ci1AfterChange.getCustomizationUUID()));
+
+ // change position of instance 1 and check UUID
+ ci1.setPosX("151");
+ ci1.setPosY("20");
+ updateComponentInstance = ComponentInstanceRestUtils.updateComponentInstance(ci1, sdncModifierDetails, service.getUniqueId(), ComponentTypeEnum.SERVICE);
+ ResourceRestUtils.checkSuccess(updateComponentInstance);
+ ci1AfterChange = ResponseParser.parseToObjectUsingMapper(updateComponentInstance.getResponse(), ComponentInstance.class);
+ // must be same
+ assertTrue(ci1.getCustomizationUUID().equals(ci1AfterChange.getCustomizationUUID()));
+ }
+
+ @Test(enabled = true)
+ public void resourceCustomUUIDPropertyTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource
+ Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // 2 create service
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // create instance
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci1.getCustomizationUUID());
+ String ci1CustUUID = ci1.getCustomizationUUID();
+
+ // get service with 1 instance
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+
+ // instance property values
+ Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = service.getComponentInstancesProperties();
+ assertNotNull(componentInstancesProperties);
+ List<ComponentInstanceProperty> listProps = componentInstancesProperties.get(ci1.getUniqueId());
+ assertNotNull(listProps);
+
+ ComponentInstanceProperty updatedInstanceProperty = null;
+ for (ComponentInstanceProperty cip : listProps) {
+ if (cip.getType().equals("string")) {
+ updatedInstanceProperty = cip;
+ break;
+ }
+ }
+ assertNotNull(updatedInstanceProperty);
+ updatedInstanceProperty.setValue("newValue");
+
+ RestResponse updatePropRes = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, ci1, sdncModifierDetails, updatedInstanceProperty);
+ BaseRestUtils.checkSuccess(updatePropRes);
+
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ ComponentInstance ciAfterUpdateProp = componentInstances.get(0);
+
+ assertFalse(ci1.getCustomizationUUID().equals(ciAfterUpdateProp.getCustomizationUUID()));
+ }
+
+ @Test(enabled = true)
+ public void resourceCustomUUIDChangeVersionTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource in checkin status
+ Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // create service
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // create instance 1
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci1.getCustomizationUUID());
+ String ci1CustUUID = ci1.getCustomizationUUID();
+
+ // create 0.2 version of resource( check out and check in)
+ RestResponse checkoutState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKOUT);
+ BaseRestUtils.checkSuccess(checkoutState);
+ resource1 = ResponseParser.parseToObjectUsingMapper(checkoutState.getResponse(), Resource.class);
+ assertNotNull(resource1);
+
+ checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // change version of instance
+ RestResponse changeComponentInstanceVersion = ComponentInstanceRestUtils.changeComponentInstanceVersion(service, ci1, resource1, sdncModifierDetails);
+ BaseRestUtils.checkSuccess(changeComponentInstanceVersion);
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+ assertFalse(ci1CustUUID.equals(componentInstances.get(0).getCustomizationUUID()));
+
+ }
+
+ @Test(enabled = true)
+ public void resourceCustomUUIDChangeArtifactsTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource in checkin status
+ Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // create service
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // create instance 1
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci1.getCustomizationUUID());
+ String lastUUID = ci1.getCustomizationUUID();
+
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(1, componentInstances.size());
+ ComponentInstance ci = componentInstances.get(0);
+ Map<String, ArtifactDefinition> deploymentArtifacts = ci.getDeploymentArtifacts();
+ assertNotNull(deploymentArtifacts);
+ // find artifact for update
+ ArtifactDefinition artifactForUpdate = null;
+ for (ArtifactDefinition ad : deploymentArtifacts.values()) {
+ if (ad.getArtifactType().equals("HEAT_ENV")) {
+ artifactForUpdate = ad;
+ break;
+ }
+ }
+
+ assertNotNull(artifactForUpdate);
+ // update heat env on instance
+ RestResponse updateArtifact = ArtifactRestUtils.updateDeploymentArtifactToRI(artifactForUpdate, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
+ BaseRestUtils.checkSuccess(updateArtifact);
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
+ lastUUID = componentInstances.get(0).getCustomizationUUID();
+
+ // add artifact to instance
+ ArtifactReqDetails artifactDetails = ElementFactory.getDefaultArtifact();
+ RestResponse addArtifactToResourceInstance = ArtifactRestUtils.addArtifactToResourceInstance(artifactDetails, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
+ BaseRestUtils.checkSuccess(addArtifactToResourceInstance);
+ ArtifactDefinition artifactDef = ResponseParser.parseToObjectUsingMapper(addArtifactToResourceInstance.getResponse(), ArtifactDefinition.class);
+ assertNotNull(artifactDef);
+
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+
+ componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
+ lastUUID = componentInstances.get(0).getCustomizationUUID();
+
+ //update artifact
+ //not supported now!!!!!
+// artifactDef.setDescription("new description");
+// RestResponse updateArtifactRes = ArtifactRestUtils.updateArtifactToResourceInstance(artifactDef, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
+// BaseRestUtils.checkSuccess(updateArtifactRes);
+// artifactDef = ResponseParser.parseToObjectUsingMapper(addArtifactToResourceInstance.getResponse(), ArtifactDefinition.class);
+// assertNotNull(artifactDef);
+//
+// getService = ServiceRestUtils.getService(service.getUniqueId());
+// BaseRestUtils.checkSuccess(getService);
+// service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+//
+// componentInstances = service.getComponentInstances();
+// assertNotNull(componentInstances);
+// assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
+// lastUUID = componentInstances.get(0).getCustomizationUUID();
+//
+// //delete artifact
+// RestResponse deleteArtifactRes = ArtifactRestUtils.deleteArtifactFromResourceInstance (artifactDef, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
+// BaseRestUtils.checkSuccess(deleteArtifactRes);
+// getService = ServiceRestUtils.getService(service.getUniqueId());
+// BaseRestUtils.checkSuccess(getService);
+// service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+//
+// componentInstances = service.getComponentInstances();
+// assertNotNull(componentInstances);
+// assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
+ }
+
+ @Test(enabled = true)
+ public void resourceCustomUUIDRelationTest() throws Exception {
+ User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ // create resource in checkin status
+ Resource resource = createVfFromCSAR(sdncModifierDetails, "csar_1");
+
+ RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
+ BaseRestUtils.checkSuccess(checkinState);
+
+ // create service
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
+ RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
+ ResourceRestUtils.checkCreateResponse(createServiceResponse);
+ Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);
+
+ // create instance 1
+ ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource);
+ RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci1.getCustomizationUUID());
+ String ci1LastUUID = ci1.getCustomizationUUID();
+
+ // create instance 2
+ createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
+ ResourceRestUtils.checkCreateResponse(createComponentInstance);
+
+ ComponentInstance ci2 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
+ assertNotNull(ci2.getCustomizationUUID());
+ String ci2LastUUID = ci2.getCustomizationUUID();
+
+ // get service with 2 instances
+ RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ List<ComponentInstance> componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+ assertEquals(2, componentInstances.size());
+
+ ComponentInstance ciFrom = componentInstances.get(0);
+ ComponentInstance ciTo = componentInstances.get(1);
+
+ Map<String, List<RequirementDefinition>> requirements = ciFrom.getRequirements();
+ assertNotNull(requirements);
+ List<RequirementDefinition> listReq = requirements.get("tosca.capabilities.network.Bindable");
+ assertNotNull(listReq);
+ RequirementDefinition req = listReq.get(0);
+
+
+ Map<String, List<CapabilityDefinition>> capabilities = ciTo.getCapabilities();
+ assertNotNull(capabilities);
+ List<CapabilityDefinition> listCap = capabilities.get("tosca.capabilities.network.Bindable");
+ assertNotNull(listCap);
+ CapabilityDefinition cap = listCap.get(0);
+
+ List<CapabilityDefinition> capList = new ArrayList<>();
+ capList.add(cap);
+ List<RequirementDefinition> reqList = new ArrayList<>();
+ reqList.add(req);
+
+ RequirementCapabilityRelDef relation = ElementFactory.getReqCapRelation(ciFrom.getUniqueId(),ciTo.getUniqueId(), req.getOwnerId(), cap.getOwnerId(), cap.getType(), req.getName(), capList, reqList );
+
+ RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(relation, sdncModifierDetails,service.getUniqueId(), ComponentTypeEnum.SERVICE);
+ ResourceRestUtils.checkSuccess(associateInstances);
+
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+
+ for ( ComponentInstance ci : componentInstances){
+ if ( ci.getUniqueId().equals(ci1.getUniqueId()) ){
+ assertFalse( ci1LastUUID.equals(ci.getCustomizationUUID()) );
+ ci1LastUUID = ci.getCustomizationUUID();
+ }else{
+ assertFalse( ci2LastUUID.equals(ci.getCustomizationUUID()) );
+ ci2LastUUID = ci.getCustomizationUUID();
+ }
+ }
+ associateInstances = ComponentInstanceRestUtils.dissociateInstances(relation, sdncModifierDetails,service.getUniqueId(), ComponentTypeEnum.SERVICE);
+ ResourceRestUtils.checkSuccess(associateInstances);
+
+ getService = ServiceRestUtils.getService(service.getUniqueId());
+ BaseRestUtils.checkSuccess(getService);
+ service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
+ componentInstances = service.getComponentInstances();
+ assertNotNull(componentInstances);
+
+ for ( ComponentInstance ci : componentInstances){
+ if ( ci.getUniqueId().equals(ci1.getUniqueId()) ){
+ assertFalse( ci1LastUUID.equals(ci.getCustomizationUUID()) );
+ }else{
+ assertFalse( ci2LastUUID.equals(ci.getCustomizationUUID()) );
+ }
+ }
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
index a3372098a0..25c3242d2c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
@@ -37,6 +38,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
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.DbUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
index ccf6142538..cdb7dc0304 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java
@@ -30,6 +30,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.model.User;
@@ -44,6 +45,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.imports.ImportGenericResourceCITest;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.slf4j.Logger;
@@ -119,7 +121,7 @@ public class GetResourceNotAbstractApiTest extends ComponentBaseTest {
toFind.add(portUid);
boolean removeAll = toFind.removeAll(actualNotAbstarctResourcesUniqueIdArray);
- logger.debug("Cannot find resources {}", toFind.toString());
+ logger.debug("Cannot find resources {}",toFind.toString());
for (String expectedResource : expectedNotAbstractResourcesUniqueIdArray) {
if (false == actualNotAbstarctResourcesUniqueIdArray.contains(expectedResource)) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
index eac33242ed..feb7b6f42e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java
@@ -33,6 +33,7 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
@@ -108,7 +109,11 @@ public class ResourceApiTest extends ComponentBaseTest {
resourceDetails.setIcon(resourceRespJavaObject.getIcon());
resourceDetails.setName(resourceRespJavaObject.getName());
resourceDetails.setDerivedFrom(resourceRespJavaObject.getDerivedFrom());
-
+
+ // ResourceReqDetails resourceDetails = new
+ // ResourceReqDetails(resourceName, description, resourceTags, category,
+ // derivedFrom, vendorName, vendorRelease, contactId, null);
+
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
HttpRequest http = new HttpRequest();
@@ -211,7 +216,8 @@ public class ResourceApiTest extends ComponentBaseTest {
httpget.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
- httpget.addHeader(HttpHeaderEnum.USER_ID.getValue(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER).getUserId());
+ httpget.addHeader(HttpHeaderEnum.USER_ID.getValue(),
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER).getUserId());
// System.out.println("Executing request " +
// httpget.getRequestLine());
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
index de83385029..3002523ccb 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/SimultaneousApiTest.java
@@ -84,6 +84,28 @@ public class SimultaneousApiTest extends ComponentBaseTest {
}
+ // public void run_() {
+ // System.out.println("**** Thread started " + threadIndex);
+ // try {
+ // UserUtils userUtils = new UserUtils();
+ // User userDetails = new User(userFirstName, userLastName,
+ // httpCspUserId, email, role , 0L);
+ // RestResponse response =
+ // userUtils.createUserTowardsCatalogBe(userDetails,
+ // userUtils.getUserDetailesAdmin());
+ // System.out.println("**** Thread " + threadIndex + " create resource
+ // status " + response.getErrorCode() + " response " +
+ // response.getResponse());
+ //// assertEquals("**** create resource: " +
+ // createResource.getErrorCode() + " thread " + threadIndex, 201,
+ // status);
+ // } catch (Exception e) {
+ // System.out.println("**** Thread " + threadIndex + " exception " + e);
+ // }
+ // countDownLatch.countDown();
+ // System.out.println("**** Thread finished " + threadIndex);
+ //
+ // }
}
@Test
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
index b61489d12d..da5b469a4f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java
@@ -40,6 +40,7 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
@@ -228,7 +229,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
}
public char[] getTagInValidFormatChars() throws Exception {
- // Tag format is the same as defined for Resource Name :
+ // Tag format is the same as defined for "Resource Name" :
// Allowed characters: Alphanumeric (a-zA-Z0-9), space (' '), underscore
// ('_'), dash ('-'), dot ('.')
char[] notValidCharsArray = new char[30];
@@ -468,6 +469,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
AssertJUnit.assertTrue(!resourceDetails.getCost().equals(updatedResourceRespJavaObject.getCost()));
AssertJUnit.assertTrue(!resourceDetails.getLicenseType().equals(updatedResourceRespJavaObject.getLicenseType()));
AssertJUnit.assertTrue(!resourceDetails.getUUID().equals(updatedResourceRespJavaObject.getUUID()));
+
}
protected void parseResponseAndValidate(ResourceReqDetails ResourceDetails, RestResponse restResponse) throws Exception {
@@ -591,6 +593,52 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
}
+ // @Test
+ // public void UpdateResourceModifierNotOwnerStateTest() throws Exception {
+ //
+ //
+ // RestResponse restResponse = createResource(sdncModifierDetails,
+ // resourceDetails);
+ // String resourceName = resourceDetails.getName();
+ //
+ // // new user parameters
+ // String userFirstName = "Kot";
+ // String userLastName = "Matroskin";
+ // String role = "ADMIN";
+ // User sdncUserDetails = new User(userFirstName, userLastName,
+ // httpCspUserId, email, role,null);
+ // RestResponse deleteUserResponse = userUtils.deleteUser(sdncUserDetails,
+ // ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
+ //
+ // RestResponse createUserResponse = UserUtils.createUser(sdncUserDetails,
+ // ElementFactory.getDefaultUser(UserRoleEnum.ADMIN));
+ //
+ // User updatedSdncModifierDetails = new User(userFirstName, userLastName,
+ // httpCspUserId, email,role,null);
+ // ResourceReqDetails updatedResourceDetails =
+ // defineUpdatedResourse(resourceName);
+ // RestResponse updatedRestResponse =
+ // ResourceRestUtils.updateResource(updatedResourceDetails,
+ // updatedSdncModifierDetails, resourceDetails.getUniqueId(), "");
+ //
+ // // validate response
+ // assertNotNull("check response object is not null after update resource",
+ // updatedRestResponse);
+ // assertNotNull("check error code exists in response after update
+ // resource", updatedRestResponse.getErrorCode());
+ // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(),
+ // Empty_List, updatedRestResponse.getResponse());
+ //
+ // RestResponse getRestResponse =
+ // ResourceRestUtils.getResource(sdncModifierDetails,
+ // resourceDetails.getUniqueId());
+ // assertNotNull("check response object is not null after update resource",
+ // getRestResponse);
+ // parseResponseAndValidate(resourceDetails, getRestResponse);
+ //
+ //
+ // }
+
@Test
public void UpdateResourceNameSensitiveTest() throws Exception {
User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
@@ -962,7 +1010,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResourceIcon_resourceVersion_11() throws Exception {
- // Can be changed only if major version is 0.
+ // Can be changed only if major version is "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1022,7 +1070,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResourceVandorName_resourceVersion_11() throws Exception {
- // Can be changed only if the major resource version is 0.
+ // Can be changed only if the major resource version is "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1084,7 +1132,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResourceName_resourceVersion_11() throws Exception {
- // Can be changed only if the major resource version is 0.
+ // Can be changed only if the major resource version is "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1139,7 +1187,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResourceTag_resourceVersion_11() throws Exception {
- // Tag Can be updated when major version is 0.
+ // Tag Can be updated when major version is "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1199,7 +1247,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
public void UpdateAllowedParames_resourceVersion_11() throws Exception {
// Tag, contactId, vendorRelease,tags And description - Can be also
- // updated when major version is NOT 0.
+ // updated when major version is NOT "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1259,7 +1307,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResourceDerivedFrom_resourceVersion_11() throws Exception {
- // DerivedFrom parameter - Can be updated when major version is 0.
+ // DerivedFrom parameter - Can be updated when major version is "0".
User adminModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
String resourceBaseVersion = "0.1";
@@ -1302,7 +1350,7 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
RestResponse updatedRestResponse = ResourceRestUtils.updateResourceMetadata(updatedResourceDetails, sdncModifierDetails, resourceDetails.getUniqueId(), "");
// validate response
List<String> resourceList = new ArrayList<String>();
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_DERIVED_FROM_CANNOT_BE_CHANGED.name(), resourceList, updatedRestResponse.getResponse());
+ ResourceRestUtils.checkSuccess(updatedRestResponse);
// get resource with original name. original metadata should be returned
RestResponse getRestResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceDetails.getUniqueId());
@@ -1540,26 +1588,26 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest {
@Test
public void UpdateResource_contactIdValidation() throws Exception { // [a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]{1}
- // (6
- // characters
- // now,
- // may
- // be
- // expanded
- // up
- // to
- // 8
- // characters
- // in
- // the
- // future).
- // Convert
- // Upper
- // case
- // character
- // to
- // lower
- // case
+ // (6
+ // characters
+ // now,
+ // may
+ // be
+ // expanded
+ // up
+ // to
+ // 8
+ // characters
+ // in
+ // the
+ // future).
+ // Convert
+ // Upper
+ // case
+ // character
+ // to
+ // lower
+ // case
RestResponse updatedRestResponse;
RestResponse restResponse = createResource(sdncModifierDetails, resourceDetails);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
index 895390f764..59050103ca 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java
@@ -57,6 +57,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.google.gson.Gson;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
index 37e7539fd9..8a17c3c115 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.ci.tests.execute.resource;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
+import java.io.IOException;
import java.util.List;
import org.json.simple.JSONArray;
@@ -31,6 +32,8 @@ import org.json.simple.JSONValue;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
@@ -43,6 +46,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest;
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.rest.LifecycleRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
index c8a20cf44a..3d338534d1 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java
@@ -32,6 +32,7 @@ import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
@@ -44,6 +45,7 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -59,6 +61,8 @@ import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import fj.data.Either;
+
public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest {
protected ResourceReqDetails resourceDetails;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
index 56cfeb54ea..8e95a6d02c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.ci.tests.execute.service;
+import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
@@ -36,6 +37,7 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -47,6 +49,7 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
@@ -60,6 +63,7 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
index 760d002856..3460cd6e04 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.cassandra.transport.Event.SchemaChange.Target;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.dao.api.ActionStatus;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
index b84728a06c..5642ce4745 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java
@@ -23,16 +23,21 @@ package org.openecomp.sdc.ci.tests.execute.service;
import static org.testng.AssertJUnit.assertTrue;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.http.HttpStatus;
+import org.apache.log4j.lf5.util.ResourceUtils;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
@@ -54,12 +59,15 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import fj.data.Either;
@@ -81,7 +89,8 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
// in case tests fail, run this method as test to create mapping in ES
public void updateElasticSearchMapping() throws IOException {
- Either<String, Exception> fileContentUTF8 = FileUtils.getFileContentUTF8("src\\test\\resources\\CI\\other\\mapping.json");
+ Either<String, Exception> fileContentUTF8 = FileUtils
+ .getFileContentUTF8("src\\test\\resources\\CI\\other\\mapping.json");
AssertJUnit.assertTrue(fileContentUTF8.isLeft());
final String ES_TEMPLATE_URL = "http://%s:%s/_template/audit_template";
@@ -104,7 +113,8 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
public void testServiceAuditCertifiedVersion() throws Exception {
ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(), versionZeroTwoIDWrapper = new Wrapper<String>();
+ Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(),
+ versionZeroTwoIDWrapper = new Wrapper<String>();
createBasicServiceForAudit(versionZeroOneIDWrapper, versionZeroTwoIDWrapper, serviceDetails, true);
// First Certification
@@ -129,14 +139,35 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
// updates(tosca) + certification request + certification start +
// certification success
// + 3 A&AI(ArtifactDelete, ArtifactUpload, ArtifactUpdate)
- AssertJUnit.assertTrue("expected: 17, actual: " + element.getAsJsonArray().size(), element.getAsJsonArray().size() == 17);
+ List<String> actions = new ArrayList<>();
+ JsonArray jsonArray = element.getAsJsonArray();
+ for( int i =0 ; i < jsonArray.size(); i++){
+ actions.add(jsonArray.get(i).getAsJsonObject().get(AuditingFieldsKeysEnum.AUDIT_ACTION.getDisplayName()).getAsString());
+ }
+ long checkinCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.CHECKIN_RESOURCE.getName())).count();
+ assertTrue(checkinCount == 5);
+
+ long checkOutCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.CHECKOUT_RESOURCE.getName())).count();
+ assertTrue(checkOutCount == 4);
+
+ long certificationRequestCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.CERTIFICATION_REQUEST_RESOURCE.getName())).count();
+ assertTrue(certificationRequestCount == 1);
+
+ long certificationStartCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.START_CERTIFICATION_RESOURCE.getName())).count();
+ assertTrue(certificationStartCount == 1);
+
+ long certificationSuccessCount = actions.stream().filter( e -> e.equals(AuditingActionEnum.CERTIFICATION_SUCCESS_RESOURCE.getName())).count();
+ assertTrue(certificationSuccessCount == 1);
+
}
protected void certifyResource(ResourceReqDetails defaultResource) throws IOException {
- RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
+ LifeCycleStatesEnum.CERTIFICATIONREQUEST);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
- response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser, LifeCycleStatesEnum.STARTCERTIFICATION);
+ response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser,
+ LifeCycleStatesEnum.STARTCERTIFICATION);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
response = LifecycleRestUtils.changeResourceState(defaultResource, sdncTesterUser, LifeCycleStatesEnum.CERTIFY);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
@@ -148,7 +179,8 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
put(Constants.USER_ID_HEADER, UserRoleEnum.ADMIN.getUserId());
}
};
- String url = String.format(Urls.GET_COMPONENT_AUDIT_RECORDS, config.getCatalogBeHost(), config.getCatalogBePort(), componentType, componentId);
+ String url = String.format(Urls.GET_COMPONENT_AUDIT_RECORDS, config.getCatalogBeHost(),
+ config.getCatalogBePort(), componentType, componentId);
RestResponse httpSendGet = new HttpRequest().httpSendGet(url, headers);
AssertJUnit.assertTrue(httpSendGet.getErrorCode() == HttpStatus.SC_OK);
@@ -157,7 +189,9 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
return element;
}
- protected void createBasicServiceForAudit(Wrapper<String> versionZeroOneIDWrapper, Wrapper<String> versionZeroTwoIDWrapper, ServiceReqDetails serviceDetails, Boolean withResInst) throws Exception {
+ protected void createBasicServiceForAudit(Wrapper<String> versionZeroOneIDWrapper,
+ Wrapper<String> versionZeroTwoIDWrapper, ServiceReqDetails serviceDetails, Boolean withResInst)
+ throws Exception {
User designerUser = sdncDesignerUser;
@@ -166,13 +200,17 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
versionZeroOneIDWrapper.setInnerElement(serviceDetails.getUniqueId());
if (withResInst) {
- Resource resourceObj = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceObj, UserRoleEnum.DESIGNER, true, true);
- AtomicOperationUtils.changeComponentState(resourceObj, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
+ Resource resourceObj = AtomicOperationUtils
+ .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceObj, UserRoleEnum.DESIGNER, true,
+ true);
+ AtomicOperationUtils.changeComponentState(resourceObj, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
+ true);
ResourceReqDetails resource = new ResourceReqDetails(resourceObj);
ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getDefaultComponentInstance();
resourceInstanceReqDetails.setComponentUid(resource.getUniqueId());
- ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, sdncDesignerUser, serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
+ ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, sdncDesignerUser,
+ serviceDetails.getUniqueId(), ComponentTypeEnum.SERVICE);
// ServiceUtils.createCertResourceWithDeploymentArt(serviceDetails,
// "myResource");
@@ -200,14 +238,16 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
}
protected void increaseServiceVersion(ServiceReqDetails serviceDetails, String excpectedVersion) throws Exception {
- RestResponse response = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerUser, LifeCycleStatesEnum.CHECKOUT);
+ RestResponse response = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerUser,
+ LifeCycleStatesEnum.CHECKOUT);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
AssertJUnit.assertTrue(serviceDetails.getVersion().equals(excpectedVersion));
response = LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerUser, LifeCycleStatesEnum.CHECKIN);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
}
- protected void createBasicResourceForAudit(Wrapper<String> versionOnePointTwoIDWrapper, ResourceReqDetails defaultResource) throws Exception {
+ protected void createBasicResourceForAudit(Wrapper<String> versionOnePointTwoIDWrapper,
+ ResourceReqDetails defaultResource) throws Exception {
RestResponse response = ResourceRestUtils.createResource(defaultResource, sdncDesignerUser);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_CREATED);
@@ -218,11 +258,15 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
// sdncDesignerUser, defaultResource.getVersion(), artifactDef);
// assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
- ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
- response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerUser, defaultResource.getUniqueId());
- AssertJUnit.assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(), response.getErrorCode() == 200);
+ ArtifactReqDetails heatArtifactDetails = ElementFactory
+ .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+ response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerUser,
+ defaultResource.getUniqueId());
+ AssertJUnit.assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),
+ response.getErrorCode() == 200);
- response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser, LifeCycleStatesEnum.CHECKIN);
+ response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
+ LifeCycleStatesEnum.CHECKIN);
increaseResourceVersion(defaultResource, "0.2");
@@ -247,11 +291,14 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
}
- protected void increaseResourceVersion(ResourceReqDetails defaultResource, String expectedVersion) throws IOException {
- RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser, LifeCycleStatesEnum.CHECKOUT);
+ protected void increaseResourceVersion(ResourceReqDetails defaultResource, String expectedVersion)
+ throws IOException {
+ RestResponse response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
+ LifeCycleStatesEnum.CHECKOUT);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
AssertJUnit.assertTrue(defaultResource.getVersion().equals(expectedVersion));
- response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser, LifeCycleStatesEnum.CHECKIN);
+ response = LifecycleRestUtils.changeResourceState(defaultResource, sdncDesignerUser,
+ LifeCycleStatesEnum.CHECKIN);
AssertJUnit.assertTrue(response.getErrorCode() == HttpStatus.SC_OK);
}
@@ -259,7 +306,8 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
public void testServiceAuditLastUncertifiedVersion() throws Exception {
ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(), versionZeroTwoIDWrapper = new Wrapper<String>();
+ Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(),
+ versionZeroTwoIDWrapper = new Wrapper<String>();
createBasicServiceForAudit(versionZeroOneIDWrapper, versionZeroTwoIDWrapper, serviceDetails, false);
@@ -273,7 +321,8 @@ public class GetComponentAuditApiTest extends ComponentBaseTest {
public void testServiceAuditFirstUncertifiedVersion() throws Exception {
ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(), versionZeroTwoIDWrapper = new Wrapper<String>();
+ Wrapper<String> versionZeroOneIDWrapper = new Wrapper<String>(),
+ versionZeroTwoIDWrapper = new Wrapper<String>();
createBasicServiceForAudit(versionZeroOneIDWrapper, versionZeroTwoIDWrapper, serviceDetails, false);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
index 19bed4d380..55ecf694ee 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java
@@ -46,6 +46,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
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.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
index b2728ea0da..149febf05c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java
@@ -42,6 +42,7 @@ import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest;
+import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
@@ -49,8 +50,10 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
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.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
@@ -97,12 +100,10 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
createService(serviceDetails_01);
certifyResource(resourceDetailsVFC_01);
certifyResource(resourceDetailsVFC_02);
- RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_01,
- resourceDetailsVFC_01, sdncDesignerDetails);
+ RestResponse createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_01, resourceDetailsVFC_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
reqOwnerId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVFC_02,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForVFDuringSetup(resourceDetailsVF_02, resourceDetailsVFC_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
capOwnerId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);// should
// be
@@ -115,103 +116,80 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
}
private void certifyResource(ResourceReqDetails resource) throws Exception {
- changeResourceLifecycleState(resource, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceLifecycleState(resource, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
changeResourceLifecycleState(resource, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.STARTCERTIFICATION);
changeResourceLifecycleState(resource, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.CERTIFY);
}
- private void changeResourceLifecycleState(ResourceReqDetails resourceDetails, String userUserId,
- LifeCycleStatesEnum lifeCycleStates) throws Exception {
+ private void changeResourceLifecycleState(ResourceReqDetails resourceDetails, String userUserId, LifeCycleStatesEnum lifeCycleStates) throws Exception {
RestResponse response = LifecycleRestUtils.changeResourceState(resourceDetails, userUserId, lifeCycleStates);
LifecycleRestUtils.checkLCS_Response(response);
}
- private void changeServiceLifecycleState(ServiceReqDetails serviceDetails, User user,
- LifeCycleStatesEnum lifeCycleStates) throws Exception {
+ private void changeServiceLifecycleState(ServiceReqDetails serviceDetails, User user, LifeCycleStatesEnum lifeCycleStates) throws Exception {
RestResponse response = LifecycleRestUtils.changeServiceState(serviceDetails, user, lifeCycleStates);
LifecycleRestUtils.checkLCS_Response(response);
}
- private void createVFInstanceFailWithoutChangeState(ActionStatus actionStatus, List<String> variables,
- ResourceReqDetails vfResource, User user, int errorCode) throws Exception {
- RestResponse createVFInstanceSuccessfullyWithoutChangeStateResp = createVFInstance(serviceDetails_01,
- vfResource, user);
+ private void createVFInstanceFailWithoutChangeState(ActionStatus actionStatus, List<String> variables, ResourceReqDetails vfResource, User user, int errorCode) throws Exception {
+ RestResponse createVFInstanceSuccessfullyWithoutChangeStateResp = createVFInstance(serviceDetails_01, vfResource, user);
checkErrorMessage(actionStatus, variables, errorCode, createVFInstanceSuccessfullyWithoutChangeStateResp);
}
- private void createVFInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails vfResource,
- User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
+ private void createVFInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails vfResource, User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, vfResource, user);
checkErrorMessage(actionStatus, variables, errorCode, createVFInstResp);
}
- private void deleteVFInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails vfResource,
- User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
+ private void deleteVFInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails vfResource, User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
RestResponse deleteVFInstResp = deleteVFInstance(vfResource.getUniqueId(), serviceDetails_01, user);
checkErrorMessage(actionStatus, variables, errorCode, deleteVFInstResp);
}
- private void createAtomicResourceInstanceFailWithoutChangeState(ActionStatus actionStatus, List<String> variables,
- ResourceReqDetails atomicResource, User user, int errorCode)
- throws Exception, FileNotFoundException, JSONException {
+ private void createAtomicResourceInstanceFailWithoutChangeState(ActionStatus actionStatus, List<String> variables, ResourceReqDetails atomicResource, User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
RestResponse createAtomicInstResp = createAtomicInstanceForService(serviceDetails_01, atomicResource, user);
checkErrorMessage(actionStatus, variables, errorCode, createAtomicInstResp);
}
- private void createAtomicResourceInstanceFail(ActionStatus actionStatus, List<String> variables,
- ResourceReqDetails atomicResource, User user, int errorCode)
- throws Exception, FileNotFoundException, JSONException {
- RestResponse createAtomicInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, atomicResource,
- user);
+ private void createAtomicResourceInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails atomicResource, User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
+ RestResponse createAtomicInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, atomicResource, user);
checkErrorMessage(actionStatus, variables, errorCode, createAtomicInstResp);
}
- private void deleteAtomicResourceInstanceFail(ActionStatus actionStatus, List<String> variables,
- ResourceReqDetails atomicResource, User user, int errorCode)
- throws Exception, FileNotFoundException, JSONException {
- RestResponse deleteAtomicInstResp = deleteAtomicInstanceForService(atomicResource.getUniqueId(),
- serviceDetails_01, user);
+ private void deleteAtomicResourceInstanceFail(ActionStatus actionStatus, List<String> variables, ResourceReqDetails atomicResource, User user, int errorCode) throws Exception, FileNotFoundException, JSONException {
+ RestResponse deleteAtomicInstResp = deleteAtomicInstanceForService(atomicResource.getUniqueId(), serviceDetails_01, user);
checkErrorMessage(actionStatus, variables, errorCode, deleteAtomicInstResp);
}
- private void checkErrorMessage(ActionStatus actionStatus, List<String> variables, int errorCode,
- RestResponse response) throws Exception {
+ private void checkErrorMessage(ActionStatus actionStatus, List<String> variables, int errorCode, RestResponse response) throws Exception {
log.debug(response.getResponse());
AssertJUnit.assertEquals(errorCode, response.getErrorCode().intValue());
ErrorValidationUtils.checkBodyResponseOnError(actionStatus.name(), variables, response.getResponse());
}
- private RestResponse createCheckedinVFInstance(ServiceReqDetails containerDetails,
- ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
- changeResourceLifecycleState(compInstOriginDetails, compInstOriginDetails.getCreatorUserId(),
- LifeCycleStatesEnum.CHECKIN);
+ private RestResponse createCheckedinVFInstance(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
+ changeResourceLifecycleState(compInstOriginDetails, compInstOriginDetails.getCreatorUserId(), LifeCycleStatesEnum.CHECKIN);
return createVFInstance(containerDetails, compInstOriginDetails, modifier);
}
- private RestResponse createCheckedinAtomicInstanceForService(ServiceReqDetails containerDetails,
- ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
- changeResourceLifecycleState(compInstOriginDetails, compInstOriginDetails.getCreatorUserId(),
- LifeCycleStatesEnum.CHECKIN);
+ private RestResponse createCheckedinAtomicInstanceForService(ServiceReqDetails containerDetails, ResourceReqDetails compInstOriginDetails, User modifier) throws Exception {
+ changeResourceLifecycleState(compInstOriginDetails, compInstOriginDetails.getCreatorUserId(), LifeCycleStatesEnum.CHECKIN);
return createAtomicInstanceForService(containerDetails, compInstOriginDetails, modifier);
}
- private void createVFInstanceAndAtomicResourceInstanceWithoutCheckin(ResourceReqDetails vf,
- ResourceReqDetails atomicResource, User user) throws Exception {
+ private void createVFInstanceAndAtomicResourceInstanceWithoutCheckin(ResourceReqDetails vf, ResourceReqDetails atomicResource, User user) throws Exception {
RestResponse createVFInstance = createVFInstance(serviceDetails_01, vf, user);
ResourceRestUtils.checkCreateResponse(createVFInstance);
RestResponse atomicInstanceForService = createAtomicInstanceForService(serviceDetails_01, atomicResource, user);
ResourceRestUtils.checkCreateResponse(atomicInstanceForService);
}
- private void createVFInstanceAndAtomicResourceInstanceSuccessully(ResourceReqDetails vf,
- ResourceReqDetails atomicResource) throws Exception, IOException {
+ private void createVFInstanceAndAtomicResourceInstanceSuccessully(ResourceReqDetails vf, ResourceReqDetails atomicResource) throws Exception, IOException {
createVFInstanceAndAtomicResourceInstanceSuccessully(vf, atomicResource, sdncDesignerDetails);
}
- private void createVFInstanceAndAtomicResourceInstanceSuccessully(ResourceReqDetails vf,
- ResourceReqDetails atomicResource, User user) throws Exception, IOException {
+ private void createVFInstanceAndAtomicResourceInstanceSuccessully(ResourceReqDetails vf, ResourceReqDetails atomicResource, User user) throws Exception, IOException {
changeResourceLifecycleState(vf, vf.getCreatorUserId(), LifeCycleStatesEnum.CHECKIN);
changeResourceLifecycleState(atomicResource, atomicResource.getCreatorUserId(), LifeCycleStatesEnum.CHECKIN);
createVFInstanceAndAtomicResourceInstanceWithoutCheckin(vf, atomicResource, user);
@@ -219,8 +197,7 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createVFInstanceSuccessfullyTest() throws Exception {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
@@ -229,37 +206,29 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createVFAndAtomicInstanceTest() throws Exception {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_01,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_02,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
getComponentAndValidateRIs(serviceDetails_01, 4, 0);
}
@Test
public void deleteAtomicInstanceTest() throws Exception {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
// 1 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
// 2 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_01,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_01, sdncDesignerDetails);
// 3 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_02,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_02, sdncDesignerDetails);
// 4 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
// To delete
@@ -272,16 +241,14 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void deleteVFInstanceTest() throws Exception {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
// 1 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String compInstId = ResponseParser.getUniqueIdFromResponse(createVFInstResp);
// 2 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ createVFInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
// 3 rel
ResourceRestUtils.checkCreateResponse(createVFInstResp);
// 2 rel
@@ -303,45 +270,37 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String capType = CAPABILITY_TYPE;
String reqName = REQUIREMENT_NAME;
- RestResponse getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ RestResponse getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
ResourceRestUtils.checkSuccess(getResourceResponse);
CapReqDef capReqDef = ResponseParser.parseToObject(getResourceResponse.getResponse(), CapReqDef.class);
List<CapabilityDefinition> capList = capReqDef.getCapabilities().get(capType);
List<RequirementDefinition> reqList = capReqDef.getRequirements().get(capType);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(fromCompInstId, toCompInstId, capType, reqName,
- capList, reqList);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(fromCompInstId, toCompInstId, capType, reqName, capList, reqList);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
- getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
capReqDef = ResponseParser.parseToObject(getResourceResponse.getResponse(), CapReqDef.class);
List<RequirementDefinition> list = capReqDef.getRequirements().get(capType);
AssertJUnit.assertEquals("Check requirement", null, list);
getComponentAndValidateRIs(serviceDetails_01, 2, 1);
dissociateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
- getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
capReqDef = ResponseParser.parseToObject(getResourceResponse.getResponse(), CapReqDef.class);
list = capReqDef.getRequirements().get(capType);
AssertJUnit.assertEquals("Check requirement", 1, list.size());
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
- private RequirementCapabilityRelDef getReqCapRelation(String reqCompInstId, String capCompInstId, String capType,
- String reqName, List<CapabilityDefinition> capList, List<RequirementDefinition> reqList) {
- return ElementFactory.getReqCapRelation(reqCompInstId, capCompInstId, reqOwnerId, capOwnerId, capType, reqName,
- capList, reqList);
+ private RequirementCapabilityRelDef getReqCapRelation(String reqCompInstId, String capCompInstId, String capType, String reqName, List<CapabilityDefinition> capList, List<RequirementDefinition> reqList) {
+ return ElementFactory.getReqCapRelation(reqCompInstId, capCompInstId, reqOwnerId, capOwnerId, capType, reqName, capList, reqList);
}
@Test
public void createResourceInstanceByDifferentDesignerTest() throws Exception {
- createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
- createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
+ createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
+ createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@@ -359,41 +318,33 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createResourceInstanceByTester() throws Exception {
- createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
- createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
+ createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
+ createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@Test
public void createResourceInstanceWithNotASDCUserTest() throws Exception {
sdncDesignerDetails.setUserId("ab0001");
- createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- sdncDesignerDetails, 409);
- createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, sdncDesignerDetails, 409);
+ createVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, sdncDesignerDetails, 409);
+ createAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, sdncDesignerDetails, 409);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@Test
public void createResourceInstanceWithEmptyUserIdTest() throws Exception {
sdncDesignerDetails.setUserId("");
- createVFInstanceFail(ActionStatus.MISSING_INFORMATION, new ArrayList<String>(), resourceDetailsVF_01,
- sdncDesignerDetails, 403);
- createAtomicResourceInstanceFail(ActionStatus.MISSING_INFORMATION, new ArrayList<String>(),
- resourceDetailsCP_01, sdncDesignerDetails, 403);
+ createVFInstanceFail(ActionStatus.MISSING_INFORMATION, new ArrayList<String>(), resourceDetailsVF_01, sdncDesignerDetails, 403);
+ createAtomicResourceInstanceFail(ActionStatus.MISSING_INFORMATION, new ArrayList<String>(), resourceDetailsCP_01, sdncDesignerDetails, 403);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@Test
public void createResourceInstanceWithEmptyServiceUidTest() throws Exception {
serviceDetails_01.setUniqueId("");
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
assertEquals(404, createVFInstResp.getErrorCode().intValue());
- RestResponse createAtomicInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01,
- resourceDetailsCP_01, sdncDesignerDetails);
+ RestResponse createAtomicInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
assertEquals(404, createAtomicInstResp.getErrorCode().intValue());
}
@@ -405,51 +356,40 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
resourceDetailsVF_01.setUniqueId(vfResourceUniqueId);
resourceDetailsCP_01.setUniqueId(atomicResourceUniqueId);
- createVFInstanceFailWithoutChangeState(ActionStatus.RESOURCE_NOT_FOUND,
- new ArrayList<String>(Arrays.asList("")), resourceDetailsVF_01, sdncDesignerDetails, 404);
- createAtomicResourceInstanceFailWithoutChangeState(ActionStatus.RESOURCE_NOT_FOUND,
- new ArrayList<String>(Arrays.asList("")), resourceDetailsCP_01, sdncDesignerDetails, 404);
+ createVFInstanceFailWithoutChangeState(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsVF_01, sdncDesignerDetails, 404);
+ createAtomicResourceInstanceFailWithoutChangeState(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsCP_01, sdncDesignerDetails, 404);
}
@Test
public void createResourceInstanceInServiceNotExistsTest() throws Exception {
serviceDetails_01.setUniqueId("1234");
- createVFInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsVF_01, sdncDesignerDetails, 404);
- createAtomicResourceInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsCP_01, sdncDesignerDetails, 404);
+ createVFInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsVF_01, sdncDesignerDetails, 404);
+ createAtomicResourceInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsCP_01, sdncDesignerDetails, 404);
}
@Test
public void createResourceInstanceInCheckedinServiceTest() throws Exception {
changeServiceLifecycleState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
- createVFInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsVF_01, sdncDesignerDetails, 409);
- createAtomicResourceInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, sdncDesignerDetails, 409);
+ createVFInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, sdncDesignerDetails, 409);
+ createAtomicResourceInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, sdncDesignerDetails, 409);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@Test(enabled = false)
public void createResourceInstance_ResourceInCheckoutStateTest() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, "0.1",
- LifeCycleStatesEnum.CHECKIN);
- RestResponse createVFInstanceWithoutChangeStateResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
+ RestResponse createVFInstanceWithoutChangeStateResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ComponentInstanceRestUtils.checkCreateResponse(createVFInstanceWithoutChangeStateResp);
- RestResponse createAtomicInstWithoutCheangeStateResp = createAtomicInstanceForService(serviceDetails_01,
- resourceDetailsCP_01, sdncDesignerDetails);
+ RestResponse createAtomicInstWithoutCheangeStateResp = createAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ComponentInstanceRestUtils.checkCreateResponse(createAtomicInstWithoutCheangeStateResp);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@Test
public void createResourceInstance_ResourceInCertificationRequestStateTest() throws Exception {
- changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- changeResourceLifecycleState(resourceDetailsCP_01, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceLifecycleState(resourceDetailsCP_01, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
@@ -457,18 +397,13 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createResourceInstance_startCertificationStateTest() throws Exception {
- changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- changeResourceLifecycleState(resourceDetailsCP_01, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
-
- changeResourceLifecycleState(resourceDetailsVF_01, sdncTesterDetails.getUserId(),
- LifeCycleStatesEnum.STARTCERTIFICATION);
- changeResourceLifecycleState(resourceDetailsCP_01, sdncTesterDetails.getUserId(),
- LifeCycleStatesEnum.STARTCERTIFICATION);
-
- createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ changeResourceLifecycleState(resourceDetailsCP_01, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+
+ changeResourceLifecycleState(resourceDetailsVF_01, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.STARTCERTIFICATION);
+ changeResourceLifecycleState(resourceDetailsCP_01, sdncTesterDetails.getUserId(), LifeCycleStatesEnum.STARTCERTIFICATION);
+
+ createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01, sdncDesignerDetails);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@@ -478,8 +413,7 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
certifyResource(resourceDetailsVF_01);
certifyResource(resourceDetailsCP_01);
- createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01, sdncDesignerDetails);
}
@Test
@@ -492,11 +426,9 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
vfResource.setTags(new ArrayList<String>(Arrays.asList(vfResource.getName())));
createVF(vfResource, designer2);
- RestResponse atomicInstanceForService = createCheckedinAtomicInstanceForService(serviceDetails_01,
- resourceDetailsCP_01, sdncDesignerDetails);
+ RestResponse atomicInstanceForService = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(atomicInstanceForService);
- createVFInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), vfResource,
- designer2, 409);
+ createVFInstanceFailWithoutChangeState(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), vfResource, designer2, 409);
getComponentAndValidateRIs(serviceDetails_01, 1, 0);
}
@@ -507,17 +439,13 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String secondInstanceName = resourceDetailsVF_01.getName() + SPACE_STRING + "2";
String thirdInstanceName = resourceDetailsVF_01.getName() + SPACE_STRING + "3";
- LifecycleRestUtils.changeResourceState(resourceDetailsVF_01, sdncDesignerDetails, "0.1",
- LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeResourceState(resourceDetailsVF_01, sdncDesignerDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
- RestResponse createFirstVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createSecondVFInstResp);
- RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createThirdVFInstResp);
Component service = getComponentAndValidateRIs(serviceDetails_01, 3, 0);
@@ -547,10 +475,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
checkServiceOldVersionRIs(oldServiceUniqueId, newSerivceUniqueIdAfterChangeLifecycleState, 2, 0);
// Add one more resource instance to second version of service
- LifecycleRestUtils.changeResourceState(resourceDetailsVL_01, sdncDesignerDetails, "0.1",
- LifeCycleStatesEnum.CHECKIN);
- RestResponse createAtomicResourceInstResp = createAtomicResourceInstanceToSecondServiceVersion(
- newSerivceUniqueIdAfterChangeLifecycleState, resourceDetailsVL_01);
+ LifecycleRestUtils.changeResourceState(resourceDetailsVL_01, sdncDesignerDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
+ RestResponse createAtomicResourceInstResp = createAtomicResourceInstanceToSecondServiceVersion(newSerivceUniqueIdAfterChangeLifecycleState, resourceDetailsVL_01);
String atomicResourceUniqueId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstResp);
getComponentAndValidateRIsAfterAddingAtomicResourceInstance(oldServiceUniqueId, serviceDetails_01, 3, 0);
@@ -562,32 +488,25 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
}
private void createTwoCheckedinVFInstances() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createSecondVFInstResp);
}
- private void getComponentAndValidateRIsAfterAddingAtomicResourceInstance(String oldComponentUniqueId,
- ComponentReqDetails componentDetails, int numOfRIs, int numOfRelations) throws Exception {
- getComponentAndValidateRIsAfterChangeLifecycleState(oldComponentUniqueId, componentDetails, numOfRIs,
- numOfRelations);
+ private void getComponentAndValidateRIsAfterAddingAtomicResourceInstance(String oldComponentUniqueId, ComponentReqDetails componentDetails, int numOfRIs, int numOfRelations) throws Exception {
+ getComponentAndValidateRIsAfterChangeLifecycleState(oldComponentUniqueId, componentDetails, numOfRIs, numOfRelations);
}
- private void checkServiceOldVersionRIs(String oldUniqueId, String newUniqueId, int numOfRIs, int numOfRelations)
- throws IOException, Exception {
+ private void checkServiceOldVersionRIs(String oldUniqueId, String newUniqueId, int numOfRIs, int numOfRelations) throws IOException, Exception {
serviceDetails_01.setUniqueId(oldUniqueId);
getComponentAndValidateRIsAfterChangeLifecycleState(newUniqueId, serviceDetails_01, numOfRIs, numOfRelations);
}
- private RestResponse createAtomicResourceInstanceToSecondServiceVersion(String secondServiceUniqueId,
- ResourceReqDetails resourceToAdd) throws Exception {
+ private RestResponse createAtomicResourceInstanceToSecondServiceVersion(String secondServiceUniqueId, ResourceReqDetails resourceToAdd) throws Exception {
serviceDetails_01.setUniqueId(secondServiceUniqueId);
- RestResponse createAtomicResourceInstResp = createAtomicInstanceForService(serviceDetails_01, resourceToAdd,
- sdncDesignerDetails);
+ RestResponse createAtomicResourceInstResp = createAtomicInstanceForService(serviceDetails_01, resourceToAdd, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstResp);
return createAtomicResourceInstResp;
}
@@ -595,12 +514,9 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void createResourceInstanceToUnsupportedComponentTest() throws Exception {
String unsupportedType = "unsupported";
- ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory
- .getComponentResourceInstance(resourceDetailsCP_01);
- RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(
- resourceInstanceReqDetails, sdncDesignerDetails, serviceDetails_01.getUniqueId(), unsupportedType);
- checkErrorMessage(ActionStatus.UNSUPPORTED_ERROR, new ArrayList<String>(Arrays.asList(unsupportedType)), 400,
- createResourceInstanceResponse);
+ ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getComponentResourceInstance(resourceDetailsCP_01);
+ RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, sdncDesignerDetails, serviceDetails_01.getUniqueId(), unsupportedType);
+ checkErrorMessage(ActionStatus.UNSUPPORTED_ERROR, new ArrayList<String>(Arrays.asList(unsupportedType)), 400, createResourceInstanceResponse);
}
@Test
@@ -608,10 +524,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
- deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
- deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
+ deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), 409);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@@ -620,27 +534,21 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String oldServiceUniqueId = serviceDetails_01.getUniqueId();
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
- RestResponse createAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01,
- resourceDetailsCP_01, sdncDesignerDetails);
+ RestResponse createAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstResp);
changeServiceLifecycleState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
- changeServiceLifecycleState(serviceDetails_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2),
- LifeCycleStatesEnum.CHECKOUT);
+ changeServiceLifecycleState(serviceDetails_01, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), LifeCycleStatesEnum.CHECKOUT);
String newServiceUniqueId = serviceDetails_01.getUniqueId();
String oldVFInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createVFInstResp);
- String newVFInstanceUniqueId = oldVFInstanceUniqueId.replaceAll(oldServiceUniqueId,
- serviceDetails_01.getUniqueId());
+ String newVFInstanceUniqueId = oldVFInstanceUniqueId.replaceAll(oldServiceUniqueId, serviceDetails_01.getUniqueId());
String oldAtomicResourceInstanceUniqueId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstResp);
- String newAtomicResourceInstanceUniqueId = oldAtomicResourceInstanceUniqueId.replaceAll(oldServiceUniqueId,
- serviceDetails_01.getUniqueId());
+ String newAtomicResourceInstanceUniqueId = oldAtomicResourceInstanceUniqueId.replaceAll(oldServiceUniqueId, serviceDetails_01.getUniqueId());
- deleteVFInstanceAndAtomicResourceInstanceSuccessfully(newVFInstanceUniqueId, newAtomicResourceInstanceUniqueId,
- ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2));
+ deleteVFInstanceAndAtomicResourceInstanceSuccessfully(newVFInstanceUniqueId, newAtomicResourceInstanceUniqueId, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2));
serviceDetails_01.setUniqueId(oldServiceUniqueId);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
@@ -652,28 +560,22 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
- private void deleteVFInstanceAndAtomicResourceInstanceSuccessfully(String vfInstanceUniqueId,
- String atomicResourceInstanceUniqueId) throws IOException, Exception {
- deleteVFInstanceAndAtomicResourceInstanceSuccessfully(vfInstanceUniqueId, atomicResourceInstanceUniqueId,
- sdncDesignerDetails);
+ private void deleteVFInstanceAndAtomicResourceInstanceSuccessfully(String vfInstanceUniqueId, String atomicResourceInstanceUniqueId) throws IOException, Exception {
+ deleteVFInstanceAndAtomicResourceInstanceSuccessfully(vfInstanceUniqueId, atomicResourceInstanceUniqueId, sdncDesignerDetails);
}
- private void deleteVFInstanceAndAtomicResourceInstanceSuccessfully(String vfInstanceUniqueId,
- String atomicResourceInstanceUniqueId, User user) throws IOException, Exception {
+ private void deleteVFInstanceAndAtomicResourceInstanceSuccessfully(String vfInstanceUniqueId, String atomicResourceInstanceUniqueId, User user) throws IOException, Exception {
RestResponse deleteVFInstResp = deleteVFInstance(vfInstanceUniqueId, serviceDetails_01, user);
ResourceRestUtils.checkDeleteResponse(deleteVFInstResp);
- RestResponse deleteAtomicResourceInsResp = deleteAtomicInstanceForService(atomicResourceInstanceUniqueId,
- serviceDetails_01, user);
+ RestResponse deleteAtomicResourceInsResp = deleteAtomicInstanceForService(atomicResourceInstanceUniqueId, serviceDetails_01, user);
ResourceRestUtils.checkDeleteResponse(deleteAtomicResourceInsResp);
}
@Test
public void deleteResourceInstanceByTesterUserTest() throws Exception {
createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
- deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
- deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
+ deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), 409);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@@ -682,10 +584,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
User notASDCUser = new User();
notASDCUser.setUserId("ab0001");
- deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- notASDCUser, 409);
- deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, notASDCUser, 409);
+ deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, notASDCUser, 409);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, notASDCUser, 409);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@@ -693,10 +593,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void deleteResourceInstanceFromCheckedinServiceTest() throws Exception {
createVFInstanceAndAtomicResourceInstanceSuccessully(resourceDetailsVF_01, resourceDetailsCP_01);
changeServiceLifecycleState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
- deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- sdncDesignerDetails, 409);
- deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, sdncDesignerDetails, 409);
+ deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, sdncDesignerDetails, 409);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, sdncDesignerDetails, 409);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
@@ -708,8 +606,7 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
RestResponse createVFInstance = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstance);
String vfInstUniqueId = ResponseParser.getUniqueIdFromResponse(createVFInstance);
- RestResponse atomicInstanceForService = createAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ RestResponse atomicInstanceForService = createAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(atomicInstanceForService);
String atomicInstUniqueId = ResponseParser.getUniqueIdFromResponse(atomicInstanceForService);
@@ -725,10 +622,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
resourceDetailsVF_01.setUniqueId("1234");
resourceDetailsCP_01.setUniqueId("5678");
- deleteVFInstanceFail(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsVF_01, sdncDesignerDetails, 404);
- deleteAtomicResourceInstanceFail(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsCP_01, sdncDesignerDetails, 404);
+ deleteVFInstanceFail(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsVF_01, sdncDesignerDetails, 404);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESOURCE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsCP_01, sdncDesignerDetails, 404);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
// {"requestError":{"serviceException":{"messageId":"SVC4503","text":"Error:
@@ -738,27 +633,22 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void deleteResourceInstanceFromServiceNotFoundTest() throws Exception, Throwable {
serviceDetails_01.setUniqueId("1234");
- deleteVFInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsVF_01, sdncDesignerDetails, 404);
- deleteAtomicResourceInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")),
- resourceDetailsCP_01, sdncDesignerDetails, 404);
+ deleteVFInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsVF_01, sdncDesignerDetails, 404);
+ deleteAtomicResourceInstanceFail(ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")), resourceDetailsCP_01, sdncDesignerDetails, 404);
}
@Test
public void deleteResourceInstanceFromUnsupportedTypeTest() throws Exception {
String unsupportedType = "unsupportedType";
- RestResponse deleteVFInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncDesignerDetails,
- serviceDetails_01.getUniqueId(), resourceDetailsVF_01.getUniqueId(), unsupportedType);
- checkErrorMessage(ActionStatus.UNSUPPORTED_ERROR, new ArrayList<String>(Arrays.asList(unsupportedType)), 400,
- deleteVFInstanceResponse);
+ RestResponse deleteVFInstanceResponse = ComponentInstanceRestUtils.deleteComponentInstance(sdncDesignerDetails, serviceDetails_01.getUniqueId(), resourceDetailsVF_01.getUniqueId(), unsupportedType);
+ checkErrorMessage(ActionStatus.UNSUPPORTED_ERROR, new ArrayList<String>(Arrays.asList(unsupportedType)), 400, deleteVFInstanceResponse);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
@Test
public void deleteResourceInstanceWithEmptyServiceUidTest() throws Exception, Throwable {
serviceDetails_01.setUniqueId("");
- RestResponse deleteVFInstResp = deleteVFInstance(resourceDetailsVF_01.getUniqueId(), serviceDetails_01,
- sdncDesignerDetails);
+ RestResponse deleteVFInstResp = deleteVFInstance(resourceDetailsVF_01.getUniqueId(), serviceDetails_01, sdncDesignerDetails);
assertEquals(404, deleteVFInstResp.getErrorCode().intValue());
}
@@ -772,41 +662,31 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void deleteResourceInstanceWithEmptyUserIdTest() throws Exception {
sdncDesignerDetails.setUserId("");
- deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01,
- sdncDesignerDetails, 409);
- deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(),
- resourceDetailsCP_01, sdncDesignerDetails, 409);
+ deleteVFInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsVF_01, sdncDesignerDetails, 409);
+ deleteAtomicResourceInstanceFail(ActionStatus.RESTRICTED_OPERATION, new ArrayList<String>(), resourceDetailsCP_01, sdncDesignerDetails, 409);
getComponentAndValidateRIs(serviceDetails_01, 0, 0);
}
// fail - bug DE188994
@Test
public void associateResourceInstanceToResourceInstanceNotFoundTest() throws Exception, Throwable {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createVFInstResp);
String capCompInstId = "1234";
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
List<CapabilityDefinition> capListBeforeAssociate = new ArrayList<CapabilityDefinition>();
CapabilityDefinition cap = new CapabilityDefinition();
cap.setUniqueId(capCompInstId);
capListBeforeAssociate.add(cap);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
-
- assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_NOT_FOUND, 404,
- new ArrayList<String>(Arrays.asList(capCompInstId)));
-
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+
+ assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_NOT_FOUND, 404, new ArrayList<String>(Arrays.asList(capCompInstId)));
+
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate,
// requirementsAfterAssoicate);
// AssertJUnit.assertEquals("Check requirement", capListBeforeAssociate,
@@ -827,22 +707,16 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// story
@Test(enabled = false)
public void associateOnceAgainExistingRelationTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
//////////////////////////////////////////////
@@ -852,12 +726,9 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// ArrayList<String>(Arrays.asList(capCompInstId)));
//////////////////////////////////////////////
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListAfterAssociate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListAfterAssociate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", null,
// reqListAfterAssociate);
@@ -880,36 +751,27 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void associateInstancesInMissingServiceTest() throws Exception {
serviceDetails_01.setUniqueId("1234");
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
- assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.SERVICE_NOT_FOUND, 404,
- new ArrayList<String>(Arrays.asList("")));
+ assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.SERVICE_NOT_FOUND, 404, new ArrayList<String>(Arrays.asList("")));
}
@Test
public void associateAfterDeletingResourceTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
ResourceRestUtils.deleteResource(resourceDetailsVF_01.getUniqueId(), sdncDesignerDetails.getUserId());
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
// for (CapabilityDefinition capabilityDefinition :
// capListBeforeAssociate) {
@@ -932,34 +794,24 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void associateInstancesInCheckedinServiceTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
changeServiceLifecycleState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
- assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409,
- new ArrayList<String>());
+ assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate, requirementsAfterAssoicate);
AssertJUnit.assertEquals("Check requirement", capListBeforeAssociate, capabilitiesAfterAssociate);
@@ -970,43 +822,29 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void associateAfterCheckoutAllInstancesTest() throws Exception {
String firstVFUniqueId = resourceDetailsVF_01.getUniqueId();
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
String secondVFUniqueId = resourceDetailsVF_02.getUniqueId();
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
-
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
-
- changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CHECKOUT);
- changeResourceLifecycleState(resourceDetailsVF_02, sdncDesignerDetails.getUserId(),
- LifeCycleStatesEnum.CHECKOUT);
-
- requirementDef.setFromNode(
- requirementDef.getFromNode().replaceAll(firstVFUniqueId, resourceDetailsVF_01.getUniqueId()));
- requirementDef
- .setToNode(requirementDef.getToNode().replaceAll(secondVFUniqueId, resourceDetailsVF_02.getUniqueId()));
-
- assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409,
- new ArrayList<String>());
-
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
+
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+
+ changeResourceLifecycleState(resourceDetailsVF_01, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CHECKOUT);
+ changeResourceLifecycleState(resourceDetailsVF_02, sdncDesignerDetails.getUserId(), LifeCycleStatesEnum.CHECKOUT);
+
+ requirementDef.setFromNode(requirementDef.getFromNode().replaceAll(firstVFUniqueId, resourceDetailsVF_01.getUniqueId()));
+ requirementDef.setToNode(requirementDef.getToNode().replaceAll(secondVFUniqueId, resourceDetailsVF_02.getUniqueId()));
+
+ assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate,
// requirementsAfterAssoicate);
// AssertJUnit.assertEquals("Check requirement", capListBeforeAssociate,
@@ -1026,57 +864,39 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void associateInstancesByDifferentUsersTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
-
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
-
- assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2),
- ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
- assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.TESTER),
- ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
- assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR),
- ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
- assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.OPS),
- ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
- assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1),
- ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
-
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
+
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+
+ assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2), ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+ assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.TESTER), ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+ assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR), ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+ assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.OPS), ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+ assocaiteInstancesFail(requirementDef, ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1), ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
+
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate, requirementsAfterAssoicate);
AssertJUnit.assertEquals("Check requirement", capListBeforeAssociate, capabilitiesAfterAssociate);
getComponentAndValidateRIs(serviceDetails_01, 2, 0);
}
- private void assocaiteInstancesFail(RequirementCapabilityRelDef requirementDef, User user,
- ActionStatus actionStatus, int errorCode, List<String> variables) throws IOException, Exception {
- RestResponse associateInstancesResp = ComponentInstanceRestUtils.associateInstances(requirementDef, user,
- serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
+ private void assocaiteInstancesFail(RequirementCapabilityRelDef requirementDef, User user, ActionStatus actionStatus, int errorCode, List<String> variables) throws IOException, Exception {
+ RestResponse associateInstancesResp = ComponentInstanceRestUtils.associateInstances(requirementDef, user, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
checkErrorMessage(actionStatus, variables, errorCode, associateInstancesResp);
}
- private void dissoicateInstancesFail(RequirementCapabilityRelDef requirementDef, User user,
- ActionStatus actionStatus, int errorCode, List<String> variables) throws IOException, Exception {
- RestResponse dissoicateInstancesResp = ComponentInstanceRestUtils.dissociateInstances(requirementDef, user,
- serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
+ private void dissoicateInstancesFail(RequirementCapabilityRelDef requirementDef, User user, ActionStatus actionStatus, int errorCode, List<String> variables) throws IOException, Exception {
+ RestResponse dissoicateInstancesResp = ComponentInstanceRestUtils.dissociateInstances(requirementDef, user, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
checkErrorMessage(actionStatus, variables, errorCode, dissoicateInstancesResp);
}
@@ -1084,47 +904,36 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void associateWithMissingServiceUidTest() throws Exception {
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
serviceDetails_01.setUniqueId("");
- RestResponse associateInstancesResp = ComponentInstanceRestUtils.associateInstances(requirementDef,
- sdncDesignerDetails, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
+ RestResponse associateInstancesResp = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncDesignerDetails, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
assertEquals(404, associateInstancesResp.getErrorCode().intValue());
}
// fail - bug DE191824
@Test
public void associateNotCompitableReqCapTest() throws Exception {
- RestResponse createFirstAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01,
- resourceDetailsCP_01, sdncDesignerDetails);
+ RestResponse createFirstAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
String reqCompInstName = ResponseParser.getNameFromResponse(createFirstAtomicResourceInstResp);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstAtomicResourceInstResp);
- RestResponse createSecondAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01,
- resourceDetailsVL_02, sdncDesignerDetails);
+ RestResponse createSecondAtomicResourceInstResp = createCheckedinAtomicInstanceForService(serviceDetails_01, resourceDetailsVL_02, sdncDesignerDetails);
String capCompInstName = ResponseParser.getNameFromResponse(createSecondAtomicResourceInstResp);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondAtomicResourceInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
List<String> variables = new ArrayList<String>();
variables.add(reqCompInstName);
variables.add(capCompInstName);
variables.add(REQUIREMENT_NAME);
- assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_MATCH_NOT_FOUND, 404,
- variables);
+ assocaiteInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_MATCH_NOT_FOUND, 404, variables);
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capabilitiesAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> requirementsAfterAssoicate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate,
// requirementsAfterAssoicate);
// AssertJUnit.assertEquals("Check requirement", capListBeforeAssociate,
@@ -1140,22 +949,16 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void associateInstancesInTwoServiceVersionsTest() throws Exception {
String oldServiceUniqueId = serviceDetails_01.getUniqueId();
- RestResponse createFirstVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
getComponentAndValidateRIs(serviceDetails_01, 2, 1);
@@ -1168,40 +971,29 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
updateCapabilitiesOwnerId(oldServiceUniqueId, capListBeforeAssociate, secondServiceUniqueId);
updateExpectedReqCapAfterChangeLifecycleState(oldServiceUniqueId, secondServiceUniqueId);
- CapReqDef capReqDefAfterAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListAfterAssociate = capReqDefAfterAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterAssociate = capReqDefAfterAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListAfterAssociate = capReqDefAfterAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", null,
// reqListAfterAssociate);
// AssertJUnit.assertEquals("Check capabilities",
// capListBeforeAssociate, capListAfterAssociate);
getComponentAndValidateRIs(serviceDetails_01, 2, 1);
- RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqSecondCompInstId = ResponseParser.getUniqueIdFromResponse(createThirdVFInstResp);
- CapReqDef capReqDefBeforeSeconderyAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeSeconderyAssociate = capReqDefBeforeSeconderyAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeSeconderyAssociate = capReqDefBeforeSeconderyAssociate
- .getRequirements().get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeSeconderyAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeSeconderyAssociate = capReqDefBeforeSeconderyAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeSeconderyAssociate = capReqDefBeforeSeconderyAssociate.getRequirements().get(CAPABILITY_TYPE);
capCompInstId = capCompInstId.replaceAll(oldServiceUniqueId, secondServiceUniqueId);
- RequirementCapabilityRelDef secondRequirementDef = getReqCapRelation(reqSecondCompInstId, capCompInstId,
- CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeSeconderyAssociate, reqListBeforeSeconderyAssociate);
+ RequirementCapabilityRelDef secondRequirementDef = getReqCapRelation(reqSecondCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeSeconderyAssociate, reqListBeforeSeconderyAssociate);
associateComponentInstancesForService(secondRequirementDef, serviceDetails_01, sdncDesignerDetails);
- CapReqDef capReqDefAfterSeconderyAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterSeconderyAssociate = capReqDefAfterSeconderyAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListAfterSeconderyAssociate = capReqDefAfterSeconderyAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterSeconderyAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterSeconderyAssociate = capReqDefAfterSeconderyAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListAfterSeconderyAssociate = capReqDefAfterSeconderyAssociate.getRequirements().get(CAPABILITY_TYPE);
// AssertJUnit.assertEquals("Check requirement", null,
// reqListAfterSeconderyAssociate);
// AssertJUnit.assertEquals("Check capabilities",
@@ -1225,27 +1017,21 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = "4567";
- CapReqDef capReqDef = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ CapReqDef capReqDef = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
List<CapabilityDefinition> capList = capReqDef.getCapabilities().get(CAPABILITY_TYPE);
List<RequirementDefinition> reqList = capReqDef.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capList, reqList);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capList, reqList);
List<String> variables = new ArrayList<String>();
variables.add(reqCompInstId);
variables.add(capCompInstId);
variables.add(REQUIREMENT_NAME);
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND,
- 404, variables);
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND, 404, variables);
- CapReqDef capReqDefAfterDissociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterDissociate = capReqDefAfterDissociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListAfterDissociate = capReqDefAfterDissociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefAfterDissociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterDissociate = capReqDefAfterDissociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListAfterDissociate = capReqDefAfterDissociate.getRequirements().get(CAPABILITY_TYPE);
AssertJUnit.assertEquals("Check requirement", 1, reqListAfterDissociate.size());
AssertJUnit.assertEquals("Check requirement", reqList, reqListAfterDissociate);
@@ -1258,26 +1044,19 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void dissociateRelationInServiceNotFoundTest() throws Exception {
String uniqueId = "1234";
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
serviceDetails_01.setUniqueId(uniqueId);
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.SERVICE_NOT_FOUND, 404,
- new ArrayList<String>(Arrays.asList("")));
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.SERVICE_NOT_FOUND, 404, new ArrayList<String>(Arrays.asList("")));
}
@@ -1285,35 +1064,26 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void dissoicateRelationWhileInstanceNotFound() throws Exception {
String capUniqueId = "1234";
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = capUniqueId;
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
List<String> variables = new ArrayList<String>();
variables.add(reqCompInstId);
variables.add(capCompInstId);
variables.add(REQUIREMENT_NAME);
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND,
- 404, variables);
-
- CapReqDef capReqDefAfterDissociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListAfterDissociate = capReqDefAfterDissociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListAfterDissociate = capReqDefAfterDissociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND, 404, variables);
+
+ CapReqDef capReqDefAfterDissociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListAfterDissociate = capReqDefAfterDissociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListAfterDissociate = capReqDefAfterDissociate.getRequirements().get(CAPABILITY_TYPE);
AssertJUnit.assertEquals("Check requirement", reqListBeforeAssociate, reqListAfterDissociate);
AssertJUnit.assertEquals("Check capabilities", capListBeforeAssociate, capListAfterDissociate);
@@ -1324,45 +1094,36 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void dissociateWhileServiceCheckedinTest() throws Exception {
changeServiceLifecycleState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CHECKIN);
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409,
- new ArrayList<String>());
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
}
@Test
public void dissoicateWithEmptyUserIdHeaderTest() throws Exception {
sdncDesignerDetails.setUserId("");
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409,
- new ArrayList<String>());
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESTRICTED_OPERATION, 409, new ArrayList<String>());
}
@Test
public void dissociateWithMissingUidOfServiceTest() throws Exception {
serviceDetails_01.setUniqueId("");
RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
- RestResponse dissociateResp = ComponentInstanceRestUtils.dissociateInstances(requirementDef,
- sdncDesignerDetails, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
+ RestResponse dissociateResp = ComponentInstanceRestUtils.dissociateInstances(requirementDef, sdncDesignerDetails, serviceDetails_01.getUniqueId(), ComponentTypeEnum.SERVICE);
assertEquals(404, dissociateResp.getErrorCode().intValue());
}
@Test
public void relationDeletedAfterDeletingResourceInstanceTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
getComponentAndValidateRIs(serviceDetails_01, 2, 1);
@@ -1375,22 +1136,16 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void relationNotFoundInSecondVersionAfterDissociateTest() throws Exception {
String oldContainerUniqueIdToReplace = serviceDetails_01.getUniqueId();
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
dissociateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
@@ -1404,26 +1159,18 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
@Test
public void dissociateOnceAgainTest() throws Exception {
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- String reqCompInsName = ResponseParser
- .convertComponentInstanceResponseToJavaObject(createFirstVFInstResp.getResponse()).getName();
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ String reqCompInsName = ResponseParser.convertComponentInstanceResponseToJavaObject(createFirstVFInstResp.getResponse()).getName();
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- String capCompInstName = ResponseParser
- .convertComponentInstanceResponseToJavaObject(createSecondVFInstResp.getResponse()).getName();
+ String capCompInstName = ResponseParser.convertComponentInstanceResponseToJavaObject(createSecondVFInstResp.getResponse()).getName();
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE,
- REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
dissociateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
@@ -1433,35 +1180,26 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
variables.add(capCompInstName);
variables.add(REQUIREMENT_NAME);
- dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND,
- 404, variables);
+ dissoicateInstancesFail(requirementDef, sdncDesignerDetails, ActionStatus.RESOURCE_INSTANCE_RELATION_NOT_FOUND, 404, variables);
}
// fail - bug : DE191707
@Test
public void associateTwoRelations_CheckinCheckout_DissoicateOneRelationInSecondVersion() throws Exception {
String oldContainerUniqueIdToReplace = serviceDetails_01.getUniqueId();
- RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createFirstVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String reqCompInstId = ResponseParser.getUniqueIdFromResponse(createFirstVFInstResp);
- RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createSecondVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
String capCompInstId = ResponseParser.getUniqueIdFromResponse(createSecondVFInstResp);
- RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createThirdVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
String secondReqCompInstId = ResponseParser.getUniqueIdFromResponse(createThirdVFInstResp);
- CapReqDef capReqDefBeforeAssociate = ComponentRestUtils
- .getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
- List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities()
- .get(CAPABILITY_TYPE);
- List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements()
- .get(CAPABILITY_TYPE);
+ CapReqDef capReqDefBeforeAssociate = ComponentRestUtils.getAndParseComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
+ List<CapabilityDefinition> capListBeforeAssociate = capReqDefBeforeAssociate.getCapabilities().get(CAPABILITY_TYPE);
+ List<RequirementDefinition> reqListBeforeAssociate = capReqDefBeforeAssociate.getRequirements().get(CAPABILITY_TYPE);
- RequirementCapabilityRelDef requirementDefFirstRelation = getReqCapRelation(reqCompInstId, capCompInstId,
- CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
- RequirementCapabilityRelDef requirementDefSecondRelation = getReqCapRelation(secondReqCompInstId, capCompInstId,
- CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDefFirstRelation = getReqCapRelation(reqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
+ RequirementCapabilityRelDef requirementDefSecondRelation = getReqCapRelation(secondReqCompInstId, capCompInstId, CAPABILITY_TYPE, REQUIREMENT_NAME, capListBeforeAssociate, reqListBeforeAssociate);
associateComponentInstancesForService(requirementDefFirstRelation, serviceDetails_01, sdncDesignerDetails);
associateComponentInstancesForService(requirementDefSecondRelation, serviceDetails_01, sdncDesignerDetails);
@@ -1476,10 +1214,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
// sdncDesignerDetails, actionStatus, errorCode, variables);
getComponentAndValidateRIs(serviceDetails_01, 3, 2);
- requirementDefFirstRelation
- .setFromNode(reqCompInstId.replaceAll(oldContainerUniqueIdToReplace, newContainerUniqueId));
- requirementDefFirstRelation
- .setToNode(reqCompInstId.replaceAll(oldContainerUniqueIdToReplace, newContainerUniqueId));
+ requirementDefFirstRelation.setFromNode(reqCompInstId.replaceAll(oldContainerUniqueIdToReplace, newContainerUniqueId));
+ requirementDefFirstRelation.setToNode(reqCompInstId.replaceAll(oldContainerUniqueIdToReplace, newContainerUniqueId));
dissociateComponentInstancesForService(requirementDefFirstRelation, serviceDetails_01, sdncDesignerDetails);
@@ -1504,10 +1240,8 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
public void createResourceInstancesAndUpdatedServiceMetadataTest() throws Exception, Exception {
serviceDetails_02.setUniqueId(serviceDetails_01.getUniqueId());
createTwoCheckedinVFInstances();
- LifecycleRestUtils.changeResourceState(resourceDetailsCP_01, sdncDesignerDetails, "0.1",
- LifeCycleStatesEnum.CHECKIN);
- createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ LifecycleRestUtils.changeResourceState(resourceDetailsCP_01, sdncDesignerDetails, "0.1", LifeCycleStatesEnum.CHECKIN);
+ createVFInstanceAndAtomicResourceInstanceWithoutCheckin(resourceDetailsVF_01, resourceDetailsCP_01, sdncDesignerDetails);
RestResponse updateServiceResp = ServiceRestUtils.updateService(serviceDetails_02, sdncDesignerDetails);
ServiceRestUtils.checkSuccess(updateServiceResp);
getComponentAndValidateRIs(serviceDetails_01, 4, 0);
@@ -1525,19 +1259,16 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
String capType = CAPABILITY_TYPE;
String reqName = REQUIREMENT_NAME;
- RestResponse getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ RestResponse getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
ResourceRestUtils.checkSuccess(getResourceResponse);
CapReqDef capReqDef = ResponseParser.parseToObject(getResourceResponse.getResponse(), CapReqDef.class);
List<CapabilityDefinition> capList = capReqDef.getCapabilities().get(capType);
List<RequirementDefinition> reqList = capReqDef.getRequirements().get(capType);
- RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, capType, reqName,
- capList, reqList);
+ RequirementCapabilityRelDef requirementDef = getReqCapRelation(reqCompInstId, capCompInstId, capType, reqName, capList, reqList);
associateComponentInstancesForService(requirementDef, serviceDetails_01, sdncDesignerDetails);
- getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails,
- serviceDetails_01);
+ getResourceResponse = ComponentRestUtils.getComponentRequirmentsCapabilities(sdncDesignerDetails, serviceDetails_01);
capReqDef = ResponseParser.parseToObject(getResourceResponse.getResponse(), CapReqDef.class);
List<RequirementDefinition> list = capReqDef.getRequirements().get(capType);
AssertJUnit.assertEquals("Check requirement", null, list);
@@ -1556,49 +1287,38 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
RestResponse response = LifecycleRestUtils.certifyResource(resourceDetailsCP_01);
ResourceRestUtils.checkSuccess(response);
- ArtifactReqDetails heatArtifactDetails = ElementFactory
- .getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
- response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails,
- resourceDetailsVF_02.getUniqueId());
+ ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType());
+ response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails, resourceDetailsVF_02.getUniqueId());
ResourceRestUtils.checkSuccess(response);
response = LifecycleRestUtils.certifyResource(resourceDetailsVF_02);
ResourceRestUtils.checkSuccess(response);
capOwnerId = getUniqueIdOfFirstInstanceFromResponse(response);
- RestResponse createAtomicResourceInstance = createVFInstance(serviceDetails_01, resourceDetailsVF_02,
- sdncDesignerDetails);
+ RestResponse createAtomicResourceInstance = createVFInstance(serviceDetails_01, resourceDetailsVF_02, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
String vfCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
- createAtomicResourceInstance = createAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01,
- sdncDesignerDetails);
+ createAtomicResourceInstance = createAtomicInstanceForService(serviceDetails_01, resourceDetailsCP_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createAtomicResourceInstance);
String compInstName = ResponseParser.getNameFromResponse(createAtomicResourceInstance);
String cpCompInstId = ResponseParser.getUniqueIdFromResponse(createAtomicResourceInstance);
- RestResponse submitForTesting = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- String[] variables = new String[] { serviceDetails_01.getName(), "service", "CP (Connection Point)",
- compInstName, "requirement", "tosca.capabilities.network.Bindable", "fulfilled" };
- BaseValidationUtils.checkErrorResponse(submitForTesting,
- ActionStatus.REQ_CAP_NOT_SATISFIED_BEFORE_CERTIFICATION, variables);
+ RestResponse submitForTesting = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ String[] variables = new String[] { serviceDetails_01.getName(), "service", "CP (Connection Point)", compInstName, "requirement", "tosca.capabilities.network.Bindable", "fulfilled" };
+ BaseValidationUtils.checkErrorResponse(submitForTesting, ActionStatus.REQ_CAP_NOT_SATISFIED_BEFORE_CERTIFICATION, variables);
- fulfillCpRequirement(serviceDetails_01, cpCompInstId, vfCompInstId, capOwnerId, sdncDesignerDetails,
- ComponentTypeEnum.SERVICE);
+ fulfillCpRequirement(serviceDetails_01, cpCompInstId, vfCompInstId, capOwnerId, sdncDesignerDetails, ComponentTypeEnum.SERVICE);
- submitForTesting = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails,
- LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ submitForTesting = LifecycleRestUtils.changeServiceState(serviceDetails_01, sdncDesignerDetails, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
BaseValidationUtils.checkSuccess(submitForTesting);
}
@Test
public void getVFInstanceSuccessfullyTest() throws Exception {
- RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01,
- sdncDesignerDetails);
+ RestResponse createVFInstResp = createCheckedinVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
ResourceRestUtils.checkCreateResponse(createVFInstResp);
System.out.println("instance successfuly created");
- RestResponse getInstancesResponce = ComponentInstanceRestUtils.getComponentInstances(ComponentTypeEnum.SERVICE,
- serviceDetails_01.getUniqueId(), sdncDesignerDetails);
+ RestResponse getInstancesResponce = ComponentInstanceRestUtils.getComponentInstances(ComponentTypeEnum.SERVICE, serviceDetails_01.getUniqueId(), sdncDesignerDetails);
for (int i = 0; i < 1500; i++) {
createVFInstResp = createVFInstance(serviceDetails_01, resourceDetailsVF_01, sdncDesignerDetails);
@@ -1606,8 +1326,7 @@ public class ServiceComponentInstanceCRUDTest extends ComponentInstanceBaseTest
System.out.println("instance " + i + "successfuly created");
}
- getInstancesResponce = ComponentInstanceRestUtils.getComponentInstances(ComponentTypeEnum.SERVICE,
- serviceDetails_01.getUniqueId(), sdncDesignerDetails);
+ getInstancesResponce = ComponentInstanceRestUtils.getComponentInstances(ComponentTypeEnum.SERVICE, serviceDetails_01.getUniqueId(), sdncDesignerDetails);
BaseValidationUtils.checkSuccess(getInstancesResponce);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
index 2f5b47452e..1865dc3292 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
@@ -45,6 +45,7 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -93,12 +94,16 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
sdncGovernorDeatails = ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR);
sdncTesterDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER);
sdncOpsDetails = ElementFactory.getDefaultUser(UserRoleEnum.OPS);
- resourceDetailsVFCcomp = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVFCcomp, UserRoleEnum.DESIGNER, true, true);
+ resourceDetailsVFCcomp = AtomicOperationUtils
+ .createResourceByType(ResourceTypeEnum.VFC, UserRoleEnum.DESIGNER, true).left().value();
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVFCcomp, UserRoleEnum.DESIGNER,
+ true, true);
- AtomicOperationUtils.changeComponentState(resourceDetailsVFCcomp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
+ AtomicOperationUtils.changeComponentState(resourceDetailsVFCcomp, UserRoleEnum.DESIGNER,
+ LifeCycleStatesEnum.CERTIFY, true);
Service serviceServ = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCcomp, serviceServ, UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCcomp, serviceServ,
+ UserRoleEnum.DESIGNER, true);
serviceDetails = new ServiceReqDetails(serviceServ);
updatedServiceDetails = updatedServiceDetails(serviceDetails);
@@ -131,36 +136,49 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
// createServiceResponse);
}
- protected void getServiceAndValidate(ServiceReqDetails excpectedService, User creator, User updater, LifecycleStateEnum lifeCycleState) throws Exception {
- RestResponse getServiceResponse = ServiceRestUtils.getService(excpectedService.getUniqueId(), sdncDesignerDetails);
+ protected void getServiceAndValidate(ServiceReqDetails excpectedService, User creator, User updater,
+ LifecycleStateEnum lifeCycleState) throws Exception {
+ RestResponse getServiceResponse = ServiceRestUtils.getService(excpectedService.getUniqueId(),
+ sdncDesignerDetails);
AssertJUnit.assertNotNull("check response object is not null after updating service", getServiceResponse);
- AssertJUnit.assertNotNull("check if error code exists in response after updating service", getServiceResponse.getErrorCode());
- AssertJUnit.assertEquals("Check response code after updating service", 200, getServiceResponse.getErrorCode().intValue());
+ AssertJUnit.assertNotNull("check if error code exists in response after updating service",
+ getServiceResponse.getErrorCode());
+ AssertJUnit.assertEquals("Check response code after updating service", 200,
+ getServiceResponse.getErrorCode().intValue());
Service actualService = ResponseParser.convertServiceResponseToJavaObject(getServiceResponse.getResponse());
- ServiceValidationUtils.validateServiceResponseMetaData(excpectedService, actualService, creator, updater, lifeCycleState);
+ ServiceValidationUtils.validateServiceResponseMetaData(excpectedService, actualService, creator, updater,
+ lifeCycleState);
}
- public void getServiceAndValidate(ServiceReqDetails excpectedService, LifecycleStateEnum lifecycleState) throws Exception {
+ public void getServiceAndValidate(ServiceReqDetails excpectedService, LifecycleStateEnum lifecycleState)
+ throws Exception {
getServiceAndValidate(excpectedService, sdncDesignerDetails, sdncDesignerDetails, lifecycleState);
}
- protected void validateResponse(RestResponse response, int errorCode, ActionStatus actionResponse, List<String> listOfVariables) throws Exception {
+ protected void validateResponse(RestResponse response, int errorCode, ActionStatus actionResponse,
+ List<String> listOfVariables) throws Exception {
AssertJUnit.assertNotNull("check response object is not null after updating service", response);
- AssertJUnit.assertNotNull("check if error code exists in response after updating service", response.getErrorCode());
- AssertJUnit.assertEquals("Check response code after updating service", errorCode, response.getErrorCode().intValue());
+ AssertJUnit.assertNotNull("check if error code exists in response after updating service",
+ response.getErrorCode());
+ AssertJUnit.assertEquals("Check response code after updating service", errorCode,
+ response.getErrorCode().intValue());
if (actionResponse != null) {
- ErrorValidationUtils.checkBodyResponseOnError(actionResponse.name(), listOfVariables, response.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(actionResponse.name(), listOfVariables,
+ response.getResponse());
return;
}
Service actualService = ResponseParser.convertServiceResponseToJavaObject(response.getResponse());
- ServiceValidationUtils.validateServiceResponseMetaData(updatedServiceDetails, actualService, sdncDesignerDetails, sdncDesignerDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ ServiceValidationUtils.validateServiceResponseMetaData(updatedServiceDetails, actualService,
+ sdncDesignerDetails, sdncDesignerDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
protected void validateActualVsExpected(ServiceReqDetails expectedService, RestResponse actualServiceFromResponse) {
- Service actualService = ResponseParser.convertServiceResponseToJavaObject(actualServiceFromResponse.getResponse());
- ServiceValidationUtils.validateServiceResponseMetaData(updatedServiceDetails, actualService, sdncDesignerDetails, sdncDesignerDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ Service actualService = ResponseParser
+ .convertServiceResponseToJavaObject(actualServiceFromResponse.getResponse());
+ ServiceValidationUtils.validateServiceResponseMetaData(updatedServiceDetails, actualService,
+ sdncDesignerDetails, sdncDesignerDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
protected String multipleString(String ch, int repeat) {
@@ -184,24 +202,30 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
if (field == "name") {
for (char ch = (char) min; ch <= (char) max; ch++) {
updatedServiceDetails.setName("testname" + String.valueOf(ch));
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
- updateWithInvalidValue(ActionStatus.INVALID_COMPONENT_NAME, new ArrayList<>(Arrays.asList("Service")));
+ updatedServiceDetails.setTags(
+ addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updateWithInvalidValue(ActionStatus.INVALID_COMPONENT_NAME,
+ new ArrayList<>(Arrays.asList("Service")));
}
} else if (field == "icon") {
for (char ch = (char) min; ch <= (char) max; ch++) {
updatedServiceDetails.setIcon("testname" + String.valueOf(ch));
- updateWithInvalidValue(ActionStatus.COMPONENT_INVALID_ICON, new ArrayList<>(Arrays.asList("Service")));
+ updateWithInvalidValue(ActionStatus.COMPONENT_INVALID_ICON,
+ new ArrayList<>(Arrays.asList("Service")));
}
} else if (field == "tags") {
List<String> variables = Arrays.asList("Service", "tag");
for (char ch = (char) min; ch <= (char) max; ch++) {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(String.valueOf(ch), updatedServiceDetails.getName())));
+ updatedServiceDetails.setTags(
+ new ArrayList<>(Arrays.asList(String.valueOf(ch), updatedServiceDetails.getName())));
updateWithInvalidValue(ActionStatus.INVALID_FIELD_FORMAT, variables);
}
} else if (field == "category") {
for (char ch = (char) min; ch <= (char) max; ch++) {
- updatedServiceDetails.addCategoryChain(multipleString("1", 5) + String.valueOf(ch), multipleString("1", 5) + String.valueOf(ch));
- updateWithInvalidValue(ActionStatus.COMPONENT_INVALID_CATEGORY, new ArrayList<>(Arrays.asList("Service")));
+ updatedServiceDetails.addCategoryChain(multipleString("1", 5) + String.valueOf(ch),
+ multipleString("1", 5) + String.valueOf(ch));
+ updateWithInvalidValue(ActionStatus.COMPONENT_INVALID_CATEGORY,
+ new ArrayList<>(Arrays.asList("Service")));
}
}
@@ -236,7 +260,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
}
- protected void checkErrorResponse(ActionStatus actionStatus, ArrayList<String> arrList, RestResponse response) throws Exception, JSONException {
+ protected void checkErrorResponse(ActionStatus actionStatus, ArrayList<String> arrList, RestResponse response)
+ throws Exception, JSONException {
ErrorValidationUtils.checkBodyResponseOnError(actionStatus.name(), arrList, response.getResponse());
}
@@ -246,9 +271,94 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
}
+ // @Test
+ // public void updateMetadateSuccessTest() throws Exception {
+ // CloseableHttpClient httpClient = HttpClients.createDefault();
+ // HttpGet httpGet =
+ // ServiceRestUtils.createGetServiceGetRquest(serviceDetails,
+ // sdncDesignerDetails);
+ // CloseableHttpResponse response = httpClient.execute(httpGet);
+ // assertTrue(response.getStatusLine().getStatusCode() == 200);
+ // String responseString = new
+ // BasicResponseHandler().handleResponse(response);
+ // Service serviceObject =
+ // ResponseParser.convertServiceResponseToJavaObject(responseString);
+ // assertTrue("service object creation failed the returned object is null",
+ // serviceObject != null);
+ // String currentCategory = serviceObject.getCategories().get(0).getName();
+ // String currentServiceName = serviceObject.getName();
+ // String currentProjectCode = serviceObject.getProjectCode();
+ // String currentIcon = serviceObject.getIcon();
+ // String currentDescription = serviceObject.getDescription();
+ // List<String> currentTags = serviceObject.getTags();
+ //
+ // String newCategory = ServiceCategoriesEnum.VOIP.getValue();
+ // serviceDetails.addCategory(newCategory);
+ // // String newServiceName = "updated name";
+ // // serviceDetails.setServiceName(newServiceName);
+ // String newProjectCode = "68686868";
+ // serviceDetails.setProjectCode(newProjectCode);
+ // String newIcon = "updated-icon";
+ // serviceDetails.setIcon(newIcon);
+ // String newDescription = "updated description <html></html>";
+ // serviceDetails.setDescription(newDescription);
+ // List<String> newTags = new ArrayList<>();
+ // newTags.add("update1");
+ // newTags.add("update2");
+ // newTags.add(currentServiceName);
+ // serviceDetails.setTags(newTags);
+ // HttpPut httpPut =
+ // ServiceRestUtils.createUpdateServiceMetaDataPutRequest(serviceDetails,
+ // sdncDesignerDetails);
+ // response = httpClient.execute(httpPut);
+ // assertTrue(response.getStatusLine().getStatusCode() == 200);
+ // responseString = new BasicResponseHandler().handleResponse(response);
+ // String serviceUid =
+ // ServiceRestUtils.getServiceUniqueIdFromString(responseString);
+ //
+ // ServiceReqDetails details = new ServiceReqDetails();
+ // details.setUniqueId(serviceUid);
+ //
+ // httpGet = ServiceRestUtils.createGetServiceGetRquest(details,
+ // sdncDesignerDetails);
+ // response = httpClient.execute(httpGet);
+ // assertTrue(response.getStatusLine().getStatusCode() == 200);
+ // responseString = new BasicResponseHandler().handleResponse(response);
+ // serviceObject =
+ // ResponseParser.convertServiceResponseToJavaObject(responseString);
+ // assertTrue("service object creation failed the returned object is null",
+ // serviceObject != null);
+ // String updatedCategory = serviceObject.getCategories().get(0).getName();
+ // String updatedServiceName = serviceObject.getName();
+ // String updatedProjectCode = serviceObject.getProjectCode();
+ // String updatedIcon = serviceObject.getIcon();
+ // String updatedDescription = serviceObject.getDescription();
+ // List<String> updatedTags = serviceObject.getTags();
+ // assertFalse("category did not cahnge",
+ // currentCategory.equals(updatedCategory));
+ // assertEquals("categoruy did not match expacted value", updatedCategory,
+ // newCategory);
+ // // assertFalse("service name did not change",
+ // currentServiceName.equals(updatedServiceName) );
+ // // assertEquals("service name did not match expacted
+ // value",updatedServiceName,newServiceName);
+ // assertFalse("projectCode did not change", currentProjectCode.equals(updatedProjectCode));
+ // assertEquals("projectCode not match expacted value", updatedProjectCode, newProjectCode);
+ // assertFalse("icon did not change", currentIcon.equals(updatedIcon));
+ // assertEquals("icon did not match expacted value", updatedIcon, newIcon);
+ // assertFalse("description did not change",
+ // currentDescription.equals(updatedDescription));
+ // assertEquals("description did not match expacted value", "updated
+ // description", updatedDescription);
+ // assertFalse("tags did not change", currentTags.containsAll(updatedTags));
+ // assertTrue("tags did not match expacted value",
+ // updatedTags.containsAll(newTags));
+ // }
+
@Test
public void updateService_ByOtherDesigner() throws Exception {
- RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails2);
+ RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails2);
validateResponse(updateServiceResponse, 409, ActionStatus.RESTRICTED_OPERATION, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
@@ -266,12 +376,14 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void updateServiceNotExist() throws Exception {
updatedServiceDetails.setUniqueId("nnnnn");
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
- validateResponse(updateServiceResponse, 404, ActionStatus.SERVICE_NOT_FOUND, new ArrayList<String>(Arrays.asList("")));
+ validateResponse(updateServiceResponse, 404, ActionStatus.SERVICE_NOT_FOUND,
+ new ArrayList<String>(Arrays.asList("")));
}
@Test
public void updateCheckedinService() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
validateResponse(updateServiceResponse, 409, ActionStatus.RESTRICTED_OPERATION, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
@@ -328,7 +440,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void updateServiceByMethod_delete() throws Exception {
- RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails, sdncDesignerDetails, "DELETE", Urls.UPDATE_SERVICE_METADATA);
+ RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails,
+ sdncDesignerDetails, "DELETE", Urls.UPDATE_SERVICE_METADATA);
validateResponse(updateServiceResponse, 405, ActionStatus.NOT_ALLOWED, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
@@ -336,7 +449,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void updateServiceByMethod_get() throws Exception {
- RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails, sdncDesignerDetails, "GET", Urls.UPDATE_SERVICE_METADATA);
+ RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails,
+ sdncDesignerDetails, "GET", Urls.UPDATE_SERVICE_METADATA);
validateResponse(updateServiceResponse, 405, ActionStatus.NOT_ALLOWED, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
@@ -344,7 +458,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void updateServiceByMethod_post() throws Exception {
- RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails, sdncDesignerDetails, "POST", Urls.UPDATE_SERVICE_METADATA);
+ RestResponse updateServiceResponse = ServiceRestUtils.createServiceByHttpMethod(updatedServiceDetails,
+ sdncDesignerDetails, "POST", Urls.UPDATE_SERVICE_METADATA);
validateResponse(updateServiceResponse, 405, ActionStatus.NOT_ALLOWED, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
@@ -359,7 +474,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
{
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
validateResponse(updateServiceResponse, 400, ActionStatus.SERVICE_CATEGORY_CANNOT_BE_CHANGED, listForMessage);
@@ -419,6 +535,7 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
// TODO Irrelevant
@Test(enabled = false)
public void missingProjectCodeTest2() throws Exception {
+
updatedServiceDetails.setProjectCode(null);
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
validateResponse(updateServiceResponse, 400, ActionStatus.MISSING_PROJECT_CODE, listForMessage);
@@ -445,7 +562,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void missingDescriptionTest1() throws Exception {
updatedServiceDetails.setDescription(StringUtils.EMPTY);
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
- validateResponse(updateServiceResponse, 400, ActionStatus.COMPONENT_MISSING_DESCRIPTION, Arrays.asList("Service"));
+ validateResponse(updateServiceResponse, 400, ActionStatus.COMPONENT_MISSING_DESCRIPTION,
+ Arrays.asList("Service"));
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@@ -453,7 +571,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void missingDescriptionTest2() throws Exception {
updatedServiceDetails.setDescription(null);
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
- validateResponse(updateServiceResponse, 400, ActionStatus.COMPONENT_MISSING_DESCRIPTION, Arrays.asList("Service"));
+ validateResponse(updateServiceResponse, 400, ActionStatus.COMPONENT_MISSING_DESCRIPTION,
+ Arrays.asList("Service"));
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@@ -477,15 +596,18 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void missingTagsTest3() throws Exception {
updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(StringUtils.EMPTY)));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
- validateResponse(updateServiceResponse, 400, ActionStatus.INVALID_FIELD_FORMAT, Arrays.asList("Service", "tag"));
+ validateResponse(updateServiceResponse, 400, ActionStatus.INVALID_FIELD_FORMAT,
+ Arrays.asList("Service", "tag"));
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@Test
public void missingTagsTest4() throws Exception {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(StringUtils.EMPTY, updatedServiceDetails.getName())));
+ updatedServiceDetails
+ .setTags(new ArrayList<>(Arrays.asList(StringUtils.EMPTY, updatedServiceDetails.getName())));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
- validateResponse(updateServiceResponse, 400, ActionStatus.INVALID_FIELD_FORMAT, Arrays.asList("Service", "tag"));
+ validateResponse(updateServiceResponse, 400, ActionStatus.INVALID_FIELD_FORMAT,
+ Arrays.asList("Service", "tag"));
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@@ -535,7 +657,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
// values------------------------------------------
@Test
public void contactIdValidationTest7() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
updatedServiceDetails.setContactId("ab0001");
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
@@ -546,7 +669,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
// addMandatoryArtifactsToService();
RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser.convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
+ Service certifyServiceServ = ResponseParser
+ .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
updatedServiceDetails = new ServiceReqDetails(certifyService);
updatedServiceDetails.setContactId("ab0001");
@@ -660,7 +784,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void contactIdValidationTest26() throws Exception {
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
updatedServiceDetails = new ServiceReqDetails(serviceDetails);
updatedServiceDetails.setContactId("xy0002");
correctUpdate();
@@ -669,77 +794,88 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void serviceNameValidationTest1() throws Exception {
updatedServiceDetails.setName(multipleString("a", 49));
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest2() throws Exception {
updatedServiceDetails.setName(multipleString("b", 50));
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest3() throws Exception {
updatedServiceDetails.setName("testNamE");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest4() throws Exception {
updatedServiceDetails.setName("Testname");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest5() throws Exception {
updatedServiceDetails.setName("Test_name");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest6() throws Exception {
updatedServiceDetails.setName("Test name");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest7() throws Exception {
updatedServiceDetails.setName("Test-name");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest8() throws Exception {
updatedServiceDetails.setName("Test.name");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest9() throws Exception {
updatedServiceDetails.setName("...1...");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest10() throws Exception {
updatedServiceDetails.setName("-a_1. Arrrrrr");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@Test
public void serviceNameValidationTest11() throws Exception {
updatedServiceDetails.setName("Testname1234567890");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
correctUpdate();
}
@@ -747,20 +883,24 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void serviceNameValidationTest14() throws Exception {
updatedServiceDetails.setName(StringUtils.SPACE); // one space with
// nothing
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
// updateWithInvalidValue(ActionStatus.INVALID_COMPONENT_NAME, new
// ArrayList<>(Arrays.asList("Service")));
- validateResponse(updateServiceResponse, 400, ActionStatus.MISSING_COMPONENT_NAME, new ArrayList<>(Arrays.asList("Service")));
+ validateResponse(updateServiceResponse, 400, ActionStatus.MISSING_COMPONENT_NAME,
+ new ArrayList<>(Arrays.asList("Service")));
}
// ------------------------------------------invalid
// values------------------------------------------
@Test
public void serviceNameValidationTest12() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
updatedServiceDetails.setName("TestNamE");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
@@ -769,8 +909,10 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void serviceNameValidationTest13() throws Exception {
updatedServiceDetails.setName(multipleString("c", 51));
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
- updateWithInvalidValue(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, new ArrayList<>(Arrays.asList("Service", "50")));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updateWithInvalidValue(ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT,
+ new ArrayList<>(Arrays.asList("Service", "50")));
}
@Test
@@ -784,7 +926,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
LifecycleRestUtils.certifyService(serviceDetails);
updatedServiceDetails.setName("testnamename");
updatedServiceDetails.setCategories(serviceDetails.getCategories());
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
getServiceAndValidate(serviceDetails, sdncDesignerDetails, sdncTesterDetails, LifecycleStateEnum.CERTIFIED);
@@ -794,11 +937,14 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void serviceNameValidationTest17() throws Exception {
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
updatedServiceDetails.setName("TestNamE");
updatedServiceDetails.setCategories(serviceDetails.getCategories());
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
- RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
validateResponse(updateServiceResponse2, 400, ActionStatus.SERVICE_NAME_CANNOT_BE_CHANGED, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@@ -806,8 +952,10 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void serviceNameValidationTest18() throws Exception {
updatedServiceDetails.setName(" testname ");
- updatedServiceDetails.setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
- RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ updatedServiceDetails
+ .setTags(addServiceNameToTagsList(updatedServiceDetails.getName(), updatedServiceDetails.getTags()));
+ RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse1);
assertNotNull(updateServiceResponse1.getErrorCode());
assertEquals(200, updateServiceResponse1.getErrorCode().intValue());
@@ -860,7 +1008,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void iconValidationTest8() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
updatedServiceDetails.setIcon("TestNamE");
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
@@ -905,14 +1054,16 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void iconValidationTest14() throws Exception {
updatedServiceDetails.setIcon(multipleString("c", 26));
- updateWithInvalidValue(ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT, new ArrayList<>(Arrays.asList("Service", "25")));
+ updateWithInvalidValue(ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT,
+ new ArrayList<>(Arrays.asList("Service", "25")));
}
@Test
public void iconValidationTest15() throws Exception {
// addMandatoryArtifactsToService();
RestResponse certifyServiceResp = LifecycleRestUtils.certifyService(serviceDetails);
- Service certifyServiceServ = ResponseParser.convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
+ Service certifyServiceServ = ResponseParser
+ .convertServiceResponseToJavaObject(certifyServiceResp.getResponse());
ServiceReqDetails certifyService = new ServiceReqDetails(certifyServiceServ);
updatedServiceDetails = new ServiceReqDetails(certifyService);
updatedServiceDetails.setIcon("testnamename");
@@ -924,7 +1075,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void iconValidationTest16() throws Exception {
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
updatedServiceDetails = new ServiceReqDetails(serviceDetails);
updatedServiceDetails.setIcon("TestNamE");
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
@@ -939,7 +1091,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void categoryValidationTest1() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
updatedServiceDetails.addCategory(ServiceCategoriesEnum.VOIP.getValue());
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
@@ -981,7 +1134,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void categoryValidationTest6() throws Exception {
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
updatedServiceDetails = new ServiceReqDetails(serviceDetails);
updatedServiceDetails = serviceDetails;
List<CategoryDefinition> categories = updatedServiceDetails.getCategories();
@@ -990,7 +1144,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
categoryDefinition2.setName("ccc");
categories.set(0, categoryDefinition2);
updatedServiceDetails.setCategories(categories);
- RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
validateResponse(updateServiceResponse2, 400, ActionStatus.SERVICE_CATEGORY_CANNOT_BE_CHANGED, listForMessage);
getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}
@@ -1011,19 +1166,22 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void tagsValidationTest1() throws Exception {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(multipleString("a", 49), updatedServiceDetails.getName())));
+ updatedServiceDetails
+ .setTags(new ArrayList<>(Arrays.asList(multipleString("a", 49), updatedServiceDetails.getName())));
correctUpdate();
}
@Test
public void tagsValidationTest2() throws Exception {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(multipleString("B", 50), updatedServiceDetails.getName())));
+ updatedServiceDetails
+ .setTags(new ArrayList<>(Arrays.asList(multipleString("B", 50), updatedServiceDetails.getName())));
correctUpdate();
}
@Test
public void tagsValidationTest3() throws Exception {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(multipleString("A", 50), multipleString("B", 50), updatedServiceDetails.getName())));
+ updatedServiceDetails.setTags(new ArrayList<>(
+ Arrays.asList(multipleString("A", 50), multipleString("B", 50), updatedServiceDetails.getName())));
correctUpdate();
}
@@ -1077,7 +1235,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void tagsValidationTest13() throws Exception {
- updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList("Testtag1234567890", updatedServiceDetails.getName())));
+ updatedServiceDetails
+ .setTags(new ArrayList<>(Arrays.asList("Testtag1234567890", updatedServiceDetails.getName())));
correctUpdate();
}
@@ -1089,7 +1248,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void tagsValidationTest15() throws Exception {
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKIN);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKIN);
updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList("TestTaG", updatedServiceDetails.getName())));
RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
checkErrorResponse(ActionStatus.RESTRICTED_OPERATION, listForMessage, updateServiceResponse);
@@ -1109,7 +1269,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
public void tagsValidationTest17() throws Exception {
// addMandatoryArtifactsToService();
certifyService(serviceDetails, serviceDetails.getVersion());
- LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(), LifeCycleStatesEnum.CHECKOUT);
+ LifecycleRestUtils.changeServiceState(serviceDetails, sdncDesignerDetails, serviceDetails.getVersion(),
+ LifeCycleStatesEnum.CHECKOUT);
updatedServiceDetails = new ServiceReqDetails(serviceDetails);
updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList("TestTaG", updatedServiceDetails.getName())));
correctUpdate();
@@ -1124,7 +1285,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
tagsList.add(updatedServiceDetails.getName());
while (tagsCount > maxLengthTag) {
tagsList.add(multipleString("a", maxLengthTag));
- tagsCount -= maxLengthTag + 1 + 1/* (50 and comma of each tag + one space, totally 52) */;
+ tagsCount -= maxLengthTag + 1
+ + 1/* (50 and comma of each tag + one space, totally 52) */;
}
tagsList.add(multipleString("a", tagsCount));
updatedServiceDetails.setTags(tagsList);
@@ -1134,7 +1296,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void tagsValidationTest19() throws Exception {
updatedServiceDetails.setTags(new ArrayList<>(Arrays.asList(" Tag ", updatedServiceDetails.getName())));
- RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse1);
assertNotNull(updateServiceResponse1.getErrorCode());
assertEquals(200, updateServiceResponse1.getErrorCode().intValue());
@@ -1201,7 +1364,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest6() throws Exception {
updatedServiceDetails.setDescription("desc\tription");
- RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse1 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse1);
assertNotNull(updateServiceResponse1.getErrorCode());
assertEquals(200, updateServiceResponse1.getErrorCode().intValue());
@@ -1213,7 +1377,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest7() throws Exception {
updatedServiceDetails.setDescription("desc ription ");
- RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse2 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse2);
assertNotNull(updateServiceResponse2.getErrorCode());
assertEquals(200, updateServiceResponse2.getErrorCode().intValue());
@@ -1225,7 +1390,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest8() throws Exception {
updatedServiceDetails.setDescription("desc" + StringUtils.LF + "ription");
- RestResponse updateServiceResponse3 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse3 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse3);
assertNotNull(updateServiceResponse3.getErrorCode());
assertEquals(200, updateServiceResponse3.getErrorCode().intValue());
@@ -1237,7 +1403,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest9() throws Exception {
updatedServiceDetails.setDescription("<html>Hello, <b>world!</b></html>");
- RestResponse updateServiceResponse4 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse4 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse4);
assertNotNull(updateServiceResponse4.getErrorCode());
assertEquals(200, updateServiceResponse4.getErrorCode().intValue());
@@ -1262,8 +1429,9 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest10_b() throws Exception {
- updatedServiceDetails.setDescription("\uC2B5");
- RestResponse updateServiceResponse5 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ updatedServiceDetails.setDescription("\uC2B5abc");
+ RestResponse updateServiceResponse5 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse5);
assertNotNull(updateServiceResponse5.getErrorCode());
assertEquals(200, updateServiceResponse5.getErrorCode().intValue());
@@ -1276,7 +1444,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest11() throws Exception {
updatedServiceDetails.setDescription("&<>");
- RestResponse updateServiceResponse6 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse6 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse6);
assertNotNull(updateServiceResponse6.getErrorCode());
assertEquals(200, updateServiceResponse6.getErrorCode().intValue());
@@ -1288,7 +1457,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest12() throws Exception {
updatedServiceDetails.setDescription("æ–‡ test");
- RestResponse updateServiceResponse7 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse7 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse7);
assertNotNull(updateServiceResponse7.getErrorCode());
assertEquals(200, updateServiceResponse7.getErrorCode().intValue());
@@ -1300,7 +1470,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest13() throws Exception {
updatedServiceDetails.setDescription(" description");
- RestResponse updateServiceResponse8 = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails);
+ RestResponse updateServiceResponse8 = ServiceRestUtils.updateService(updatedServiceDetails,
+ sdncDesignerDetails);
assertNotNull(updateServiceResponse8);
assertNotNull(updateServiceResponse8.getErrorCode());
assertEquals(200, updateServiceResponse8.getErrorCode().intValue());
@@ -1312,7 +1483,8 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest {
@Test
public void descriptionValidationTest14() throws Exception {
updatedServiceDetails.setDescription(multipleString("a", 1025));
- updateWithInvalidValue(ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, new ArrayList<>(Arrays.asList("Service", "1024")));
+ updateWithInvalidValue(ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT,
+ new ArrayList<>(Arrays.asList("Service", "1024")));
}
@Test
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
index c83018241b..e1bc3c9dde 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
@@ -430,7 +430,7 @@ public class ActivateDeActivateDeleteUser extends ComponentBaseTest {
mapAllUsersOnResponse.remove(sdncAdminUser.getUserId());
logger.debug("map Of all Admin users exclude one : {}", mapAllUsersOnResponse);
- // deActivate all Admin users from the userIdAllAdminList list
+ // deActivate all Admin users from the UserIdAllAdminList list
for (Entry<String, User> entry : mapAllUsersOnResponse.entrySet()) {
UserRestUtils.deActivateUser(entry.getValue(), sdncAdminUser);
}
@@ -651,133 +651,6 @@ public class ActivateDeActivateDeleteUser extends ComponentBaseTest {
}
- // test check the service accessibility via catalog view, service was
- // created by user which was deActivated
-
- // @Test
- // public void serviceAccessibility() throws Exception{
- //
- // User sdncUserDetails = getDefaultUserDetails();
- //// fill new service details
- // ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- // String serviceBaseVersion = "0.1";
- //
- // try{
- // //Delete service
- //// ServiceRestUtils.deleteService_allVersions(serviceDetails,
- // sdncAdminUser);
- // UserRestUtils.deleteUser(sdncUserDetails, sdncAdminUser, true);
- //
- // DbUtils.cleanAllAudits();
- // RestResponse createUserResponse =
- // UserRestUtils.createUser(sdncUserDetails, sdncAdminUser);
- // validateSuccessCreateUserResponse(sdncUserDetails, createUserResponse);
- //
- //// ------------------------Start create
- // service---------------------------------------------------------------------------------
- // RestResponse restResponse =
- // ServiceRestUtils.createService(serviceDetails, sdncUserDetails);
- //
- // assertNotNull("check response object is not null after create service",
- // restResponse);
- // assertNotNull("check error code exists in response after create service",
- // restResponse.getErrorCode());
- // assertEquals("Check response code after create service", 201,
- // restResponse.getErrorCode().intValue());
- //
- //// validate create service response vs actual
- //
- // Service service =
- // ServiceRestUtils.convertServiceResponseToJavaObject(restResponse.getResponse());
- // UserValidationUtils.validateServiceResponseMetaData(serviceDetails,service,sdncUserDetails,
- // (LifecycleStateEnum)null);
- //
- //// validate get service response vs actual
- // restResponse = ServiceRestUtils.getService(serviceDetails.getUniqueId(),
- // sdncUserDetails);
- // service =
- // ServiceRestUtils.convertServiceResponseToJavaObject(restResponse.getResponse());
- // UserValidationUtils.validateServiceResponseMetaData(serviceDetails,service,sdncUserDetails,
- // (LifecycleStateEnum)null);
- //
- // //validate audit
- //
- // ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- // ServiceRestUtils.constructFieldsForAuditValidation(serviceDetails,
- // serviceBaseVersion, sdncUserDetails);
- //
- // String auditAction="Create";
- // expectedResourceAuditJavaObject.setAction(auditAction);
- // expectedResourceAuditJavaObject.setPrevState("");
- // expectedResourceAuditJavaObject.setPrevVersion("");
- // expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
- // expectedResourceAuditJavaObject.setStatus("201");
- // expectedResourceAuditJavaObject.setDesc("OK");
- //
- // AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject,
- // auditAction, null, false);
- //
- //// ------------------------End create
- // service---------------------------------------------------------------------------------
- //
- //// clean audit before authorization test
- // DbUtils.cleanAllAudits();
- //
- //// deActivate created user
- // RestResponse deActivateUserResponse =
- // UserRestUtils.deActivateUser(sdncUserDetails,sdncAdminUser);
- // sdncUserDetails.setStatus(UserStatusEnum.INACTIVE);
- // validateSuccessDeActivateUserResponse(sdncUserDetails,
- // deActivateUserResponse);
- //
- // UserValidationUtils.validateDeleteUserAuditMessage(sdncUserDetails,
- // sdncAdminUser, "200", UserResponseMessageEnum.SUCCESS_MESSAGE.getValue(),
- // UserValidationUtils.getAddUserAuditMessage("DeleteUser"));
- //
- // ErrorInfo errorInfo =
- // ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.USER_INACTIVE.name());
- // RestResponse getUserResponse = UserRestUtils.getUser(sdncUserDetails,
- // sdncAdminUser);
- //
- // assertEquals("Check response code after deActive user",
- // errorInfo.getCode(), getUserResponse.getErrorCode());
- //
- // List<String> variables = Arrays.asList(sdncUserDetails.getUserId());
- // ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.USER_INACTIVE.name(),
- // variables, getUserResponse.getResponse());
- //
- // //checking if created service is accessible
- // DbUtils.cleanAllAudits();
- //
- // RestResponse getCatalogDataResponse =
- // CatalogRestUtils.getCatalog(sdncAdminUser.getUserId());
- //
- // //validate response
- //
- // assertNotNull("check response object is not null after user login",
- // getCatalogDataResponse);
- // assertNotNull("check error code exists in response after user login",
- // getCatalogDataResponse.getErrorCode());
- // assertEquals("Check response code after deActive user", 200,
- // getCatalogDataResponse.getErrorCode().intValue());
- //
- //// expected service list
- // List<String> serviceExpectedUniqIdList= new ArrayList<String>();
- // serviceExpectedUniqIdList.add(serviceDetails.getUniqueId());
- // logger.debug("serviceExpectedUniqIdList: {}", serviceExpectedUniqIdList);
- //
- // compareServiceUniqIdList(getCatalogDataResponse.getResponse(),
- // serviceExpectedUniqIdList, true);
- //
- //
- // }finally{
- //// ServiceRestUtils.deleteService_allVersions(serviceDetails,
- // sdncAdminUser);
- // UserRestUtils.deleteUser(sdncUserDetails, sdncAdminUser, true);
- // }
- //
- // }
-
public void compareServiceUniqIdList(String response, List<String> expectedList, boolean flag) {
JsonElement jelement = new JsonParser().parse(response);
@@ -811,14 +684,14 @@ public class ActivateDeActivateDeleteUser extends ComponentBaseTest {
resourceReqDetailsListOnResponse.add(json);
}
- logger.debug("ResourceReqDetails list on response: {}", resourceReqDetailsListOnResponse);
+ logger.debug("ResourceReqDetails list on response: {}",resourceReqDetailsListOnResponse);
List<String> resourceActualUniqIdList = new ArrayList<String>();
for (ResourceReqDetails resource : resourceReqDetailsListOnResponse) {
resourceActualUniqIdList.add(resource.getUniqueId());
}
- logger.debug("resourceActualUniqIdList on response: {}", resourceActualUniqIdList);
- logger.debug("resourceExpectedUniqIdList on response: {}", expectedList);
+ logger.debug("resourceActualUniqIdList on response: {}",resourceActualUniqIdList);
+ logger.debug("resourceExpectedUniqIdList on response: {}",expectedList);
if (flag) {
assertTrue("actual list does not contain expected list",
@@ -829,4 +702,55 @@ public class ActivateDeActivateDeleteUser extends ComponentBaseTest {
}
}
+ // public User getDefaultUserDetails(){
+ //
+ // String userFirstName = "Kot";
+ // String userLastName = "May";
+ // String role = UserRoleEnum.ADMIN.name();
+ // User sdncUserDetails = new User(userFirstName, userLastName,
+ // httpCspUserId, email, role,null);
+ //
+ // return sdncUserDetails;
+ // }
+ //
+ // public void validateSuccessCreateUserResponse(User sdncUserDetails,
+ // RestResponse createUserResponse) throws Exception{
+ //
+ // assertNotNull("check response object is not null after create user",
+ // createUserResponse);
+ // assertNotNull("check error code exists in response after create user",
+ // createUserResponse.getErrorCode());
+ // assertEquals("Check response code after create user",
+ // HttpStatus.SC_CREATED, createUserResponse.getErrorCode().intValue());
+ //
+ // UserRestUtils.validateUserDetailsOnResponse(sdncUserDetails,
+ // createUserResponse.getResponse());
+ // UserRestUtils.validateAddUserAuditMessage(sdncUserDetails, sdncAdminUser,
+ // String.valueOf(HttpStatus.SC_CREATED),
+ // UserResponseMessageEnum.SUCCESS_MESSAGE.getValue(),
+ // UserRestUtils.getAddUserAuditMessage("AddUser"));
+ // RestResponse getUserResponse = UserRestUtils.getUser(sdncUserDetails,
+ // sdncAdminUser);
+ // UserRestUtils.validateUserDetailsOnResponse(sdncUserDetails,
+ // getUserResponse.getResponse());
+ //
+ // }
+ //
+ // public void validateSuccessDeActivateUserResponse(User sdncUserDetails,
+ // RestResponse deActivateUserResponse) throws Exception{
+ //
+ // assertNotNull("check response object is not null after deActive user",
+ // deActivateUserResponse);
+ // assertNotNull("check error code exists in response after deActive user",
+ // deActivateUserResponse.getErrorCode());
+ // assertEquals("Check response code after deActive user", 200,
+ // deActivateUserResponse.getErrorCode().intValue());
+ //
+ // UserRestUtils.validateUserDetailsOnResponse(sdncUserDetails,
+ // deActivateUserResponse.getResponse());
+ // UserRestUtils.validateDeleteUserAuditMessage(sdncUserDetails,
+ // sdncAdminUser, "200", UserResponseMessageEnum.SUCCESS_MESSAGE.getValue(),
+ // UserRestUtils.getAddUserAuditMessage("DeleteUser"));
+ //
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
index 8684910a18..2a79539443 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/CreateUserApiTest.java
@@ -1006,7 +1006,250 @@ public class CreateUserApiTest extends ComponentBaseTest {
assertEquals("Check response code after deleting user", 200, deleteOpsUser.getErrorCode().intValue());
}
-
+
+ // create user with one optional parameter last name (UserID, Email, Last
+ // Name, Creator details)
+ // expected: role = DESIGNER, first name = null, 201 Created
+ // @Test
+ // public void createUserLastName(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user with one optional parameter role name (UserID, Email, Role
+ // = "TESTER", Creator details)
+ // // expected: first and last name = null, 201 Created
+ // @Test
+ // public void createUserRoleName(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user with two optional parameters first name and role (UserID,
+ // Email, First Name, Role = "ADMIN", Creator details)
+ // // expected: last name = null, 201 Created
+ // @Test
+ // public void createUserFirstNameAndRole(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user with two optional parameters first and last name(UserID,
+ // Email, First Name, Last name, Creator details)
+ // // expected: role = DESIGNER, 201 Created
+ // @Test
+ // public void createUserFirstAndLastName(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ //
+ //
+ //
+ // //
+ // **********************************************************Create*user*failed***************************************************
+ //
+ // //
+ // **********************************************************403***************************************************
+ // // create default user without creator details (UserID, Email)
+ // // expected: 403 Forbidden, error message:"Error : Missing information"
+ // @Test
+ // public void createDefaultUserNonCreatorDetails(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create user with part of creator details (UserID, Email, First name,
+ // Last Name, Role, Part of creator details)
+ // // expected: 403 Forbidden, error message:"Error : Missing information"
+ // @Test
+ // public void createUserPartOfCreatorDetails(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user with full parameter set, non admin creator(UserID, First
+ // Name, Last Name, Email, Role, Creator details)
+ // // expected: 403 Forbidden, error message:
+ // "Error : Restricted operation"
+ // @Test
+ // public void createUserNonAdminCreator(){
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // //
+ // **********************************************************405***************************************************
+ //
+ // // create user with full parameter set by sending http PUT request
+ // (UserID, First Name, Last Name, Email, Role, Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createUserPutRequest(){
+ // // send PUT create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create default user by sending http PUT request (UserID, Email,
+ // Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createDefaultUserPutRequest(){
+ // // send PUT create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create user with full parameter set by sending http DELETE request
+ // (UserID, First Name, Last Name, Email, Role, Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createUserDeleteRequest(){
+ // // send DELETE create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create default user by sending http DELETE request (UserID, Email,
+ // Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createDefaultUserDeleteRequest(){
+ // // send DELETE create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create user with full parameter set by sending http GET request
+ // (UserID, First Name, Last Name, Email, Role, Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createUserGetRequest(){
+ // // send GET create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // // create default user by sending http GET request (UserID, Email,
+ // Creator details)
+ // // expected: 405 not Allowed, error message:
+ // "Error : Method not allowed"
+ // @Test
+ // public void createDefaultUserGetRequest(){
+ // // send GET create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // //
+ // **********************************************************409***************************************************
+ //
+ // // create the same user twice with full parameter set(UserID, First Name,
+ // Last Name, Email, Role, Creator details)
+ // // expected 409 Conflict, error message:
+ // "Error : User with '%s' ID already exists", where: %s - UserId
+ // @Test
+ // public void createSameUserTwice(){
+ // // send POST create user request
+ // // validate data on response
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user twice, first full details (UserID, First Name, Last Name,
+ // Email, Role, Creator details), second default user (UserID, Email, Role,
+ // Creator details)
+ // // expected 409 Conflict, error message:
+ // "Error : User with '%s' ID already exists", where: %s - UserId
+ // @Test
+ // public void createFullThanDefaultUserTwice(){
+ // // send POST create user request
+ //
+ // // validate data on response
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create user twice, first default user (UserID, Email, Role, Creator
+ // details), second full details (UserID, First Name, Last Name, Email,
+ // Role, Creator details)
+ // // expected 409 Conflict, error message:
+ // "Error : User with '%s' ID already exists", where: %s - UserId
+ // @Test
+ // public void createDefaulThanFullUserTwice(){
+ // // send POST create user request
+ //
+ // // validate data on response
+ // // send POST create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ //
+ // //
+ // **********************************************************400***************************************************
+ // // create default user with invalid email address format(UserID, Email,
+ // Creator details)
+ // // expected: 400, error message:
+ // "Error : Invalid Content . Invalid e-mail address '%s'", where %s -
+ // email address
+ // @Test
+ // public void createDefaultUserInvalidEmailAddressFormat(){
+ // // send GET create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // // create an user with invalid role type (UserID, Email,Role = "TESTER-1"
+ // ,Creator details)
+ // // expected: 400, error message:
+ // "Error : Invalid Content . Invalid role '%s'", where %s - role type
+ // @Test
+ // public void createUserInvalidRoleType(){
+ // // send GET create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+ // //
+ // **********************************************************500***************************************************
+ // // create default user when BE is down (UserID, Email, Creator details)
+ // // expected: 500, error message:
+ // "Error : Internal Server Error . Try later again."
+ // @Test
+ // public void createDefaultUserBeNoAccess(){
+ // // send GET create user request
+ // // validate data on response
+ // // check the audit message
+ // }
+ //
+
+ // Benny US570551
+
@Test
public void createProductManagerUser() throws Exception {
String httpCspUserId = "pm1000";
@@ -1184,7 +1427,6 @@ public class CreateUserApiTest extends ComponentBaseTest {
noSdncUserDetails.setRole("blabla");
noSdncUserDetails.setUserId("bt750h");
User expectedProductStrategistUser = new User(userFirstName, userLastName, httpCspUserId, email, role, null);
-
DbUtils.deleteFromEsDbByPattern("_all");
// create user
RestResponse createUserResponse = UserRestUtils.createUser(expectedProductStrategistUser, noSdncUserDetails);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
index a7552ad3be..9a7f68264f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java
@@ -47,7 +47,9 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
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.execute.lifecycle.LCSbaseTest;
import org.openecomp.sdc.ci.tests.utils.DbUtils;
+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.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
@@ -125,47 +127,10 @@ public class GovernorWorkspaceApiTest extends ComponentBaseTest {
tags = serviceDetails33.getTags();
tags.add(serviceDetails33.getName());
serviceDetails33.setTags(tags);
- //
- // serviceUtils.deleteService_allVersions(serviceDetails11, designer1);
- // serviceUtils.deleteService_allVersions(serviceDetails22, designer1);
- // serviceUtils.deleteService_allVersions(serviceDetails33, designer1);
-
+
RestResponse createServiceResponse1 = createService(user, serviceDetails11);
RestResponse createServiceResponse2 = createService(user, serviceDetails22);
RestResponse createServiceResponse3 = createService(user, serviceDetails33);
-
- // addResourceWithHeatArt();
- //
- // serviceUtils.addServiceMandatoryArtifacts(user,
- // createServiceResponse1);
- //
- //
- // RestResponse createServiceResponse2 =
- // serviceUtils.createServiceTowardsCatalogBe(serviceDetails22, user);
- // assertNotNull("check response object is not null after creating
- // service", createServiceResponse2);
- // assertNotNull("check if error code exists in response after creating
- // service", createServiceResponse2.getErrorCode());
- // assertEquals("Check response code after creating service", 201,
- // createServiceResponse2.getErrorCode().intValue());
- // serviceDetails22.setUniqueId(serviceUtils.getServiceUniqueId(createServiceResponse2));
- // logger.debug("Created service2 = {}", serviceDetails22);
- // serviceUtils.addServiceMandatoryArtifacts(user,
- // createServiceResponse2);
- //
- // RestResponse createServiceResponse3 =
- // serviceUtils.createServiceTowardsCatalogBe(serviceDetails33, user);
- // assertNotNull("check response object is not null after creating
- // service", createServiceResponse3);
- // assertNotNull("check if error code exists in response after creating
- // service", createServiceResponse3.getErrorCode());
- // assertEquals("Check response code after creating service", 201,
- // createServiceResponse3.getErrorCode().intValue());
- // serviceDetails33.setUniqueId(serviceUtils.getServiceUniqueId(createServiceResponse3));
- // logger.debug("Created service3 = {}", serviceDetails33);
- // serviceUtils.addServiceMandatoryArtifacts(user,
- // createServiceResponse3);
-
}
protected RestResponse createService(User user, ServiceReqDetails serviceDetails) throws Exception, IOException {
@@ -178,7 +143,7 @@ public class GovernorWorkspaceApiTest extends ComponentBaseTest {
Service convertServiceResponseToJavaObject = ResponseParser
.convertServiceResponseToJavaObject(createServiceResponse1.getResponse());
serviceDetails.setUniqueId(convertServiceResponseToJavaObject.getUniqueId());
- logger.debug("Created service1 = {}", serviceDetails);
+ logger.debug("Created service1 ={}",serviceDetails);
addResourceWithHeatArt(serviceDetails);
return createServiceResponse1;
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/CommonMigrationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/CommonMigrationUtils.java
new file mode 100644
index 0000000000..e142e4caa3
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/CommonMigrationUtils.java
@@ -0,0 +1,19 @@
+package org.openecomp.sdc.ci.tests.migration.v1707;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
+public class CommonMigrationUtils {
+
+ public static void assertKeyNotExist(TitanGraph graph, String key) {
+ assertNull(graph.getPropertyKey(key));
+ }
+
+ public static void assertKeyExists(TitanGraph graph, String key) {
+ assertNotNull(graph.getPropertyKey(key));
+ }
+
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/postupgrade/AttKeyPropertiesRenameTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/postupgrade/AttKeyPropertiesRenameTest.java
new file mode 100644
index 0000000000..95fc068dd3
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/postupgrade/AttKeyPropertiesRenameTest.java
@@ -0,0 +1,71 @@
+package org.openecomp.sdc.ci.tests.migration.v1707.postupgrade;
+
+import com.thinkaurelius.titan.core.TitanVertex;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils;
+import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+public class AttKeyPropertiesRenameTest extends ComponentBaseTest {
+
+ @Rule
+ public static TestName name = new TestName();
+
+
+ public AttKeyPropertiesRenameTest() {
+ super(name, AttKeyPropertiesRenameTest.class.getName());
+ }
+
+ @Test
+ public void verifyAttPropertyKeys() throws Exception {
+ initGraph();
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "attContact");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "attCreator");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "attuid");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "pmatt");
+
+ CommonMigrationUtils.assertKeyExists(titanGraph, "userId");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "projectCode");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "contactId");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "creatorId");
+
+ verifyPropertyKeysVerticesSameAsPreUpgrade("attuid", "userId");
+ verifyPropertyKeysVerticesSameAsPreUpgrade("pmatt", "projectCode");
+ verifyPropertyKeysVerticesSameAsPreUpgrade("attContact", "contactId");
+ verifyPropertyKeysVerticesSameAsPreUpgrade("attCreator", "creatorId");
+
+ }
+
+ private void assertKeyNotExist(String key) {
+ assertNotNull(titanGraph.getPropertyKey(key));
+ }
+
+ private void assertKeyExists(String key) {
+ assertNull(titanGraph.getPropertyKey(key));
+ }
+
+ private void verifyPropertyKeysVerticesSameAsPreUpgrade(String oldPropertyKEyName, String newPropertyKeyName) throws IOException {
+ List<String> verticesIdsFromGraph = getVerticesIdsFromGRaph(newPropertyKeyName);
+ List<String> verticesIdsFromFile = GraphFileUtils.getVerticesIdsFromFile(oldPropertyKEyName);
+ Collections.sort(verticesIdsFromFile);
+ Collections.sort(verticesIdsFromGraph);
+ assertEquals(verticesIdsFromFile, verticesIdsFromGraph);
+ }
+
+ private List<String> getVerticesIdsFromGRaph(String newPropertyKeyName) {
+ Iterable<TitanVertex> vertices = titanGraph.query().has(newPropertyKeyName).vertices();
+ assertTrue(vertices.iterator().hasNext());
+ List<String> verticesIdsFromGraph = new ArrayList<>();
+ vertices.forEach(vertex -> verticesIdsFromGraph.add(vertex.id().toString()));
+ return verticesIdsFromGraph;
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/preupgrade/AttKeyPropertiesBeforeRenameTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/preupgrade/AttKeyPropertiesBeforeRenameTest.java
new file mode 100644
index 0000000000..3b4f6349a7
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/migration/v1707/preupgrade/AttKeyPropertiesBeforeRenameTest.java
@@ -0,0 +1,49 @@
+package org.openecomp.sdc.ci.tests.migration.v1707.preupgrade;
+
+import com.thinkaurelius.titan.core.TitanVertex;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils;
+import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+
+import static org.testng.Assert.assertTrue;
+
+public class AttKeyPropertiesBeforeRenameTest extends ComponentBaseTest {
+
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public AttKeyPropertiesBeforeRenameTest() {
+ super(name, AttKeyPropertiesBeforeRenameTest.class.getName());
+ }
+
+ @Test
+ public void verifyAttPropertyKeys() throws Exception {
+ initGraph();
+ CommonMigrationUtils.assertKeyExists(titanGraph, "attContact");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "attCreator");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "attuid");
+ CommonMigrationUtils.assertKeyExists(titanGraph, "pmatt");
+
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "userId");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "projectCode");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "contactId");
+ CommonMigrationUtils.assertKeyNotExist(titanGraph, "creatorId");
+
+ saveVerticesWithPropertyKeyToFile("attContact");
+ saveVerticesWithPropertyKeyToFile("attCreator");
+ saveVerticesWithPropertyKeyToFile("attuid");
+ saveVerticesWithPropertyKeyToFile("pmatt");
+ }
+
+ private void saveVerticesWithPropertyKeyToFile(String propertyKey) throws IOException {
+ Iterable<TitanVertex> vertices = titanGraph.query().has(propertyKey).vertices();
+ assertTrue(vertices.iterator().hasNext());
+ GraphFileUtils.writeVerticesUIDToFile(propertyKey, vertices);
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/rules/MyTestWatcher.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/rules/MyTestWatcher.java
index aa6131c8ff..799309e55d 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/rules/MyTestWatcher.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/rules/MyTestWatcher.java
@@ -22,13 +22,13 @@ package org.openecomp.sdc.ci.tests.rules;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
-import org.openecomp.sdc.ci.tests.api.SdcTest;
+import org.openecomp.sdc.ci.tests.api.AttSdcTest;
public class MyTestWatcher extends TestWatcher {
- SdcTest odlTest;
+ AttSdcTest odlTest;
- public MyTestWatcher(SdcTest odlTest) {
+ public MyTestWatcher(AttSdcTest odlTest) {
this.odlTest = odlTest;
}
@@ -65,7 +65,7 @@ public class MyTestWatcher extends TestWatcher {
protected void starting(Description description) {
// System.out.println("protected void starting(Description description)
// {");
- this.odlTest.getLogger().debug("Start running test {}", description.getMethodName());
+ this.odlTest.getLogger().debug("Start running test {}",description.getMethodName());
}
/**
@@ -77,6 +77,6 @@ public class MyTestWatcher extends TestWatcher {
protected void finished(Description description) {
// System.out.println("protected void finished(Description description)
// {");
- this.odlTest.getLogger().debug("Finish running test {}", description.getMethodName());
+ this.odlTest.getLogger().debug("Finish running test {}",description.getMethodName());
}
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/ExtentReporterNG.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/ExtentReporterNG.java
deleted file mode 100644
index 5119263032..0000000000
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/ExtentReporterNG.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.ci.tests.run;
-
-import java.io.File;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.IReporter;
-import org.testng.IResultMap;
-import org.testng.ISuite;
-import org.testng.ISuiteResult;
-import org.testng.ITestContext;
-import org.testng.ITestResult;
-import org.testng.xml.XmlSuite;
-
-import com.relevantcodes.extentreports.ExtentReports;
-import com.relevantcodes.extentreports.ExtentTest;
-import com.relevantcodes.extentreports.LogStatus;
-
-public class ExtentReporterNG implements IReporter {
- private ExtentReports extent;
-
- @Override
- public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
- extent = new ExtentReports(outputDirectory + File.separator + "ExtentReportsTestNG.html", true);
-
- for (ISuite suite : suites) {
- Map<String, ISuiteResult> result = suite.getResults();
-
- for (ISuiteResult r : result.values()) {
- ITestContext context = r.getTestContext();
-
- buildTestNodes(context.getPassedTests(), LogStatus.PASS);
- buildTestNodes(context.getFailedTests(), LogStatus.FAIL);
- buildTestNodes(context.getSkippedTests(), LogStatus.SKIP);
- }
- }
-
- extent.flush();
- extent.close();
- }
-
- private void buildTestNodes(IResultMap tests, LogStatus status) {
- ExtentTest test;
-
- if (tests.size() > 0) {
- for (ITestResult result : tests.getAllResults()) {
- test = extent.startTest(result.getMethod().getMethodName());
-
- test.getTest().setStartedTime(getTime(result.getStartMillis()));
- test.getTest().setEndedTime(getTime(result.getEndMillis()));
-
- for (String group : result.getMethod().getGroups())
- test.assignCategory(group);
-
- String message = "Test " + status.toString().toLowerCase() + "ed";
-
- if (result.getThrowable() != null)
- message = result.getThrowable().getMessage();
-
- test.log(status, message);
-
- extent.endTest(test);
- }
- }
- }
-
- private Date getTime(long millis) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(millis);
- return calendar.getTime();
- }
-}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
index 3f895a3780..338adfd094 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java
@@ -42,6 +42,8 @@ import org.testng.TestNG;
public class StartTest {
+ // private List<Class<? extends AttSdcTest>> testClasses = new
+ // ArrayList<Class<? extends AttSdcTest>>();
public static long timeOfTest = 0;
public static boolean debug = false;
@@ -73,50 +75,14 @@ public class StartTest {
System.exit(1);
}
- // need to update
- // List<String> packagesToRun = config.getPackages();
- // if (packagesToRun == null || true == packagesToRun.isEmpty()) {
- // logger.error("No package was configured to be executed.");
- // System.exit(2);
- // }
- // StartTest tests = new StartTest();
-
- // stop on error logic
- // boolean stopOnClassFailure = false;
- // String stopOnClassFailureStr =
- // System.getProperty("stopOnClassFailure");
- // if (stopOnClassFailureStr != null &&
- // stopOnClassFailureStr.equalsIgnoreCase("true")) {
- // stopOnClassFailure = true;
- // } else {
- // Boolean stopOnClassFailureObj = config.isStopOnClassFailure();
- // if (stopOnClassFailureObj != null) {
- // stopOnClassFailure = stopOnClassFailureObj.booleanValue();
- // }
- // }
- //
-
- // tests.start(packagesToRun, stopOnClassFailure);
-
- // TestListenerAdapter tla = new TestListenerAdapter();
- //
- // TestHTMLReporter report = new TestHTMLReporter();
- //// report.
-
TestNG testng = new TestNG();
List<String> suites = new ArrayList<String>();
suites.add("testSuites/" + args[0]);
testng.setTestSuites(suites);
- // testng.addListener(tla);
testng.setUseDefaultListeners(true);
testng.setOutputDirectory("target/");
- StartTest tests = new StartTest();
- // testng.setPreserveOrder(true);
- // testng.setVerbose(2);
- // testng.setSuiteThreadPoolSize(1);
- // testng.setThreadCount(1);
testng.run();
}
@@ -145,10 +111,6 @@ public class StartTest {
}
}
- // logger.debug("Going to run test class {}", testClass.getName());
- // logger.debug("Test class {} finished {}", testClass.getName(), (result.wasSuccessful() ? "OK." : " WITH ERROR."));
- // logger.debug("class {} failed tests: {}", testClass.getName(), (failuresPerClass * 1.0) / runsPerClass * 100 + " %");
- // logger.debug("class {} ignored tests: {}", testClass.getName(), (ignoredPerClass * 1.0) / runsPerClass * 100 + " %");
private List<Class> getClassesForPackage(String pkgname) {
List<Class> classes = new ArrayList<Class>();
@@ -290,4 +252,22 @@ public class StartTest {
results.append("</tr>");
}
+ // private void addUnitTestResult(StringBuilder results,
+ // Class<? extends AttSdcTest> testClass, Result unitTestResult) {
+ //
+ // boolean isSuccess = unitTestResult.wasSuccessful();
+ //
+ // String result = (isSuccess) ? "success" : "fail";
+ // String fileName = FileUtils.getFileName(testClass.getName());
+ // results.append("<tr>");
+ // //
+ // results.append("<td>").append(FileUtils.getFileName(testClass.getName())).append("</td>");
+ // results.append("<td class=\"name\">")
+ // .append("<a href=\"" + fileName + timeOfTest + ".html\">"
+ // + fileName + "</a>").append("</td>");
+ // results.append("<td class=\"" + result + "\">").append(result)
+ // .append("</td>");
+ // results.append("</tr>");
+ // }
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
index bab5afaa08..56ddc196cb 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java
@@ -40,7 +40,7 @@ import org.apache.log4j.PropertyConfigurator;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
-import org.openecomp.sdc.ci.tests.api.SdcTest;
+import org.openecomp.sdc.ci.tests.api.AttSdcTest;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory;
public class StartTest2backup {
- private List<Class<? extends SdcTest>> testClasses = new ArrayList<Class<? extends SdcTest>>();
+ private List<Class<? extends AttSdcTest>> testClasses = new ArrayList<Class<? extends AttSdcTest>>();
public static long timeOfTest = 0;
public static boolean debug = false;
@@ -170,7 +170,7 @@ public class StartTest2backup {
int totalFailureTests = 0;
int totalIgnoreTests = 0;
int numOfFailureClasses = 0;
- for (Class<? extends SdcTest> testClass : testClasses) {
+ for (Class<? extends AttSdcTest> testClass : testClasses) {
index++;
@@ -187,18 +187,17 @@ public class StartTest2backup {
System.out.println(builder.toString());
logger.debug(builder.toString());
- logger.debug("Going to run test class {}", testClass.getName());
+ logger.debug("Going to run test class {}",testClass.getName());
result = JUnitCore.runClasses(testClass);
if (result.wasSuccessful() == false) {
numOfFailureClasses++;
}
- logger.debug("Test class {} finished {}", testClass.getName(), (result.wasSuccessful() ? "OK." : " WITH ERROR."));
+ logger.debug("Test class {} finished {}",testClass.getName(),(result.wasSuccessful() ? "OK." : " WITH ERROR."));
List<Failure> failures = result.getFailures();
if (failures != null) {
for (Failure failure : failures) {
- logger.error("Test class " + testClass.getName() + " failure test " + failure.getTestHeader() + "-"
- + failure.getTrace());
+ logger.error("Test class {} failure test {}-{}",testClass.getName(),failure.getTestHeader(),failure.getTrace());
}
}
int runsPerClass = result.getRunCount();
@@ -209,8 +208,10 @@ public class StartTest2backup {
totalFailureTests += failuresPerClass;
totalIgnoreTests += ignoredPerClass;
- logger.debug("class {} failed tests: {}", testClass.getName(), (failuresPerClass * 1.0) / runsPerClass * 100 + " %");
- logger.debug("class {} ignored tests: {}", testClass.getName(), (ignoredPerClass * 1.0) / runsPerClass * 100 + " %");
+ logger.debug("class {} Failed tests {} %",testClass.getName(),
+ (failuresPerClass * 1.0) / runsPerClass * 100);
+ logger.debug("class {} Ignored tests {} %",testClass.getName(),
+ (ignoredPerClass * 1.0) / runsPerClass * 100);
// List<Failure> failures = result.getFailures();
// if (failures != null) {
@@ -242,9 +243,8 @@ public class StartTest2backup {
if (!success) {
System.out.println("FAILURE");
- logger.error("Failure tests : "
- + ((totalFailureTests + totalIgnoreTests) * 1.0) / (totalRunTests + totalIgnoreTests) + " %");
- logger.error("Ignored tests : " + (totalIgnoreTests * 1.0) / (totalRunTests + totalIgnoreTests) + " %");
+ logger.error("Failure tests : {} %",((totalFailureTests + totalIgnoreTests) * 1.0) / (totalRunTests + totalIgnoreTests));
+ logger.error("Ignored tests : {} %",(totalIgnoreTests * 1.0) / (totalRunTests + totalIgnoreTests));
System.exit(1);
}
@@ -392,7 +392,7 @@ public class StartTest2backup {
results.append("</tr>");
}
- private void addUnitTestResult(StringBuilder results, Class<? extends SdcTest> testClass,
+ private void addUnitTestResult(StringBuilder results, Class<? extends AttSdcTest> testClass,
Result unitTestResult) {
boolean isSuccess = unitTestResult.wasSuccessful();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
index 00ff48e887..b676b29bda 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/CrudE2E.java
@@ -88,71 +88,85 @@ public class CrudE2E extends ComponentBaseTest {
User designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
//////// create defaultService1 ///////////////////////
+
Either<Service, RestResponse> createDefaultService1e = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
defaultService1 = createDefaultService1e.left().value();
//////// create VFC1 (resourceDetailsVFCcomp_01) DerivedFrom COMPUTE
//////// type add all possible informational artifacts and change state
//////// to CERTIFY////////
- Either<Resource, RestResponse> resourceDetailsVFCcompE = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.COMPUTE,ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> resourceDetailsVFCcompE = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.COMPUTE, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER,
+ true);
resourceDetailsVFCcomp_01 = resourceDetailsVFCcompE.left().value();
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.CHEF, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.PUPPET, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.DG_XML, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.MURANO_PKG, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVFCcomp_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.changeComponentState(resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER,LifeCycleStatesEnum.CERTIFY, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.CHEF, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.PUPPET, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.SHELL_SCRIPT,
+ // resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT,
+ // resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.DG_XML, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.MURANO_PKG, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.changeComponentState(resourceDetailsVFCcomp_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
//////// create VFC2 (resourceDetailsVFCsoft_01) DerivedFrom SOFTWARE
//////// type and change state to CERTIFY////////
- Either<Resource, RestResponse> resourceDetailsVFCsoftE = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.SOFTWARE_COMPONENT,ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> resourceDetailsVFCsoftE = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.SOFTWARE_COMPONENT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER,
+ true);
resourceDetailsVFCsoft_01 = resourceDetailsVFCsoftE.left().value();
- AtomicOperationUtils.changeComponentState(resourceDetailsVFCsoft_01, UserRoleEnum.DESIGNER,LifeCycleStatesEnum.CERTIFY, true);
+ AtomicOperationUtils.changeComponentState(resourceDetailsVFCsoft_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
//////// create CP1 (resourceDetailsVFCsoft_01) DerivedFrom PORT type
//////// and change state to CHECKIN////////
- Either<Resource, RestResponse> resourceDetailsCP_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.PORT,ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> resourceDetailsCP_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.PORT, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true);
resourceDetailsCP_01 = resourceDetailsCP_01e.left().value();
- AtomicOperationUtils.changeComponentState(resourceDetailsCP_01, UserRoleEnum.DESIGNER,LifeCycleStatesEnum.CHECKIN, true);
+ AtomicOperationUtils.changeComponentState(resourceDetailsCP_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
//////// create VL1 (resourceDetailsVFCsoft_01) DerivedFrom NETWORK type
//////// and change state to CERTIFY////////
- Either<Resource, RestResponse> resourceDetailsVL_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VL, NormativeTypesEnum.NETWORK,ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> resourceDetailsVL_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VL, NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS, UserRoleEnum.DESIGNER,
+ true);
resourceDetailsVL_01 = resourceDetailsVL_01e.left().value();
- AtomicOperationUtils.changeComponentState(resourceDetailsVL_01, UserRoleEnum.DESIGNER,LifeCycleStatesEnum.CERTIFY, true);
+ AtomicOperationUtils.changeComponentState(resourceDetailsVL_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
//////// create VF1 (resourceDetailsVFCcomp_01) DerivedFrom COMPUTE type
//////// add all possible deployment and informational artifacts
//////// //////////
- Either<Resource, RestResponse> resourceDetailsVF_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT,ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
+ Either<Resource, RestResponse> resourceDetailsVF_01e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
resourceDetailsVF_01 = resourceDetailsVF_01e.left().value();
ArtifactDefinition heatArtifact = AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true).left().value();
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT_VOL, resourceDetailsVF_01,UserRoleEnum.DESIGNER, true, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT_NET, resourceDetailsVF_01,UserRoleEnum.DESIGNER, true, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVF_01, UserRoleEnum.DESIGNER,true, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.CHEF, resourceDetailsVF_01, UserRoleEnum.DESIGNER,false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.PUPPET, resourceDetailsVF_01, UserRoleEnum.DESIGNER,false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG, resourceDetailsVF_01, UserRoleEnum.DESIGNER,false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceDetailsVF_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.DG_XML, resourceDetailsVF_01, UserRoleEnum.DESIGNER,false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.MURANO_PKG, resourceDetailsVF_01,UserRoleEnum.DESIGNER, false, true);
- AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVF_01, UserRoleEnum.DESIGNER,false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT_VOL, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT_NET, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true, true);
+
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.CHEF, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.PUPPET, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.SHELL_SCRIPT,
+ // resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.YANG_XML, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ // AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.HEAT,
+ // resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.DG_XML, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.MURANO_PKG, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
+ AtomicOperationUtils.uploadArtifactByType(ArtifactTypeEnum.OTHER, resourceDetailsVF_01, UserRoleEnum.DESIGNER, false, true);
//////// Add VFC1 VFC2 CP and VL to VF container /////////////
- resourceDetailsVFC1compIns1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCcomp_01, resourceDetailsVF_01,UserRoleEnum.DESIGNER, true).left().value();
- resourceDetailsVFC1softIns1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCsoft_01, resourceDetailsVF_01,UserRoleEnum.DESIGNER, true).left().value();
- resourceDetailsCP1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsCP_01,resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
- resourceDetailsVL1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVL_01,resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
+ resourceDetailsVFC1compIns1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCcomp_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
+ resourceDetailsVFC1softIns1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVFCsoft_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
+ resourceDetailsCP1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsCP_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
+ resourceDetailsVL1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVL_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true).left().value();
//////// associate cp-vl vl-vfcComp and vfcComp-vfcSoft////////
resourceDetailsVF_01 = AtomicOperationUtils.getResourceObject(resourceDetailsVF_01, UserRoleEnum.DESIGNER);
- AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01,resourceDetailsVL1ins_01, AssocType.LINKABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
- AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01,resourceDetailsVFC1compIns1, AssocType.BINDABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
- AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsVFC1compIns1,resourceDetailsVFC1softIns1, AssocType.NODE.getAssocType(), UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsVL1ins_01, AssocType.LINKABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsVFC1compIns1, AssocType.BINDABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsVFC1compIns1, resourceDetailsVFC1softIns1, AssocType.NODE.getAssocType(), UserRoleEnum.DESIGNER, true);
//////// download all VF1 artifacts////////
+
Collection<ArtifactDefinition> artifacts = resourceDetailsVF_01.getDeploymentArtifacts().values();
List<String> collect = artifacts.stream().filter(p -> p.checkEsIdExist() == true).map(p -> p.getUniqueId()).collect(Collectors.toList());
artifacts.stream().filter(p -> p.checkEsIdExist() == true).map(p -> p.getUniqueId()).forEach(item -> log.debug(item));
@@ -161,30 +175,49 @@ public class CrudE2E extends ComponentBaseTest {
Collection<List<ComponentInstanceProperty>> componentInstancesProperties = resourceDetailsVF_01.getComponentInstancesProperties().values();
List<String> collect2 = componentInstancesProperties.stream().filter(p -> p.isEmpty() == false).flatMap(l -> l.stream()).collect(Collectors.toList()).stream().map(p -> p.getUniqueId()).collect(Collectors.toList());
-
+ // PropertyRestUtils.updateProperty(resourceDetailsVF_01.getUniqueId(),
+ // propertyId, "1", designer);
+ // .forEach((someOtherString) -> {
+ // System.out.println("Content With Java: " + someOtherString);
+ // });
+ // componentInstancesProperties.stream().filter(p ->
+ // p.isEmpty()==false).flatMap(l -> l.stream()).map(e ->
+ // e.getUniqueId());
+ // resourceDetailsVF_01.getComponentInstancesProperties().
+
+ // ArtifactDefinition artifactDefinition =
+ // resourceDetailsVF_01.getDeploymentArtifacts().get(ArtifactTypeEnum.HEAT.getType().toLowerCase()).getEsId();
+ // ArtifactDefinition artifactDefinition =
+ // resource.getDeploymentArtifacts().get(depResArtType);
+ // ArtifactReqDetails artifacJavaObject =
+ // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifactDefinition);
+ // ArtifactRestUtils.updateDeploymentArtifactToRI(artifactDetails,
+ // sdncModifierDetails, resourceInstanceId, serviceId)
+
//////// certify VF1 - failed due to uncertified CP instance ////////
- RestResponse changeVfStateFailed = LifecycleRestUtils.changeComponentState(resourceDetailsVF_01, designer,LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+
+ RestResponse changeVfStateFailed = LifecycleRestUtils.changeComponentState(resourceDetailsVF_01, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
Resource resResourceDetailsVF_01 = (Resource) resourceDetailsVF_01;
- variablesAsList = Arrays.asList(resResourceDetailsVF_01.getResourceType().toString(),resourceDetailsCP_01.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList,changeVfStateFailed.getResponse());
+ variablesAsList = Arrays.asList(resResourceDetailsVF_01.getResourceType().toString(), resourceDetailsCP_01.getName());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList, changeVfStateFailed.getResponse());
//////// certify resources CP1 ////////
resourceDetailsCP_01 = AtomicOperationUtils.changeComponentState(resourceDetailsCP_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
//////// replace VF1 instances with new certified instances (CP1
//////// replaced) ////////
- Either<Pair<Component, ComponentInstance>, RestResponse> changeComponentInstanceVersion = AtomicOperationUtils.changeComponentInstanceVersion(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsCP_01,UserRoleEnum.DESIGNER, true);
+ Either<Pair<Component, ComponentInstance>, RestResponse> changeComponentInstanceVersion = AtomicOperationUtils.changeComponentInstanceVersion(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsCP_01, UserRoleEnum.DESIGNER, true);
resourceDetailsVF_01 = changeComponentInstanceVersion.left().value().getLeft();
resourceDetailsCP1ins_01 = changeComponentInstanceVersion.left().value().getRight();
//////// associate cp-vl and cp-vfc1,////////
- AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01,resourceDetailsVL1ins_01, AssocType.LINKABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
- AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01,resourceDetailsVFC1compIns1, AssocType.BINDABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsVL1ins_01, AssocType.LINKABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
+ AtomicOperationUtils.associate2ResourceInstances(resourceDetailsVF_01, resourceDetailsCP1ins_01, resourceDetailsVFC1compIns1, AssocType.BINDABLE.getAssocType(), UserRoleEnum.DESIGNER, true);
/////// change VF1 state to CHECK-IN and add it as instance to service1
/////// container
resourceDetailsVF_01 = AtomicOperationUtils.changeComponentState(resourceDetailsVF_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
- resourceDetailsVF1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVF_01,defaultService1, UserRoleEnum.DESIGNER, true).left().value();
+ resourceDetailsVF1ins_01 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceDetailsVF_01, defaultService1, UserRoleEnum.DESIGNER, true).left().value();
//////// distribute service1 - failed due to incorrect LifeCyclestatus
//////// ////////
@@ -193,15 +226,15 @@ public class CrudE2E extends ComponentBaseTest {
//////// certify service1 - failed due to uncertified instances ////////
designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- RestResponse changeServicetStateFailed = LifecycleRestUtils.changeComponentState(defaultService1, designer,LifeCycleStatesEnum.CERTIFICATIONREQUEST);
- variablesAsList = Arrays.asList(defaultService1.getComponentType().toString().toLowerCase(),resourceDetailsVF_01.getName());
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList,changeServicetStateFailed.getResponse());
+ RestResponse changeServicetStateFailed = LifecycleRestUtils.changeComponentState(defaultService1, designer, LifeCycleStatesEnum.CERTIFICATIONREQUEST);
+ variablesAsList = Arrays.asList(defaultService1.getComponentType().toString().toLowerCase(), resourceDetailsVF_01.getName());
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name(), variablesAsList, changeServicetStateFailed.getResponse());
////// change VF1 state to CERTIFIED
resourceDetailsVF_01 = AtomicOperationUtils.changeComponentState(resourceDetailsVF_01, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
//////// replace VF1 instances with new certified instances ////////
- changeComponentInstanceVersion = AtomicOperationUtils.changeComponentInstanceVersion(defaultService1,resourceDetailsVF1ins_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true);
+ changeComponentInstanceVersion = AtomicOperationUtils.changeComponentInstanceVersion(defaultService1, resourceDetailsVF1ins_01, resourceDetailsVF_01, UserRoleEnum.DESIGNER, true);
resourceDetailsVF_01 = changeComponentInstanceVersion.left().value().getLeft();
resourceDetailsVFC1compIns1 = changeComponentInstanceVersion.left().value().getRight();
@@ -212,9 +245,43 @@ public class CrudE2E extends ComponentBaseTest {
AtomicOperationUtils.distributeService(defaultService1, true);
/////// create VF2 ////////
- Either<Resource, RestResponse> resourceDetailsVF_02e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT,ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
+
+ Either<Resource, RestResponse> resourceDetailsVF_02e = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true);
resourceDetailsVF_02 = resourceDetailsVF_02e.left().value();
}
+ // private void updateArtParameterInResource(Resource resource) throws
+ // IOException {
+ //
+ // ArtifactRestUtils.uploadArtifact(artifactDetails, component,
+ // sdncModifierDetails)
+ //
+ // for (String depResArtType : Utils.getListOfDepResArtLabels(true)) {
+ // ArtifactDefinition artifactDefinition =
+ // resource.getDeploymentArtifacts().get(depResArtType);
+ // ArtifactReqDetails artifacJavaObject =
+ // ResponseParser.convertArtifactDefinitionToArtifactReqDetailsObject(artifactDefinition);
+ //
+ // //update parameter
+ // List<HeatParameterDefinition> resourceHeatParameters =
+ // resource.getDeploymentArtifacts().get(depResArtType).getHeatParameters();
+ // for (HeatParameterDefinition heatParameterDefinition :
+ // resourceHeatParameters){
+ // if (heatParameterDefinition.getName().equals("address")){
+ // heatParameterDefinition.setCurrentValue("negev");
+ // break;
+ // }
+ // }
+ // artifacJavaObject.setHeatParameters(resourceHeatParameters);
+ // artifacJavaObject.setPayloadData(null);
+ // RestResponse updateInformationalArtifactToResource =
+ // ArtifactRestUtils.updateDeploymentArtifactToResource(artifacJavaObject,
+ // sdncDesignerDetails, resource.getUniqueId());
+ // assertTrue("response code is not 200, returned: " +
+ // updateInformationalArtifactToResource.getErrorCode(),updateInformationalArtifactToResource.getErrorCode()
+ // == 200);
+ // }
+ // }
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
index 8b8a793bc6..0a7b4a98aa 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java
@@ -20,14 +20,14 @@
package org.openecomp.sdc.ci.tests.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
@@ -43,6 +43,7 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertTrue;
public class MultipleResourceUpdate extends ComponentBaseTest {
@@ -57,14 +58,18 @@ public class MultipleResourceUpdate extends ComponentBaseTest {
public void simpleScenario() throws Exception {
// Creating VF and Resource instances
- Resource vf = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left().value();
+ Resource vf = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
+ .value();
Resource cp1 = AtomicOperationUtils
.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.PORT,
- ResourceCategoryEnum.NETWORK_CONNECTIVITY_CON_POINT, UserRoleEnum.DESIGNER, true).left().value();
- Resource cp2 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.CP, UserRoleEnum.DESIGNER, true).left().value();
+ ResourceCategoryEnum.NETWORK_CONNECTIVITY_CON_POINT, UserRoleEnum.DESIGNER, true)
+ .left().value();
+ Resource cp2 = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.CP, UserRoleEnum.DESIGNER, true)
+ .left().value();
Resource vl = AtomicOperationUtils
.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VL, NormativeTypesEnum.NETWORK,
- ResourceCategoryEnum.NETWORK_CONNECTIVITY_VIRTUAL_LINK, UserRoleEnum.DESIGNER, true).left().value();
+ ResourceCategoryEnum.NETWORK_CONNECTIVITY_VIRTUAL_LINK, UserRoleEnum.DESIGNER, true)
+ .left().value();
vf.getCreatorUserId();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
index 5ce4b8c618..766d4d9fd5 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
@@ -22,6 +22,11 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes;
import java.util.List;
+/**
+ * First Level tosca yml structure
+ * @author al714h
+ *
+ */
public class ToscaDefinition {
String toscaDefinitionVersion;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/users/UserResponseMessageEnum.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/users/UserResponseMessageEnum.java
index 4db52c2886..97a08479f8 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/users/UserResponseMessageEnum.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/users/UserResponseMessageEnum.java
@@ -21,20 +21,11 @@
package org.openecomp.sdc.ci.tests.users;
public enum UserResponseMessageEnum {
-
- SUCCESS_MESSAGE("OK"),
- MISSING_INFORMATION("Error: Missing information"),
- METHOD_NOT_ALLOWED("Error: Method not allowed"),
- RESTRICTED_OPERATION("Error: Restricted operation"),
- USER_ALREADY_EXISTS("Error: User with %s ID already exists"),
- INVALID_EMAIL("Error: Invalid Content. Invalid e-mail address %s"),
- INVALID_ROLE("Error: Invalid Content. Invalid role %s"),
- INVALID_CONTENT("Error: Invalid content"),
- USER_NOT_FOUND("Error: User with %s ID is not found"),
- INTERNAL_SERVER_ERROR("Error: Internal Server Error. Try later again"),
- ADMINISTARTOR_CAN_BE_DELETED("Error: Administrator can be deleted by other administrator only"),
- RESTRICTED_ACCESS("Error: Restricted access");
-
+
+ SUCCESS_MESSAGE("OK"), MISSING_INFORMATION("Error: Missing information"), METHOD_NOT_ALLOWED("Error: Method not allowed"), RESTRICTED_OPERATION("Error: Restricted operation"), USER_ALREADY_EXISTS("Error: User with %s ID already exists"),
+ INVALID_EMAIL("Error: Invalid Content. Invalid e-mail address %s"), INVALID_ROLE("Error: Invalid Content. Invalid role %s"), INVALID_CONTENT("Error: Invalid content"), USER_NOT_FOUND("Error: User with %s ID is not found"),
+ INTERNAL_SERVER_ERROR("Error: Internal Server Error. Try later again"), ADMINISTARTOR_CAN_BE_DELETED("Error: Administrator can be deleted by other administrator only"), RESTRICTED_ACCESS("Error: Restricted access");
+
String value;
private UserResponseMessageEnum(String value) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/ArtifactUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/ArtifactUtils.java
index 12f8ffe984..7a26403053 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/ArtifactUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/ArtifactUtils.java
@@ -20,12 +20,17 @@
package org.openecomp.sdc.ci.tests.utils;
+import org.apache.commons.codec.binary.Base64;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
public class ArtifactUtils {
-
+ /**
+ * Converts ArtifactReqDetails to ArtifactDefinition
+ * @param artifactReq
+ * @return
+ */
public static ArtifactDefinition convertArtifactReqToDefinition(ArtifactReqDetails artifactReq) {
ArtifactDefinition artifact = new ArtifactDefinition();
artifact.setArtifactLabel(artifactReq.getArtifactLabel());
@@ -40,4 +45,22 @@ public class ArtifactUtils {
return artifact;
}
+ /**
+ * Converts ArtifactDefinition to ArtifactReqDetails
+ * @param artifactDef
+ * @return
+ */
+ public static ArtifactReqDetails convertArtifactDefinitionToArtifactReqDetails( ArtifactDefinition artifactDef) {
+ ArtifactReqDetails artifactReq = new ArtifactReqDetails();
+ artifactReq.setArtifactLabel(artifactDef.getArtifactLabel());
+ artifactReq.setArtifactDisplayName(artifactDef.getArtifactDisplayName());
+ artifactReq.setArtifactGroupType(artifactDef.getArtifactGroupType().getType());
+ artifactReq.setArtifactType(artifactDef.getArtifactType().toUpperCase());
+ artifactReq.setArtifactName(artifactDef.getArtifactName());
+ artifactReq.setDescription(artifactDef.getDescription());
+ artifactReq.setUniqueId(artifactDef.getUniqueId());
+ artifactReq.setTimeout(artifactDef.getTimeout());
+ artifactReq.setPayload(Base64.encodeBase64String(artifactDef.getPayloadData()));
+ return artifactReq;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
index 22295cb451..de7fd7eaf7 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java
@@ -29,15 +29,7 @@ import java.util.Map.Entry;
import java.util.Set;
import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
-import org.openecomp.sdc.ci.tests.api.Urls;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject;
-import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@@ -51,27 +43,26 @@ import com.thinkaurelius.titan.core.TitanVertex;
import fj.data.Either;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject;
+import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+
public class DbUtils {
private static String titanConfigFilePath;
private static TitanGraph titanGraph;
public static void cleanAllAudits() throws IOException {
- // utils.deleteFromEsDbByPattern("_all");
- // deleteFromEsDbByPattern("auditingevents-*");
CassandraUtils.truncateAllTables("sdcaudit");
-
- // List <EsIndexTypeIdToDelete> auditIdArray = new
- // ArrayList<EsIndexTypeIdToDelete>();
- // auditIdArray = buildObjectArrayListByTypesIndex("auditingevents*",
- // "useraccessevent");
- //
- // logger.info("Starting to delete all service topologies from ES");
- // for (int i = 0; i < auditIdArray.size(); i ++){
- // EsIndexTypeIdToDelete esIndexTypeIdToDelete = auditIdArray.get(i);
- // utils.deleteFromEsDbByPattern(esIndexTypeIdToDelete.getIndex()+"/"+esIndexTypeIdToDelete.getType()+"/"+esIndexTypeIdToDelete.getId());
- //
- // }
}
public static RestResponse deleteFromEsDbByPattern(String patternToDelete) throws IOException {
@@ -81,8 +72,6 @@ public class DbUtils {
HttpRequest httpRequest = new HttpRequest();
RestResponse restResponse = httpRequest.httpSendDelete(url, null);
restResponse.getErrorCode();
- // System.out.println("URL to delete" + url);
- // System.out.println("response code" + restResponse.getErrorCode());
cleanAllAudits();
return restResponse;
@@ -94,9 +83,7 @@ public class DbUtils {
HttpRequest httpRequest = new HttpRequest();
RestResponse restResponse = httpRequest.httpSendGet(url, null);
restResponse.getErrorCode();
- // System.out.println("URL to get" + url);
- // System.out.println("response code" + restResponse.getErrorCode());
-
+
return restResponse;
}
@@ -137,7 +124,6 @@ public class DbUtils {
}
- //
private static TitanGraph getTitanGraph() {
if (titanGraph == null) {
titanGraph = TitanFactory.open(titanConfigFilePath);
@@ -288,8 +274,7 @@ public class DbUtils {
JsonObject jSourceObject = (JsonObject) jHitObject.get("_source");
auditParsedResp = gson.fromJson(jSourceObject, UserAuditJavaObject.class);
- // logger.debug("auditParsedResp: {}", auditParsedResp);
-
+
return auditParsedResp;
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java
new file mode 100644
index 0000000000..85b01e6d2b
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utils;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
+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.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+
+//
+//
+//
+// import static org.testng.AssertJUnit.assertTrue;
+// import static org.testng.AssertJUnit.assertEquals;
+// import static org.testng.AssertJUnit.assertNotNull;
+// import java.io.IOException;
+// import java.util.HashMap;
+// import java.util.Map;
+//
+// import org.apache.log4j.Logger;
+//
+// import org.openecomp.sdc.be.model.ArtifactDefinition;
+// import org.openecomp.sdc.ci.tests.api.Urls;
+// import org.openecomp.sdc.ci.tests.config.Config;
+// import
+// org.openecomp.sdc.ci.tests.executeOnUGN.distributionClient.ClientConfiguration;
+// import org.openecomp.sdc.ci.tests.http.HttpHeaderEnum;
+// import org.openecomp.sdc.ci.tests.http.RestResponse;
+// import org.openecomp.sdc.ci.tests.run.StartTest;
+// import com.google.gson.Gson;
+//
+ public class DistributionUtils {
+
+ final static String serviceDistributionSuffix = "/asdc/v1/catalog/services/";
+
+ public static ServiceDistributionStatus getLatestServiceDistributionObject(Service service) throws IOException, ParseException {
+ ServiceDistributionStatus serviceDistributionStatus = null;
+ RestResponse distributionServiceList = ServiceRestUtils.getDistributionServiceList(service, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ Map<Long, ServiceDistributionStatus> serviveDistributionStatusMap = ResponseParser.convertServiceDistributionStatusToObject(distributionServiceList.getResponse());
+ if(serviveDistributionStatusMap.size() != 0){
+ serviceDistributionStatus = getLatestServiceDistributionObjectFromMap(serviveDistributionStatusMap);
+ return serviceDistributionStatus;
+ }
+
+ return null;
+ }
+
+ public static ServiceDistributionStatus getLatestServiceDistributionObjectFromMap(Map<Long, ServiceDistributionStatus> serviceDistributionStatusMap) {
+
+ ServiceDistributionStatus serviceDistributionStatus = null;
+ if (serviceDistributionStatusMap.size() == 1 ){
+ for (Entry<Long, ServiceDistributionStatus> entry : serviceDistributionStatusMap.entrySet()) {
+ return entry.getValue();
+ }
+ }
+ else{
+ serviceDistributionStatus = getFilteredServiceDistributionObject(serviceDistributionStatusMap);
+ }
+
+ return serviceDistributionStatus;
+ }
+
+ private static ServiceDistributionStatus getFilteredServiceDistributionObject(Map<Long, ServiceDistributionStatus> serviceDistributionStatusMap) {
+
+ List<Long> list = new ArrayList<Long>();
+ list.addAll(serviceDistributionStatusMap.keySet());
+ Collections.sort(list);
+ return serviceDistributionStatusMap.get(list.get(list.size() - 1));
+ }
+
+ public static Map<String, String> getArtifactsMapOfDistributedService(Service service) throws Exception{
+
+ Map<String, String> expectedDistributionArtifactMap = new HashMap<String, String>();
+ expectedDistributionArtifactMap = addServiceDeploymentArtifactToMap(service, expectedDistributionArtifactMap);
+ expectedDistributionArtifactMap = addComponentInstancesDeploymentArtifactToMap(service, expectedDistributionArtifactMap);
+
+ return expectedDistributionArtifactMap;
+ }
+
+
+ public static Map<String, String> addServiceDeploymentArtifactToMap(Service service, Map<String, String> distributionArtifactMap){
+
+ Map<String, ArtifactDefinition> deploymentArtifacts = service.getDeploymentArtifacts();
+ if (deploymentArtifacts != null && deploymentArtifacts.size() > 0){
+ for(Entry<String, ArtifactDefinition> artifact : deploymentArtifacts.entrySet()){
+ String url = buildServiceDeploymentUrl(service, artifact.getValue().getArtifactName(), artifact.getValue().getArtifactUUID());
+ distributionArtifactMap.put(artifact.getKey(), url);
+ }
+ }
+
+ return distributionArtifactMap;
+ }
+
+ private static String buildServiceDeploymentUrl(Service service, String artifactName, String artifactUUID) {
+// format "/asdc/v1/catalog/services/" + service.getSystemName() + "/" + service.getVersion() + "/artifacts/AAI-" + service.getName() + "-service-1.xml"
+ return serviceDistributionSuffix + service.getSystemName() + "/" + service.getVersion() + "/artifacts/" + artifactName;
+ }
+
+ public static String buildResourceInstanceDeploymentUrl(Service service, String artifactName, String artifactUUID){
+
+// /asdc/v1/catalog/services/Servicefordistribution/1.0 /resourceInstances/nestedfrommarina2 /artifacts/FEAdd_On_Module_vProbeLauncher.yaml
+ String resourceInstanceNormalizedName = getResourceInstanceNormalizeName(service, artifactName, artifactUUID );
+ return serviceDistributionSuffix + service.getSystemName() + "/" + service.getVersion() + "/resourceInstances/" + resourceInstanceNormalizedName +"/artifacts/" + artifactName;
+ }
+
+ public static String getResourceInstanceNormalizeName(Service service, String artifactName, String artifactUUID) {
+ for (ComponentInstance componentInstance : service.getComponentInstances()){
+ for(String key : componentInstance.getDeploymentArtifacts().keySet()){
+ if(componentInstance.getDeploymentArtifacts().get(key).getArtifactUUID().equals(artifactUUID)) {
+ return componentInstance.getNormalizedName();
+ }
+ }
+ }
+ return null;
+ }
+
+ public static Map<String, String> addComponentInstancesDeploymentArtifactToMap(Service service, Map<String, String> distributionArtifactMap){
+// TODO Andrey create correct method to build RI url
+ if(service.getComponentInstances() != null && service.getComponentInstances().size() != 0){
+ for(ComponentInstance componentInstance : service.getComponentInstances()){
+ if (componentInstance.getDeploymentArtifacts() != null && componentInstance.getDeploymentArtifacts().size() != 0){
+ for(Entry<String, ArtifactDefinition> artifact : componentInstance.getDeploymentArtifacts().entrySet()){
+ String url = buildResourceInstanceDeploymentUrl(service, artifact.getValue().getArtifactName(), artifact.getValue().getArtifactUUID());;
+ distributionArtifactMap.put(artifact.getKey(), url);
+ }
+ }
+ }
+ }
+
+ return distributionArtifactMap;
+ }
+
+
+ }
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
index 962f140dbd..8a8ec58217 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
@@ -28,6 +28,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -56,9 +58,91 @@ public final class Utils {
String acceptHeaderDate = "application/json";
public Utils() {
-
+ /*
+ * super();
+ *
+ * StartTest.enableLogger(); logger =
+ * Logger.getLogger(Utils.class.getName());
+ */
+
}
+ // public String serviceTopologyPattern = "/topology/topology/%s";
+ // public String serviceTopologyTemplatePattern =
+ // "/topologytemplate/topologytemplate/%s";
+ //
+ // public String serviceTopologySearchPattern =
+ // "topology/topology/_search?q=%s";
+ // public String serviceTopologyTemplateSearchPattern =
+ // "topologytemplate/topologytemplate/_search?q=%s";
+ //
+ // public ArtifactTypeEnum getFileTypeByExtension(String fileName) {
+ //
+ // String fileExtension = null;
+ // if (fileName.matches("(.*)\\.(.*)")) {
+ // System.out.println(fileName.substring(fileName.lastIndexOf(".") + 1));
+ // fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
+ // }
+ //
+ // switch (fileExtension) {
+ // case "sh":
+ // return ArtifactTypeEnum.SHELL_SCRIPT;
+ // case "png":
+ // return ArtifactTypeEnum.ICON;
+ // case "ppp":
+ // return ArtifactTypeEnum.PUPPET;
+ // case "yang":
+ // return ArtifactTypeEnum.YANG;
+ // default:
+ // return ArtifactTypeEnum.UNKNOWN;
+ // }
+ //
+ // }
+ //
+ // public ArrayList<String> getScriptList (List<UploadArtifactInfo>
+ // artifactsList){
+ //
+ // ArrayList<String> scriptNameArray = new ArrayList<>();
+ // if (artifactsList != null){
+ // for (UploadArtifactInfo fileInArtifactsList : artifactsList){
+ // String artifactFileName = fileInArtifactsList.getArtifactName();
+ // ArtifactTypeEnum artifactFileType =
+ // fileInArtifactsList.getArtifactType();
+ // if (! artifactFileType.equals(ArtifactTypeEnum.ICON)){
+ // scriptNameArray.add(artifactFileName);
+ // }
+ // continue;
+ // }
+ // return scriptNameArray;
+ // }
+ // return null;
+ // }
+ //
+ //
+ // public String getYamlFileLocation(File testResourcesPath) {
+ // File[] files = testResourcesPath.listFiles();
+ // if (files.length == 0){
+ // return null;
+ // }else{
+ // for (int i = 0; i < files.length; i++){
+ // if (files[i].isFile()){
+ // return files[i].getAbsoluteFile().toString();
+ // }
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // public String readFileContentToString (String fileName) throws
+ // IOException {
+ //
+ // Path path = Paths.get(fileName);
+ // String stringFromFile = new String(Files.readAllBytes(path));
+ // return stringFromFile;
+ //
+ //
+ // }
+ //
@SuppressWarnings("unchecked")
public ToscaNodeTypeInfo parseToscaNodeYaml(String fileContent) {
@@ -100,6 +184,31 @@ public final class Utils {
return result;
}
+ //
+ //
+ // public ArtifactsMetadata getArtifactsMetadata(String response){
+ // ArtifactsMetadata artifactsMetadata = new ArtifactsMetadata();
+ //
+ // artifactsMetadata.setId(getJsonObjectValueByKey(response, "id"));
+ // artifactsMetadata.setName(getJsonObjectValueByKey(response, "name"));
+ // artifactsMetadata.setType(getJsonObjectValueByKey(response, "type"));
+ //
+ // artifactsMetadata.setCreator(getJsonObjectValueByKey(response,
+ // "creator"));
+ // artifactsMetadata.setCreationTime(getJsonObjectValueByKey(response,
+ // "creationTime"));
+ // artifactsMetadata.setLastUpdateTime(getJsonObjectValueByKey(response,
+ // "lastUpdateTime"));
+ // artifactsMetadata.setChecksum(getJsonObjectValueByKey(response,
+ // "checksum"));
+ // artifactsMetadata.setDescription(getJsonObjectValueByKey(response,
+ // "description"));
+ // artifactsMetadata.setLastUpdater(getJsonObjectValueByKey(response,
+ // "lastUpdater"));
+ //
+ // return artifactsMetadata;
+ // }
+ //
public static String getJsonObjectValueByKey(String metadata, String key) {
JsonElement jelement = new JsonParser().parse(metadata);
@@ -119,16 +228,324 @@ public final class Utils {
return config;
}
+ // public void uploadNormativeTypes() throws IOException{
+ // Config config = getConfig();
+ // String[] normativeTypes = {"root", "compute", "blockStorage",
+ // "softwareComponent", "DBMS", "database", "network", "objectStorage",
+ // "webServer", "webApplication"};
+ // for( String normativeType : normativeTypes ){
+ // uploadComponent(config.getComponentsConfigDir()+File.separator+"normativeTypes"+File.separator+normativeType);
+ // }
+ //
+ // }
+ //
+ // public void uploadApacheComponent() throws IOException{
+ // Config config = getConfig();
+ // uploadComponent(config.getComponentsConfigDir()+File.separator+"apache");
+ // }
+ //
+ // public void uploadComponent(String componentDir) throws IOException{
+ //
+ // //*********************************************upload*************************************************************
+ // Config config = getConfig();
+ // ZipDirectory zipDirectory = new ZipDirectory();
+ // System.out.println(config.getEsHost());
+ //
+ // List<UploadArtifactInfo> artifactsList = new
+ // ArrayList<UploadArtifactInfo>();
+ //
+ //// read test resources and zip it as byte array
+ // byte[] zippedAsByteArray = zipDirectory.zip(componentDir, artifactsList);
+ //
+ //// encode zipped directory using base64
+ // String payload = Decoder.encode(zippedAsByteArray);
+ //
+ //// zip name build as testName with ".zip" extension
+ // String payloadZipName = getPayloadZipName(componentDir);
+ //
+ //// build json
+ // UploadResourceInfo resourceInfo = new UploadResourceInfo(payload,
+ // payloadZipName, "description", "category/mycategory", null,
+ // artifactsList);
+ // String json = new Gson().toJson(resourceInfo);
+ //
+ //// calculate md5 on the content of json
+ // String jsonMd5 =
+ // org.apache.commons.codec.digest.DigestUtils.md5Hex(json);
+ //
+ //// encode the md5 to base64, sent as header in post http request
+ // String encodedMd5 = Decoder.encode(jsonMd5.getBytes());
+ //
+ //// upload component to Elastic Search DB
+ // String url = null;
+ // HttpRequest http = new HttpRequest();
+ //
+ // url = String.format(Urls.UPLOAD_ZIP_URL, config.getCatalogFeHost(),
+ // config.getCatalogFePort());
+ //
+ //// Prepare headers to post upload component request
+ // HeaderData headerData = new HeaderData(encodedMd5, "application/json",
+ // "att", "test", "testIvanovich", "RoyalSeal", "Far_Far_Away",
+ // "getResourceArtifactListTest");
+ //
+ // MustHeaders headers = new MustHeaders(headerData);
+ // System.out.println("headers:"+headers.getMap());
+ //
+ // RestResponse response = http.httpSendPost(url, json, headers.getMap());
+ //
+ // assertEquals("upload component failed with code " +
+ // response.getErrorCode().intValue(),response.getErrorCode().intValue(),
+ // 204);
+ // }
+ //
+ // private String getPayloadZipName(String componentDir) {
+ // String payloadName;
+ // if( componentDir.contains( File.separator) ){
+ // String delimiter = null;
+ // if( File.separator.equals("\\")){
+ // delimiter ="\\\\";
+ // }
+ // else{
+ // delimiter = File.separator;
+ // }
+ // String[] split = componentDir.split(delimiter);
+ // payloadName = split[split.length-1];
+ // }
+ // else{
+ // payloadName = componentDir;
+ // }
+ // return payloadName+".zip";
+ // }
+ //
+ //
+ //
+ // public List<UploadArtifactInfo> createArtifactsList(String srcDir) {
+ //
+ // List<UploadArtifactInfo> artifactsList = new
+ // ArrayList<UploadArtifactInfo>();
+ // File srcFile = new File(srcDir);
+ // addFileToList(srcFile, artifactsList);
+ //
+ // return artifactsList;
+ // }
+ //
+ // public void addFileToList(File srcFile, List<UploadArtifactInfo>
+ // artifactsList) {
+ //
+ // File[] files = srcFile.listFiles();
+ //
+ // for (int i = 0; i < files.length; i++) {
+ // // if the file is directory, use recursion
+ // if (files[i].isDirectory()) {
+ // addFileToList(files[i], artifactsList);
+ // continue;
+ // }
+ //
+ // String fileName = files[i].getName();
+ // String artifactPath = fileName;
+ //
+ // if ( ! files[i].getName().matches("(.*)\\.y(?)ml($)")) {
+ // UploadArtifactInfo uploadArtifactInfo = new UploadArtifactInfo();
+ // uploadArtifactInfo.setArtifactName(files[i].getName());
+ // String parent = files[i].getParent();
+ //
+ // if (parent != null) {
+ // System.out.println(parent);
+ // int lastSepartor = parent.lastIndexOf(File.separator);
+ // if (lastSepartor > -1) {
+ // String actualParent = parent.substring(lastSepartor + 1);
+ // artifactPath = actualParent + "/" + artifactPath;
+ // }
+ // }
+ //
+ // uploadArtifactInfo.setArtifactPath(artifactPath);
+ // uploadArtifactInfo.setArtifactType(getFileTypeByExtension(fileName));
+ // uploadArtifactInfo.setArtifactDescription("description");
+ // artifactsList.add(uploadArtifactInfo);
+ //
+ // System.out.println("artifact list: " + artifactsList);
+ //
+ // }
+ //
+ // }
+ // }
+ //
+ //
+ // public String buildArtifactListUrl (String nodesType, String
+ // templateVersion, String artifactName) throws FileNotFoundException{
+ // //"http://172.20.43.132/sdc2/v1/catalog/resources/tosca.nodes.Root/1.0.0.wd03-SNAPSHOT/artifacts/wxs_baseline_compare.sh"
+ // Config config = getConfig();
+ // return "\"http://" + config.getCatalogBeHost() + ":" +
+ // config.getCatalogBePort() + "/sdc2/v1/catalog/resources/" +nodesType +
+ // "/" + templateVersion + "/artifacts/" + artifactName +"\"";
+ // }
+ //
+ //
+ // public void addTopologyToES(String testFolder, String
+ // serviceTopologyPattern) throws IOException{
+ // Config config = getConfig();
+ // String url = String.format(Urls.ES_URL, config.getEsHost(),
+ // config.getEsPort()) + serviceTopologyPattern;
+ // String sourceDir =
+ // config.getResourceConfigDir()+File.separator+testFolder;
+ // Path filePath = FileSystems.getDefault().getPath(sourceDir,
+ // "topology.txt");
+ // postFileContentsToUrl(url, filePath);
+ // }
+ //
+ // public void addTopologyTemplateToES(String testFolder, String
+ // serviceTopologyTemplatePattern) throws IOException{
+ // Config config = getConfig();
+ // String url = String.format(Urls.ES_URL, config.getEsHost(),
+ // config.getEsPort()) + serviceTopologyTemplatePattern;
+ // String sourceDir =
+ // config.getResourceConfigDir()+File.separator+testFolder;
+ // Path filePath = FileSystems.getDefault().getPath(sourceDir,
+ // "topologyTemplate.txt");
+ // postFileContentsToUrl(url, filePath);
+ // }
+ //
+ //
+ // public void postFileContentsToUrl(String url, Path filePath) throws
+ // IOException {
+ // HttpClientContext localContext = HttpClientContext.create();
+ // CloseableHttpResponse response = null;
+ //
+ // byte[] fileContent = Files.readAllBytes(filePath);
+ //
+ // try(CloseableHttpClient httpClient = HttpClients.createDefault()){
+ // HttpPost httpPost = new HttpPost(url);
+ // StringEntity entity = new StringEntity(new String(fileContent) ,
+ // ContentType.APPLICATION_JSON);
+ // httpPost.setEntity(entity);
+ // response = httpClient.execute(httpPost, localContext);
+ //
+ // }
+ // finally{
+ // response.close();
+ // }
+ //
+ //
+ // }
+ //
+ //
+ //// public boolean isPatternInEsDb(String patternToSearch)throws
+ // IOException{
+ //// Config config = getConfig();
+ //// String url = String.format(Urls.GET_SEARCH_DATA_FROM_ES,
+ // config.getEsHost(), config.getEsPort(),patternToSearch);
+ //// HttpRequest httpRequest = new HttpRequest();
+ //// RestResponse restResponse = httpRequest.httpSendGet(url);
+ //// if (restResponse.getErrorCode() == 200){
+ //// return true;
+ //// }
+ //// if (restResponse.getErrorCode() == 404){
+ //// return false;
+ //// }
+ ////
+ //// return false;
+ //// }
+ //
+ // public static RestResponse deleteAllDataFromEs() throws IOException{
+ // return deleteFromEsDbByPattern("_all");
+ // }
+ //
+
+ //
+ // public List<String> buildIdArrayListByTypesIndex (String index, String
+ // types) throws IOException{
+ //
+ // Config config = getConfig();
+ // HttpRequest http = new HttpRequest();
+ // RestResponse getResponce =
+ // http.httpSendGet(String.format(Urls.GET_ID_LIST_BY_INDEX_FROM_ES,
+ // config.getEsHost(), config.getEsPort(), index, types), null);
+ //
+ // List <String> idArray = new ArrayList<String>();
+ //
+ // JsonElement jelement = new JsonParser().parse(getResponce.getResponse());
+ // JsonObject jobject = jelement.getAsJsonObject();
+ // JsonObject hitsObject = (JsonObject) jobject.get("hits");
+ // JsonArray hitsArray = (JsonArray) hitsObject.get("hits");
+ // for (int i = 0; i < hitsArray.size(); i ++){
+ // JsonObject idObject = (JsonObject) hitsArray.get(i);
+ // String id = idObject.get("_id").toString();
+ // id = id.replace("\"", "");
+ // idArray.add(id);
+ // }
+ //
+ // return idArray;
+ // }
+ //
+ // public List<String> buildCategoriesTagsListFromJson(String
+ // categoriesTagsJson){
+ //
+ // ArrayList<String> categoriesTagsArray = new ArrayList<>();
+ // JsonElement jelement = new JsonParser().parse(categoriesTagsJson);
+ // JsonArray jArray = jelement.getAsJsonArray();
+ // for (int i = 0; i < jArray.size(); i ++){
+ // JsonObject categoriesTagsObject = (JsonObject) jArray.get(i);
+ // String categories = categoriesTagsObject.get("name").toString();
+ // categoriesTagsArray.add(categories);
+ // }
+ //
+ // return categoriesTagsArray;
+ // }
+ //
+ // public ArrayList <String> getCategoriesFromDb() throws Exception{
+ //
+ // ArrayList<String> categoriesFromDbArrayList = new ArrayList<>();
+ // RestResponse restResponse = new RestResponse();
+ // String contentTypeHeaderData = "application/json";
+ // String acceptHeaderDate = "application/json";
+ //
+ // Map<String, String> headersMap = new HashMap<String,String>();
+ // headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(),contentTypeHeaderData);
+ // headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
+ //
+ // HttpRequest httpRequest = new HttpRequest();
+ // String url = String.format(Urls.QUERY_NEO4J,
+ // Config.instance().getNeoHost(), Config.instance().getNeoPort());
+ // String body = "{\"statements\" : [ { \"statement\" : \"MATCH
+ // (category:category) return (category)\"} ]}";
+ // restResponse = httpRequest.httpSendPostWithAuth(url, body, headersMap,
+ // Config.instance().getNeoDBusername(),
+ // Config.instance().getNeoDBpassword());
+ //
+ // if (restResponse.getResponse()==null){
+ // return categoriesFromDbArrayList;
+ // }else{
+ // JsonElement jelement = new
+ // JsonParser().parse(restResponse.getResponse());
+ // JsonObject jobject = jelement.getAsJsonObject();
+ // JsonArray resultsArray = (JsonArray) jobject.get("results");
+ // JsonObject resObject = (JsonObject) resultsArray.get(0);
+ // JsonArray dataArray = (JsonArray) resObject.get("data");
+ // for (int i = 0; i < dataArray.size(); i ++){
+ // JsonObject rowObject = (JsonObject) dataArray.get(i);
+ // JsonArray rowArray = (JsonArray) rowObject.get("row");
+ // JsonObject nameObject = (JsonObject) rowArray.get(0);
+ // String name = nameObject.get("name").toString();
+ //// name = name.replace("\"", "");
+ // categoriesFromDbArrayList.add(name);
+ // }
+ //
+ //
+ // }
+ //
+ // return categoriesFromDbArrayList;
+ // }
+ //
public static void compareArrayLists(List<String> actualArraylList, List<String> expectedArrayList,
String message) {
ArrayList<String> actual = new ArrayList<String>(actualArraylList);
ArrayList<String> expected = new ArrayList<String>(expectedArrayList);
- assertEquals(message + " count got by rest API not match to " + message + " expected count", expected.size(),
- actual.size());
- actual.removeAll(expected);
- assertEquals(message + " content got by rest API not match to " + message + " expected content", 0,
- actual.size());
+ // assertEquals(message + " count got by rest API not match to " +
+ // message + " expected count", expected.size(),actual.size());
+ expected.removeAll(actual);
+ assertEquals(message + " content got by rest API not match to " + message + " actual content", 0,
+ expected.size());
}
public static Object parseYamlConfig(String pattern) throws FileNotFoundException {
@@ -230,4 +647,10 @@ public final class Utils {
return listResDepArtTypesFromConfig;
}
+ public static Long getEpochTimeFromUTC(String time) throws ParseException {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS zzz");
+ java.util.Date date = df.parse(time);
+ long epoch = date.getTime();
+ return epoch;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
index 51b68d4d56..832ebdf4b9 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.ci.tests.utils.cassandra;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
+import com.datastax.driver.core.*;
+import com.datastax.driver.core.querybuilder.QueryBuilder;
+import com.datastax.driver.core.querybuilder.Select;
+import com.datastax.driver.core.querybuilder.Select.Where;
import org.javatuples.Pair;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
@@ -32,15 +32,10 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.KeyspaceMetadata;
-import com.datastax.driver.core.Metadata;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.TableMetadata;
-import com.datastax.driver.core.querybuilder.QueryBuilder;
-import com.datastax.driver.core.querybuilder.Select;
-import com.datastax.driver.core.querybuilder.Select.Where;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
public final class CassandraUtils {
private static Logger logger = LoggerFactory.getLogger(CassandraUtils.class.getName());
@@ -92,7 +87,7 @@ public final class CassandraUtils {
if (session != null) {
session.execute(QueryBuilder.truncate(keyspace, tableName));
- logger.debug("The table {}. {} was cleaned", keyspace, tableName);
+ logger.debug("The table {}.{} was cleaned",keyspace,tableName);
} else {
throw new RuntimeException("Keyspace " + keyspace + " not connected");
}
@@ -128,7 +123,7 @@ public final class CassandraUtils {
Collection<TableMetadata> tables = keyspaceMetadata.getTables();
tables.forEach(table -> {
session.execute(QueryBuilder.truncate(table));
- logger.debug("Table trunceted - {}", table.getName());
+ logger.debug("Table trunceted - {}",table.getName());
});
}
} else {
@@ -147,9 +142,21 @@ public final class CassandraUtils {
List<Pair<String, String>> fieldsConverted = new ArrayList<>();
- fields.forEach(pair -> {
- Pair<String, String> newPair = new Pair(pair.getValue0().getDisplayName(), pair.getValue1());
- fieldsConverted.add(newPair);
+// fields.forEach(pair -> {
+// Pair<String, String> newPair = new Pair(pair.getValue0().getDisplayName(), pair.getValue1());
+// fieldsConverted.add(newPair);
+// });
+
+ fields.forEach(pair ->{
+ Pair<String, String> newPair;
+ if(pair.getValue0() == AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL ){
+ newPair = new Pair<String, String>("RESOURE_URL", pair.getValue1());
+
+ }else{
+ newPair = new Pair<String, String>(pair.getValue0().getDisplayName(), pair.getValue1());
+ }
+ fieldsConverted.add(newPair);
+
});
return fetchFromTableQuery(keyspace, tableName, fieldsConverted);
@@ -205,9 +212,9 @@ public final class CassandraUtils {
// Map<AuditingFieldsKeysEnum, String> map = new HashMap<>();
// map.put(AuditingFieldsKeysEnum.AUDIT_ACTION, "Access");
// map.put(AuditingFieldsKeysEnum.AUDIT_STATUS, "200");
- // // CassandraUtils.truncateTable("sdcArtifact", "resources");
- //// CassandraUtils.truncateAllTables("sdcAudit");
- // CassandraUtils.fetchFromTable("sdcAudit", "useraccessevent", map );
+ // // CassandraUtils.truncateTable("sdcartifact", "resources");
+ //// CassandraUtils.truncateAllTables("sdcaudit");
+ // CassandraUtils.fetchFromTable("sdcaudit", "useraccessevent", map );
// }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
index 414ca2334e..cafdab7d8f 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.ci.tests.utils.cassandra;
-import java.io.FileNotFoundException;
-import java.util.Collection;
-import java.util.List;
-
+import com.datastax.driver.core.*;
+import com.datastax.driver.core.querybuilder.QueryBuilder;
+import com.datastax.driver.core.querybuilder.Select;
+import com.datastax.driver.core.querybuilder.Select.Where;
import org.javatuples.Pair;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
import org.openecomp.sdc.ci.tests.utils.Utils;
@@ -31,15 +31,9 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.KeyspaceMetadata;
-import com.datastax.driver.core.Metadata;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.TableMetadata;
-import com.datastax.driver.core.querybuilder.QueryBuilder;
-import com.datastax.driver.core.querybuilder.Select;
-import com.datastax.driver.core.querybuilder.Select.Where;
+import java.io.FileNotFoundException;
+import java.util.Collection;
+import java.util.List;
public final class CassandraUtils2 {
private static Logger logger = LoggerFactory.getLogger(CassandraUtils2.class.getName());
@@ -63,7 +57,7 @@ public final class CassandraUtils2 {
session = cluster.connect(keyspace);
if (session != null) {
session.execute(QueryBuilder.truncate(keyspace, tableName));
- logger.debug("The table {}. {} was cleaned", keyspace, tableName);
+ logger.debug("The table {}.{} was cleaned",keyspace,tableName);
} else {
throw new RuntimeException("Keyspace " + keyspace + " not connected");
}
@@ -95,7 +89,7 @@ public final class CassandraUtils2 {
Collection<TableMetadata> tables = keyspaceMetadata.getTables();
tables.forEach(table -> {
session.execute(QueryBuilder.truncate(table));
- logger.debug("Table trunceted - {}", table.getName());
+ logger.debug("Table trunceted - {}",table.getName());
});
}
} else {
@@ -164,9 +158,9 @@ public final class CassandraUtils2 {
// Map<AuditingFieldsKeysEnum, String> map = new HashMap<>();
// map.put(AuditingFieldsKeysEnum.AUDIT_ACTION, "Access");
// map.put(AuditingFieldsKeysEnum.AUDIT_STATUS, "200");
- // // CassandraUtils.truncateTable("sdcArtifact", "resources");
- //// CassandraUtils.truncateAllTables("sdcAudit");
- // CassandraUtils.fetchFromTable("sdcAudit", "useraccessevent", map );
+ // // CassandraUtils.truncateTable("sdcartifact", "resources");
+ //// CassandraUtils.truncateAllTables("sdcaudit");
+ // CassandraUtils.fetchFromTable("sdcaudit", "useraccessevent", map );
// }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
index 0456b2c121..465153af14 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.ci.tests.utils.general;
+import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import java.io.File;
@@ -33,6 +34,7 @@ import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.tuple.Pair;
+import org.json.JSONException;
import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
@@ -212,7 +214,33 @@ public final class AtomicOperationUtils {
}
return Either.right(createProductResp);
}
-
+
+ // public static ComponentReqDetails
+ // convertCompoentToComponentReqDetails(Component component){
+ //
+ // ComponentReqDetails componentReqDetails =
+ // ElementFactory.getDefaultService();
+ // componentReqDetails.setName(component.getName());
+ // componentReqDetails.setDescription(component.getDescription());
+ // componentReqDetails.setTags(component.getTags());
+ // componentReqDetails.setContactId(component.getContactId());
+ // componentReqDetails.setIcon(component.getIcon());
+ // componentReqDetails.setUniqueId(component.getUniqueId());
+ // componentReqDetails.setCreatorUserId(component.getCreatorUserId());
+ // componentReqDetails.setCreatorFullName(component.getCreatorFullName());
+ // componentReqDetails.setLastUpdaterUserId(component.getLastUpdaterUserId());
+ // componentReqDetails.setLastUpdaterFullName(component.getLastUpdaterFullName());
+ // componentReqDetails.setCreationDate(component.getCreationDate());
+ // componentReqDetails.setLastUpdateDate(component.getLastUpdateDate());
+ // componentReqDetails.setLifecycleState(component.getLifecycleState());
+ // componentReqDetails.setVersion(component.getVersion());
+ // componentReqDetails.setUuid(component.getUUID());
+ // componentReqDetails.setCategories(component.getCategories());
+ // componentReqDetails.setProjectCode(component.getProjectCode());
+ //
+ // return componentReqDetails;
+ // }
+
// *********** LIFECYCLE ***************
public static Pair<Component, RestResponse> changeComponentState(Component component, UserRoleEnum userRole, LifeCycleStatesEnum targetState, Boolean validateState) throws Exception {
@@ -224,6 +252,7 @@ public final class AtomicOperationUtils {
LifeCycleStatesEnum curentCompState = LifeCycleStatesEnum.findByCompState(component.getLifecycleState().toString());
if (curentCompState == targetState) {
+ component = getCompoenntObject(component, userRole);
return Pair.of(component, null);
}
// List<LifeCycleStatesEnum> lifeCycleStatesEnumOrigList = new
@@ -261,8 +290,7 @@ public final class AtomicOperationUtils {
}
}
- component = getCompoenntObject(component, userRole);
- Component componentJavaObject = convertReposnseToComponentObject(component, lifeCycleStatesResponse);
+ Component componentJavaObject = getCompoenntObject(component, userRole);
if (validateState == true && isValidationFailed == true) {
assertTrue("change state failed" + lifeCycleStatesResponse.getResponse(), false);
@@ -301,6 +329,29 @@ public final class AtomicOperationUtils {
return distributionService;
}
+
+ public static RestResponse approveAndRejectServiceForDistribution(Component component) throws Exception {
+
+ Service service = (Service) component;
+
+ User opsUser = ElementFactory.getDefaultUser(UserRoleEnum.OPS);
+ opsUser.setRole("OPS");
+ User governotUser = ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR);
+
+ ServiceReqDetails serviceDetails = new ServiceReqDetails(service);
+ RestResponse distributionService = null;
+
+ RestResponse approveDistribution = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, governotUser, "approveService", DistributionStatusEnum.DISTRIBUTION_APPROVED);
+ if (approveDistribution.getErrorCode() == 200) {
+ distributionService = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, opsUser, "rejectService", DistributionStatusEnum.DISTRIBUTION_REJECTED);
+ }
+
+ assertEquals(approveDistribution.getErrorCode(), new Integer(ProductRestUtils.STATUS_CODE_SUCCESS));
+ assertEquals(distributionService.getErrorCode(), new Integer(ProductRestUtils.STATUS_CODE_SUCCESS));
+
+ return distributionService;
+
+ }
// *********** ARTIFACTS *****************
@@ -361,6 +412,13 @@ public final class AtomicOperationUtils {
Resource container = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
return container;
}
+
+ public static Resource getResourceObjectByNameAndVersion(UserRoleEnum sdncModifierDetails, String resourceName, String resourceVersion) throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(sdncModifierDetails);
+ RestResponse resourceResponse = ResourceRestUtils.getResourceByNameAndVersion(defaultUser.getUserId(), resourceName, resourceVersion);
+ Resource container = ResponseParser.convertResourceResponseToJavaObject(resourceResponse.getResponse());
+ return container;
+ }
public static Service getServiceObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -368,6 +426,13 @@ public final class AtomicOperationUtils {
Service container = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
return container;
}
+
+ public static Service getServiceObjectByNameAndVersion(UserRoleEnum sdncModifierDetails, String serviceName, String serviceVersion) throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(sdncModifierDetails);
+ RestResponse serviceResponse = ServiceRestUtils.getServiceByNameAndVersion(defaultUser, serviceName, serviceVersion);
+ Service container = ResponseParser.convertServiceResponseToJavaObject(serviceResponse.getResponse());
+ return container;
+ }
public static Product getProductObject(Component containerDetails, UserRoleEnum userRole) throws Exception {
User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -415,18 +480,18 @@ public final class AtomicOperationUtils {
}
return containerDetails;
}
-
- public static RestResponse associate2ResourceInstances(Component containerDetails, ComponentInstance fromNode, ComponentInstance toNode, String assocType, UserRoleEnum userRole, Boolean validateState) throws Exception {
+
+ public static RestResponse associate2ResourceInstances(Component containerDetails, ComponentInstance fromNode, ComponentInstance toNode, String assocType, UserRoleEnum userRole, Boolean validateState) throws IOException {
User defaultUser = ElementFactory.getDefaultUser(userRole);
RestResponse associate2ResourceInstancesResponse = ResourceRestUtils.associate2ResourceInstances(containerDetails, fromNode, toNode, assocType, defaultUser);
if (validateState) {
assertTrue(associate2ResourceInstancesResponse.getErrorCode() == ServiceRestUtils.STATUS_CODE_SUCCESS);
}
-
+
return associate2ResourceInstancesResponse;
}
-
+
public static Either<Pair<Component, ComponentInstance>, RestResponse> changeComponentInstanceVersion(Component containerDetails, ComponentInstance componentInstanceToReplace, Component newInstance, UserRoleEnum userRole, Boolean validateState)
throws Exception {
User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -559,7 +624,7 @@ public final class AtomicOperationUtils {
private static final long serialVersionUID = 1L;
};
-
+
/**
* Import resource from CSAR
*
@@ -572,15 +637,15 @@ public final class AtomicOperationUtils {
*/
public static Resource importResourceFromCSAR(ResourceTypeEnum resourceType, UserRoleEnum userRole, String fileName, String... filePath) throws Exception {
// Get the CSARs path
- String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars";
+ String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars" ;
if (filePath != null && filePath.length > 0) {
realFilePath = filePath.toString();
}
-
+
// Create default import resource & user
ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
User sdncModifierDetails = ElementFactory.getDefaultUser(userRole);
-
+
byte[] data = null;
Path path = Paths.get(realFilePath + File.separator + fileName);
data = Files.readAllBytes(path);
@@ -590,22 +655,22 @@ public final class AtomicOperationUtils {
resourceDetails.setCsarUUID(payloadName);
resourceDetails.setPayloadName(payloadName);
resourceDetails.setResourceType(resourceType.name());
-
+
RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
BaseRestUtils.checkCreateResponse(createResource);
- return ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
+ return ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
};
-
+
public static Either<Resource, RestResponse> importResourceByFileName(ResourceTypeEnum resourceType, UserRoleEnum userRole, String fileName, Boolean validateState, String... filePath) throws IOException {
- String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars";
+ String realFilePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "CI" + File.separator + "csars" ;
if (filePath != null && filePath.length > 0) {
realFilePath = filePath.toString();
}
try {
User defaultUser = ElementFactory.getDefaultUser(userRole);
- ResourceReqDetails defaultResource = ElementFactory.getDefaultResource(defaultUser);
+ ResourceReqDetails defaultResource = ElementFactory.getDefaultResource(defaultUser);
ImportReqDetails defaultImportResource = ElementFactory.getDefaultImportResource(defaultResource);
ImportUtils.getImportResourceDetailsByPathAndName(defaultImportResource, realFilePath, fileName);
RestResponse resourceResp = ResourceRestUtils.createResource(defaultImportResource, defaultUser);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
index 4aa13b48e4..79dea07c44 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java
@@ -29,6 +29,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Product;
import org.openecomp.sdc.be.model.User;
@@ -39,10 +40,12 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
+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.expected.ExpectedProductAudit;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedUserCRUDAudit;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.common.api.Constants;
@@ -100,6 +103,38 @@ public class Convertor {
}
+ // ********** service **************
+
+ // public static ServiceRespJavaObject
+ // constructFieldsForRespValidation(ServiceReqDetails serviceDetails, String
+ // serviceVersion, User user) {
+ // return convertToRespObject(serviceDetails, serviceVersion,
+ // user.getUserId(), user.getFullName());
+ //
+ // }
+ //
+ // private static ServiceRespJavaObject
+ // convertToRespObject(ServiceReqDetails serviceDetails, String
+ // serviceVersion, String UserId, String userName) {
+ // ServiceRespJavaObject serviceRespJavaObject = new
+ // ServiceRespJavaObject();
+ //
+ // serviceRespJavaObject.setUniqueId(serviceDetails.getUniqueId());
+ // serviceRespJavaObject.setName(serviceDetails.getName());
+ // serviceRespJavaObject.setCreatorUserId(UserId);
+ // serviceRespJavaObject.setCreatorFullName(userName);
+ // serviceRespJavaObject.setLastUpdaterUserId(UserId);
+ // serviceRespJavaObject.setLastUpdaterFullName(userName);
+ // serviceRespJavaObject.setDescription(serviceDetails.getDescription());
+ // serviceRespJavaObject.setIcon(serviceDetails.getIcon());
+ // serviceRespJavaObject.setCategory(serviceDetails.getCategory());
+ // serviceRespJavaObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString());
+ // serviceRespJavaObject.setContactId(serviceDetails.getContactId());
+ // serviceRespJavaObject.setVersion(serviceVersion);
+ //
+ // return serviceRespJavaObject;
+ // }
+
// ********** product **************
public static Product constructFieldsForRespValidation(ProductReqDetails productDetails, String productVersion,
@@ -186,18 +221,18 @@ public class Convertor {
ExpectedProductAudit expectedProductAudit = new ExpectedProductAudit();
expectedProductAudit.setACTION(action);
- String userId = user.getUserId();
+ String userUserId = user.getUserId();
String userFullName;
if (StringUtils.isEmpty(user.getFirstName()) && StringUtils.isEmpty(user.getLastName())) {
userFullName = "";
} else {
userFullName = user.getFullName();
}
- if (StringUtils.isEmpty(userId)) {
- userId = "UNKNOWN";
+ if (StringUtils.isEmpty(userUserId)) {
+ userUserId = "UNKNOWN";
}
expectedProductAudit.setMODIFIER(
- !StringUtils.isEmpty(userFullName) ? userFullName + "(" + userId + ")" : "(" + userId + ")");
+ !StringUtils.isEmpty(userFullName) ? userFullName + "(" + userUserId + ")" : "(" + userUserId + ")");
expectedProductAudit.setSTATUS(Integer.toString(errorInfo.getCode()));
expectedProductAudit.setDESC(errorInfo.getAuditDesc((Object[]) (errorMessageParams)));
expectedProductAudit
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
index ba2ebd9b4e..c06cb570f8 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
@@ -51,6 +51,8 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
@@ -69,8 +71,12 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.util.ValidationUtils;
+import com.google.common.base.CaseFormat;
+
public class ElementFactory {
+ private static final String JH0003 = "jh0003";
+ private static final String CI_RES = "ciRes";
private static String DEFAULT_ARTIFACT_LABEL = "artifact1";
private static final String RESOURCE_INSTANCE_POS_X = "20";
private static final String RESOURCE_INSTANCE_POS_Y = "20";
@@ -79,48 +85,48 @@ public class ElementFactory {
// *** RESOURCE ***
public static ResourceReqDetails getDefaultResource() {
- return getDefaultResource("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, "jh0003");
+ return getDefaultResource(CI_RES, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, JH0003);
}
public static ResourceReqDetails getDefaultResource(ResourceCategoryEnum category) {
- return getDefaultResource("ciRes", NormativeTypesEnum.ROOT, category, "jh0003");
+ return getDefaultResource(CI_RES, NormativeTypesEnum.ROOT, category, JH0003);
}
public static ResourceReqDetails getDefaultResource(String contactId) {
- return getDefaultResource("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, contactId);
+ return getDefaultResource(CI_RES, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, contactId);
}
public static ResourceReqDetails getDefaultResource(User modifier) {
- return getDefaultResource("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, modifier.getUserId());
+ return getDefaultResource(CI_RES, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, modifier.getUserId());
}
public static ResourceReqDetails getDefaultResource(NormativeTypesEnum derivedFrom, ResourceCategoryEnum category) {
- return getDefaultResource("ciRes", derivedFrom, category, "jh0003");
+ return getDefaultResource(CI_RES, derivedFrom, category, JH0003);
}
public static ResourceReqDetails getDefaultResource(NormativeTypesEnum derivedFrom) {
- return getDefaultResource("ciRes", derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, "jh0003");
+ return getDefaultResource(CI_RES, derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, JH0003);
}
public static ResourceReqDetails getDefaultResource(String resourceName, NormativeTypesEnum derivedFrom) {
- return getDefaultResource(resourceName, derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, "jh0003");
+ return getDefaultResource(resourceName, derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, JH0003);
}
public static ResourceReqDetails getDefaultResource(NormativeTypesEnum derivedFrom, String contactId) {
- return getDefaultResource("ciRes", derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, contactId);
+ return getDefaultResource(CI_RES, derivedFrom, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, contactId);
}
// New
public static ResourceReqDetails getDefaultResourceByType(ResourceTypeEnum ResourceType, String resourceName) {
- return getDefaultResourceByType(resourceName, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, "jh0003", ResourceType.toString());
+ return getDefaultResourceByType(resourceName, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, JH0003, ResourceType.toString());
}
public static ResourceReqDetails getDefaultResourceByType(ResourceTypeEnum ResourceType, User user) {
- return getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, user.getUserId(), ResourceType.toString());
+ return getDefaultResourceByType(CI_RES, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, user.getUserId(), ResourceType.toString());
}
public static ResourceReqDetails getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum resourceType, NormativeTypesEnum normativeTypes, ResourceCategoryEnum resourceCategory, User user) {
- return getDefaultResourceByType("ciRes", normativeTypes, resourceCategory, user.getUserId(), resourceType.toString());
+ return getDefaultResourceByType(CI_RES, normativeTypes, resourceCategory, user.getUserId(), resourceType.toString());
}
public static PropertyReqDetails getDefaultMapProperty(PropertyTypeEnum innerType) {
@@ -139,7 +145,7 @@ public class ElementFactory {
ArrayList<String> derivedFrom = new ArrayList<String>();
derivedFrom.add(derived.normativeName);
- String vendorName = "ATT (Tosca)";
+ String vendorName = "ATT Tosca";
String vendorRelease = "1.0.0.wd03";
String icon = "defaulticon";
ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon);
@@ -150,7 +156,7 @@ public class ElementFactory {
}
public static ResourceReqDetails getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum resourceType, Resource normativeTypes, ResourceCategoryEnum resourceCategory, User user) {
- return getDefaultResource("ciRes" + resourceType, normativeTypes, resourceCategory, user.getUserId());
+ return getDefaultResource(CI_RES + resourceType, normativeTypes, resourceCategory, user.getUserId());
}
public static ResourceReqDetails getDefaultResource(String resourceName, Resource derived, ResourceCategoryEnum category, String contactId) {
@@ -161,7 +167,7 @@ public class ElementFactory {
ArrayList<String> derivedFrom = new ArrayList<String>();
derivedFrom.add(derived.getToscaResourceName());
- String vendorName = "ATT (Tosca)";
+ String vendorName = "ATT Tosca";
String vendorRelease = "1.0.0.wd03";
String icon = "defaulticon";
ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon);
@@ -186,13 +192,27 @@ public class ElementFactory {
derivedFrom = new ArrayList<String>();
derivedFrom.add(derived.normativeName);
}
- String vendorName = "ATT (Tosca)";
+ String vendorName = "ATT Tosca";
String vendorRelease = "1.0.0.wd03";
String icon = "defaulticon";
ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon, resourceType.toString());
resourceDetails.addCategoryChain(category.getCategory(), category.getSubCategory());
return resourceDetails;
}
+
+ public static ResourceExternalReqDetails getDefaultResourceByType(String resourceName, ResourceCategoryEnum category, String contactId, String resourceType) {
+ resourceName = (resourceName + resourceType + generateUUIDforSufix());
+ String description = "Represents a generic software component that can be managed and run by a Compute Node Type.";
+ ArrayList<String> resourceTags = new ArrayList<String>();
+ resourceTags.add(resourceName);
+ String vendorName = "ATT Tosca";
+ String vendorRelease = "1.0.0.wd03";
+ String icon = "defaulticon";
+ ResourceExternalReqDetails resourceDetails = new ResourceExternalReqDetails(resourceName, description, resourceTags,
+ vendorName, vendorRelease, contactId, icon,
+ resourceType.toString(), category.getCategory(), category.getSubCategory());
+ return resourceDetails;
+ }
// New
public static ImportReqDetails getDefaultImportResourceByType(String resourceName, NormativeTypesEnum derived, ResourceCategoryEnum category, String contactId, String resourceType) {
@@ -205,7 +225,7 @@ public class ElementFactory {
derivedFrom = new ArrayList<String>();
derivedFrom.add(derived.normativeName);
}
- String vendorName = "ATT (Tosca)";
+ String vendorName = "SDC Tosca";
String vendorRelease = "1.0.0.wd03";
String icon = "defaulticon";
ImportReqDetails resourceDetails = new ImportReqDetails(resourceName, description, resourceTags, derivedFrom, vendorName, vendorRelease, contactId, icon);
@@ -217,18 +237,18 @@ public class ElementFactory {
public static ImportReqDetails getDefaultImportResource(ResourceReqDetails resourceReqDetails) {
ImportReqDetails importReqDetails = new ImportReqDetails(resourceReqDetails.getName(), resourceReqDetails.getDescription(), resourceReqDetails.getTags(), resourceReqDetails.getDerivedFrom(), resourceReqDetails.getVendorName(),
resourceReqDetails.getVendorRelease(), resourceReqDetails.getContactId(), resourceReqDetails.getIcon());
- importReqDetails.setPayloadName("myCompute.yaml");
+ importReqDetails.setPayloadName("ciMyCompute.yaml");
importReqDetails.setCategories(resourceReqDetails.getCategories());
importReqDetails.setPayloadData(
"dG9zY2FfZGVmaW5pdGlvbnNfdmVyc2lvbjogdG9zY2Ffc2ltcGxlX3lhbWxfMV8wXzANCm5vZGVfdHlwZXM6IA0KICBvcmcub3BlbmVjb21wLnJlc291cmNlLk15Q29tcHV0ZToNCiAgICBkZXJpdmVkX2Zyb206IHRvc2NhLm5vZGVzLlJvb3QNCiAgICBhdHRyaWJ1dGVzOg0KICAgICAgcHJpdmF0ZV9hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIHB1YmxpY19hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICB0eXBlOiBtYXANCiAgICAgICAgZW50cnlfc2NoZW1hOg0KICAgICAgICAgIHR5cGU6IHRvc2NhLmRhdGF0eXBlcy5uZXR3b3JrLk5ldHdvcmtJbmZvDQogICAgICBwb3J0czoNCiAgICAgICAgdHlwZTogbWFwDQogICAgICAgIGVudHJ5X3NjaGVtYToNCiAgICAgICAgICB0eXBlOiB0b3NjYS5kYXRhdHlwZXMubmV0d29yay5Qb3J0SW5mbw0KICAgIHJlcXVpcmVtZW50czoNCiAgICAgIC0gbG9jYWxfc3RvcmFnZTogDQogICAgICAgICAgY2FwYWJpbGl0eTogdG9zY2EuY2FwYWJpbGl0aWVzLkF0dGFjaG1lbnQNCiAgICAgICAgICBub2RlOiB0b3NjYS5ub2Rlcy5CbG9ja1N0b3JhZ2UNCiAgICAgICAgICByZWxhdGlvbnNoaXA6IHRvc2NhLnJlbGF0aW9uc2hpcHMuQXR0YWNoZXNUbw0KICAgICAgICAgIG9jY3VycmVuY2VzOiBbMCwgVU5CT1VOREVEXSAgDQogICAgY2FwYWJpbGl0aWVzOg0KICAgICAgaG9zdDogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5Db250YWluZXINCiAgICAgICAgdmFsaWRfc291cmNlX3R5cGVzOiBbdG9zY2Eubm9kZXMuU29mdHdhcmVDb21wb25lbnRdIA0KICAgICAgZW5kcG9pbnQgOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuRW5kcG9pbnQuQWRtaW4gDQogICAgICBvczogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5PcGVyYXRpbmdTeXN0ZW0NCiAgICAgIHNjYWxhYmxlOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuU2NhbGFibGUNCiAgICAgIGJpbmRpbmc6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5uZXR3b3JrLkJpbmRhYmxlDQo=");
- return importReqDetails;
+ return importReqDetails;
}
public static ImportReqDetails getDefaultImportResource() {
ResourceReqDetails resourceReqDetails = getDefaultResource();
ImportReqDetails importReqDetails = new ImportReqDetails(resourceReqDetails.getName(), resourceReqDetails.getDescription(), resourceReqDetails.getTags(), resourceReqDetails.getDerivedFrom(), resourceReqDetails.getVendorName(),
resourceReqDetails.getVendorRelease(), resourceReqDetails.getContactId(), resourceReqDetails.getIcon());
- importReqDetails.setPayloadName("myCompute.yaml");
+ importReqDetails.setPayloadName("ciMyCompute.yaml");
importReqDetails.setCategories(resourceReqDetails.getCategories());
importReqDetails.setPayloadData(
"dG9zY2FfZGVmaW5pdGlvbnNfdmVyc2lvbjogdG9zY2Ffc2ltcGxlX3lhbWxfMV8wXzANCm5vZGVfdHlwZXM6IA0KICBvcmcub3BlbmVjb21wLnJlc291cmNlLk15Q29tcHV0ZToNCiAgICBkZXJpdmVkX2Zyb206IHRvc2NhLm5vZGVzLlJvb3QNCiAgICBhdHRyaWJ1dGVzOg0KICAgICAgcHJpdmF0ZV9hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIHB1YmxpY19hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICB0eXBlOiBtYXANCiAgICAgICAgZW50cnlfc2NoZW1hOg0KICAgICAgICAgIHR5cGU6IHRvc2NhLmRhdGF0eXBlcy5uZXR3b3JrLk5ldHdvcmtJbmZvDQogICAgICBwb3J0czoNCiAgICAgICAgdHlwZTogbWFwDQogICAgICAgIGVudHJ5X3NjaGVtYToNCiAgICAgICAgICB0eXBlOiB0b3NjYS5kYXRhdHlwZXMubmV0d29yay5Qb3J0SW5mbw0KICAgIHJlcXVpcmVtZW50czoNCiAgICAgIC0gbG9jYWxfc3RvcmFnZTogDQogICAgICAgICAgY2FwYWJpbGl0eTogdG9zY2EuY2FwYWJpbGl0aWVzLkF0dGFjaG1lbnQNCiAgICAgICAgICBub2RlOiB0b3NjYS5ub2Rlcy5CbG9ja1N0b3JhZ2UNCiAgICAgICAgICByZWxhdGlvbnNoaXA6IHRvc2NhLnJlbGF0aW9uc2hpcHMuQXR0YWNoZXNUbw0KICAgICAgICAgIG9jY3VycmVuY2VzOiBbMCwgVU5CT1VOREVEXSAgDQogICAgY2FwYWJpbGl0aWVzOg0KICAgICAgaG9zdDogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5Db250YWluZXINCiAgICAgICAgdmFsaWRfc291cmNlX3R5cGVzOiBbdG9zY2Eubm9kZXMuU29mdHdhcmVDb21wb25lbnRdIA0KICAgICAgZW5kcG9pbnQgOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuRW5kcG9pbnQuQWRtaW4gDQogICAgICBvczogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5PcGVyYXRpbmdTeXN0ZW0NCiAgICAgIHNjYWxhYmxlOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuU2NhbGFibGUNCiAgICAgIGJpbmRpbmc6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5uZXR3b3JrLkJpbmRhYmxlDQo=");
@@ -239,7 +259,7 @@ public class ElementFactory {
ResourceReqDetails resourceReqDetails = getDefaultResourceByType(ResourceTypeEnum.VFC, name);
ImportReqDetails importReqDetails = new ImportReqDetails(resourceReqDetails.getName(), resourceReqDetails.getDescription(), resourceReqDetails.getTags(), resourceReqDetails.getDerivedFrom(), resourceReqDetails.getVendorName(),
resourceReqDetails.getVendorRelease(), resourceReqDetails.getContactId(), resourceReqDetails.getIcon());
- importReqDetails.setPayloadName("myCompute.yaml");
+ importReqDetails.setPayloadName("ciMyCompute.yaml");
importReqDetails.setCategories(resourceReqDetails.getCategories());
importReqDetails.setPayloadData(
"dG9zY2FfZGVmaW5pdGlvbnNfdmVyc2lvbjogdG9zY2Ffc2ltcGxlX3lhbWxfMV8wXzANCm5vZGVfdHlwZXM6IA0KICBvcmcub3BlbmVjb21wLnJlc291cmNlLk15Q29tcHV0ZToNCiAgICBkZXJpdmVkX2Zyb206IHRvc2NhLm5vZGVzLlJvb3QNCiAgICBhdHRyaWJ1dGVzOg0KICAgICAgcHJpdmF0ZV9hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIHB1YmxpY19hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICB0eXBlOiBtYXANCiAgICAgICAgZW50cnlfc2NoZW1hOg0KICAgICAgICAgIHR5cGU6IHRvc2NhLmRhdGF0eXBlcy5uZXR3b3JrLk5ldHdvcmtJbmZvDQogICAgICBwb3J0czoNCiAgICAgICAgdHlwZTogbWFwDQogICAgICAgIGVudHJ5X3NjaGVtYToNCiAgICAgICAgICB0eXBlOiB0b3NjYS5kYXRhdHlwZXMubmV0d29yay5Qb3J0SW5mbw0KICAgIHJlcXVpcmVtZW50czoNCiAgICAgIC0gbG9jYWxfc3RvcmFnZTogDQogICAgICAgICAgY2FwYWJpbGl0eTogdG9zY2EuY2FwYWJpbGl0aWVzLkF0dGFjaG1lbnQNCiAgICAgICAgICBub2RlOiB0b3NjYS5ub2Rlcy5CbG9ja1N0b3JhZ2UNCiAgICAgICAgICByZWxhdGlvbnNoaXA6IHRvc2NhLnJlbGF0aW9uc2hpcHMuQXR0YWNoZXNUbw0KICAgICAgICAgIG9jY3VycmVuY2VzOiBbMCwgVU5CT1VOREVEXSAgDQogICAgY2FwYWJpbGl0aWVzOg0KICAgICAgaG9zdDogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5Db250YWluZXINCiAgICAgICAgdmFsaWRfc291cmNlX3R5cGVzOiBbdG9zY2Eubm9kZXMuU29mdHdhcmVDb21wb25lbnRdIA0KICAgICAgZW5kcG9pbnQgOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuRW5kcG9pbnQuQWRtaW4gDQogICAgICBvczogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5PcGVyYXRpbmdTeXN0ZW0NCiAgICAgIHNjYWxhYmxlOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuU2NhbGFibGUNCiAgICAgIGJpbmRpbmc6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5uZXR3b3JrLkJpbmRhYmxlDQo=");
@@ -423,16 +443,17 @@ public class ElementFactory {
}
public static ArtifactReqDetails getDefaultDeploymentArtifactForType(String artifactType) throws IOException, Exception {
- return getArtifactByType(DEFAULT_ARTIFACT_LABEL, artifactType, true);
+ return getArtifactByType(DEFAULT_ARTIFACT_LABEL, artifactType, true, false);
}
public static ArtifactReqDetails getArtifactByType(ArtifactTypeEnum artifactLabel, ArtifactTypeEnum artifactType, Boolean deploymentTrue) throws IOException, Exception {
- return getArtifactByType(DEFAULT_ARTIFACT_LABEL, artifactType.toString(), deploymentTrue);
+ return getArtifactByType(DEFAULT_ARTIFACT_LABEL, artifactType.toString(), deploymentTrue, false);
}
- public static ArtifactReqDetails getArtifactByType(String artifactLabel, String artifactType, Boolean deploymentTrue) throws IOException, Exception {
+ public static ArtifactReqDetails getArtifactByType(String artifactLabel, String artifactType, Boolean deploymentTrue, Boolean updatedPayload) throws IOException, Exception {
String artifactName;
+ String updatedPayloadData =null;
String payloadData = null;
Integer timeout = null;
String url = "";
@@ -449,6 +470,7 @@ public class ElementFactory {
* Missing file type: DCAE_JSON
*/
switch (artifactTypeEnum) {
+ case DCAE_INVENTORY_TOSCA:
case DCAE_EVENT:
case APPC_CONFIG:
case DCAE_DOC:
@@ -458,18 +480,17 @@ public class ElementFactory {
case HEAT_VOL: {
artifactName = generateUUIDforSufix() + artifactType + "_install_apache2.yaml";
payloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
+ updatedPayloadData = "dG9zY2FfZGVmaW5pdGlvbnNfdmVyc2lvbjogdG9zY2Ffc2ltcGxlX3lhbWxfMV8wXzANCg0Kbm9kZV90eXBlczoNCiAgY29tLmF0dC5kMi5yZXNvdXJjZS5jcC5DUDoNCiAgICBkZXJpdmVkX2Zyb206IHRvc2NhLm5vZGVzLm5ldHdvcmsuUG9ydA0KICAgIHByb3BlcnRpZXM6DQogICAgICBpc190YWdnZWQ6DQogICAgICAgIHR5cGU6IGJvb2xlYW4NCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlDQogICAgICAgIGRlZmF1bHQ6IGZhbHNlDQogICAgICAgIGRlc2NyaXB0aW9uOiANCg0KICAgIHJlcXVpcmVtZW50czoNCiAgICAgIC0gdmlydHVhbExpbms6DQogICAgICAgICAgY2FwYWJpbGl0eTogdG9zY2EuY2FwYWJpbGl0aWVzLm5ldHdvcmsuTGlua2FibGUNCiAgICAgICAgICByZWxhdGlvbnNoaXA6IHRvc2NhLnJlbGF0aW9uc2hpcHMubmV0d29yay5MaW5rc1RvDQogICAgICAtIHZpcnR1YWxCaW5kaW5nOg0KICAgICAgICAgIGNhcGFiaWxpdHk6IHRvc2NhLmNhcGFiaWxpdGllcy5uZXR3b3JrLkJpbmRhYmxlDQogICAgICAgICAgcmVsYXRpb25zaGlwOiB0b3NjYS5yZWxhdGlvbnNoaXBzLm5ldHdvcmsuQmluZHNUbw0KICAgIGNhcGFiaWxpdGllczoNCiAgICAgIGF0dGFjaG1lbnQ6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5BdHRhY2htZW50DQogICAgICAgIG9jY3VycmVuY2VzOg0KICAgICAgICAtIDENCiAgICAgICAgLSBVTkJPVU5ERUQNCiAgICAgICAgdHlwZTogdG9zY2EuY2FwYWJpbGl0aWVzLm5ldHdvcmsuQmluZGFibGUNCiAgICAgICAgb2NjdXJyZW5jZXM6DQogICAgICAgIC0gMQ0KICAgICAgICAtIFVOQk9VTkRFRA0KICAgICAgdmlydHVhbF9saW5rYWJsZToNCiAgICAgICAgdHlwZTogY29tLmF0dC5kMi5jYXBhYmlsaXRpZXMuTWV0cmljDQogICAgICBlbmRfcG9pbnQ6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5FbmRwb2ludCAgICAgICA=";
timeout = 60;
artifactLabel = normalizeArtifactLabel(artifactName);
break;
}
- case DCAE_INVENTORY_TOSCA:
- case DCAE_INVENTORY_JSON:
case DCAE_INVENTORY_POLICY:
- case DCAE_INVENTORY_DOC:
case DCAE_INVENTORY_BLUEPRINT:
case DCAE_INVENTORY_EVENT: {
artifactName = getDcaeArtifactName(artifactTypeEnum, artifactType);
payloadData = "will be override later";
+ updatedPayloadData = "override";
timeout = 60;
artifactLabel = normalizeArtifactLabel(artifactName);
break;
@@ -477,16 +498,20 @@ public class ElementFactory {
case MURANO_PKG: {
artifactName = artifactType + "org.openstack.Rally.zip";
payloadData = "ODM4MTRjNzkxZjcwYTlkMjk4ZGQ2ODE4MThmNjg0N2Y=";
+ updatedPayloadData = "ODM4MTRjNzkxZjcwYTlkMjk4ZGQ2ODE4MThmMTAwN2Y=";
break;
}
case DCAE_POLICY: {
artifactName = artifactType + "dcae_policy.emf";
payloadData = "will be override later";
+ updatedPayloadData = "override";
break;
}
+ case DCAE_INVENTORY_JSON:
case DCAE_JSON: {
artifactName = artifactType + "dcae_policy.json";
- payloadData = "e30=";
+ payloadData = "ew0KICAiYXJ0aWZhY3RzIjogImRmc2FmIiwNCiAgIm5vcm1hbGl6ZWROYW1lIjogImNpc2VydmljZTBiYzY5ODk2OTQ4ZiIsDQogICJzeXN0ZW1OYW1lIjogIkNpc2VydmljZTBiYzY5ODk2OTQ4ZiIsDQogICJpbnZhcmlhbnRVVUlEIjogIjEzZmJkNzI3LWRjNzUtNDU1OS1iNzEyLWUwMjc5YmY4YTg2MSIsDQogICJhdHRDb250YWN0IjogImNzMDAwOCIsDQogICJuYW1lIjogImNpU2VydmljZTBiYzY5ODk2OTQ4ZiINCn0=";
+ updatedPayloadData = "ew0KICAiYXJ0aWZhY3RzIjogIjEyMzQzIiwNCiAgIm5vcm1hbGl6ZWROYW1lIjogIjU0MzUzNCIsDQogICJzeXN0ZW1OYW1lIjogIkNpc2VydmljZTBiYzY5ODk2OTQ4ZiIsDQogICJpbnZhcmlhbnRVVUlEIjogIjEzZmJkNzI3LWRjNzUtNDU1OS1iNzEyLWUwMjc5YmY4YTg2MSIsDQogICJhdHRDb250YWN0IjogImNzMDAwOCIsDQogICJuYW1lIjogImNpU2VydmljZTBiYzY5ODk2OTQ4ZiINCn0=";
break;
}
case PUPPET:
@@ -495,6 +520,7 @@ public class ElementFactory {
case YANG: {
artifactName = generateUUIDforSufix() + artifactType + "yangXml.xml";
payloadData = "PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8ZGF0YT4NCiAgPHNwb3J0cz4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+TGlvbmVsIEFuZHJlcyBNZXNzaTwvbmFtZT4NCiAgICAgIDxiaXJ0aGRheT4xOTg3LTA2LTI0VDAwOjAwOjAwLTAwOjAwPC9iaXJ0aGRheT4NCiAgICA8L3BlcnNvbj4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+Q3Jpc3RpYW5vIFJvbmFsZG88L25hbWU+DQogICAgICA8YmlydGhkYXk+MTk4NS0wMi0wNVQwMDowMDowMC0wMDowMDwvYmlydGhkYXk+DQogICAgPC9wZXJzb24+DQogICAgPHRlYW0+DQogICAgICA8bmFtZT5GQyBCYXJjZWxvbmE8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5MaW9uZWwgQW5kcmVzIE1lc3NpPC9uYW1lPg0KICAgICAgICA8c2Vhc29uPkNoYW1waW9ucyBMZWFndWUgMjAxNC0yMDE1PC9zZWFzb24+DQogICAgICAgIDxudW1iZXI+MTA8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40Mzwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICAgIDx0ZWFtPg0KICAgICAgPG5hbWU+UmVhbCBNYWRyaWQ8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5DcmlzdGlhbm8gUm9uYWxkbzwvbmFtZT4NCiAgICAgICAgPHNlYXNvbj5DaGFtcGlvbnMgTGVhZ3VlIDIwMTQtMjAxNTwvc2Vhc29uPg0KICAgICAgICA8bnVtYmVyPjc8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40ODwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICA8L3Nwb3J0cz4NCg0KPC9kYXRhPg==";
+ updatedPayloadData = "PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8ZGF0YT4NCiAgPHNwb3J0cz4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+TGlvbmVsIEFuZHJlcyBNZXNzaTwvbmFtZT4NCiAgICAgIDxiaXJ0aGRheT4xOTkwLTA2LTI0VDAwOjAwOjAwLTAwOjExPC9iaXJ0aGRheT4NCiAgICA8L3BlcnNvbj4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+Q3Jpc3RpYW5vIFJvbmFsZG88L25hbWU+DQogICAgICA8YmlydGhkYXk+MTk4NS0wMi0wNVQwMDowMDowMC0wMDowMDwvYmlydGhkYXk+DQogICAgPC9wZXJzb24+DQogICAgPHRlYW0+DQogICAgICA8bmFtZT5GQyBCYXJjZWxvbmE8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5MaW9uZWwgQW5kcmVzIE1lc3NpPC9uYW1lPg0KICAgICAgICA8c2Vhc29uPkNoYW1waW9ucyBMZWFndWUgMjAxNC0yMDE1PC9zZWFzb24+DQogICAgICAgIDxudW1iZXI+MTA8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40Mzwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICAgIDx0ZWFtPg0KICAgICAgPG5hbWU+UmVhbCBNYWRyaWQ8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5DcmlzdGlhbm8gUm9uYWxkbzwvbmFtZT4NCiAgICAgICAgPHNlYXNvbj5DaGFtcGlvbnMgTGVhZ3VlIDIwMTQtMjAxNTwvc2Vhc29uPg0KICAgICAgICA8bnVtYmVyPjc8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40ODwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICA8L3Nwb3J0cz4NCg0KPC9kYXRhPg==";
timeout = 15;
artifactLabel = normalizeArtifactLabel(artifactName);
break;
@@ -507,13 +533,19 @@ public class ElementFactory {
case YANG_XML: {
artifactName = generateUUIDforSufix() + artifactType + "yangXml.xml";
payloadData = "PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8ZGF0YT4NCiAgPHNwb3J0cz4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+TGlvbmVsIEFuZHJlcyBNZXNzaTwvbmFtZT4NCiAgICAgIDxiaXJ0aGRheT4xOTg3LTA2LTI0VDAwOjAwOjAwLTAwOjAwPC9iaXJ0aGRheT4NCiAgICA8L3BlcnNvbj4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+Q3Jpc3RpYW5vIFJvbmFsZG88L25hbWU+DQogICAgICA8YmlydGhkYXk+MTk4NS0wMi0wNVQwMDowMDowMC0wMDowMDwvYmlydGhkYXk+DQogICAgPC9wZXJzb24+DQogICAgPHRlYW0+DQogICAgICA8bmFtZT5GQyBCYXJjZWxvbmE8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5MaW9uZWwgQW5kcmVzIE1lc3NpPC9uYW1lPg0KICAgICAgICA8c2Vhc29uPkNoYW1waW9ucyBMZWFndWUgMjAxNC0yMDE1PC9zZWFzb24+DQogICAgICAgIDxudW1iZXI+MTA8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40Mzwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICAgIDx0ZWFtPg0KICAgICAgPG5hbWU+UmVhbCBNYWRyaWQ8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5DcmlzdGlhbm8gUm9uYWxkbzwvbmFtZT4NCiAgICAgICAgPHNlYXNvbj5DaGFtcGlvbnMgTGVhZ3VlIDIwMTQtMjAxNTwvc2Vhc29uPg0KICAgICAgICA8bnVtYmVyPjc8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40ODwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICA8L3Nwb3J0cz4NCg0KPC9kYXRhPg==";
+ updatedPayloadData = "PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8ZGF0YT4NCiAgPHNwb3J0cz4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+TGlvbmVsIEFuZHJlcyBNZXNzaTwvbmFtZT4NCiAgICAgIDxiaXJ0aGRheT4xOTkwLTA2LTI0VDAwOjAwOjAwLTAwOjExPC9iaXJ0aGRheT4NCiAgICA8L3BlcnNvbj4NCiAgICA8cGVyc29uPg0KICAgICAgPG5hbWU+Q3Jpc3RpYW5vIFJvbmFsZG88L25hbWU+DQogICAgICA8YmlydGhkYXk+MTk4NS0wMi0wNVQwMDowMDowMC0wMDowMDwvYmlydGhkYXk+DQogICAgPC9wZXJzb24+DQogICAgPHRlYW0+DQogICAgICA8bmFtZT5GQyBCYXJjZWxvbmE8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5MaW9uZWwgQW5kcmVzIE1lc3NpPC9uYW1lPg0KICAgICAgICA8c2Vhc29uPkNoYW1waW9ucyBMZWFndWUgMjAxNC0yMDE1PC9zZWFzb24+DQogICAgICAgIDxudW1iZXI+MTA8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40Mzwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICAgIDx0ZWFtPg0KICAgICAgPG5hbWU+UmVhbCBNYWRyaWQ8L25hbWU+DQogICAgICA8cGxheWVyPg0KICAgICAgICA8bmFtZT5DcmlzdGlhbm8gUm9uYWxkbzwvbmFtZT4NCiAgICAgICAgPHNlYXNvbj5DaGFtcGlvbnMgTGVhZ3VlIDIwMTQtMjAxNTwvc2Vhc29uPg0KICAgICAgICA8bnVtYmVyPjc8L251bWJlcj4NCiAgICAgICAgPHNjb3Jlcz40ODwvc2NvcmVzPg0KICAgICAgPC9wbGF5ZXI+DQogICAgPC90ZWFtPg0KICA8L3Nwb3J0cz4NCg0KPC9kYXRhPg==";
timeout = 0;
artifactLabel = normalizeArtifactLabel(artifactName);
break;
}
+ case SNMP_POLL:
+ case SNMP_TRAP:
+ case DCAE_INVENTORY_DOC:
+ case GUIDE:
case OTHER: {
artifactName = generateUUIDforSufix() + artifactType + "other.pdf";
payloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDEzLTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTENCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIGltYWdlX25hbWVfMjoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogSW1hZ2UgTmFtZQ0KICAgIGRlc2NyaXB0aW9uOiBTQ09JTUFHRSBTcGVjaWZ5IGFuIGltYWdlIG5hbWUgZm9yIGluc3RhbmNlMg0KICAgIGRlZmF1bHQ6IGNpcnJvcy0wLjMuMS14ODZfNjQNCiAgbmV0d29ya19pZDoNCiAgICB0eXBlOiBzdHJpbmcNCiAgICBsYWJlbDogTmV0d29yayBJRA0KICAgIGRlc2NyaXB0aW9uOiBTQ09ORVRXT1JLIE5ldHdvcmsgdG8gYmUgdXNlZCBmb3IgdGhlIGNvbXB1dGUgaW5zdGFuY2UNCiAgICBoaWRkZW46IHRydWUNCiAgICBjb25zdHJhaW50czoNCiAgICAgIC0gbGVuZ3RoOiB7IG1pbjogNiwgbWF4OiA4IH0NCiAgICAgICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIGxlbmd0aCBtdXN0IGJlIGJldHdlZW4gNiBhbmQgOCBjaGFyYWN0ZXJzLg0KICAgICAgLSByYW5nZTogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBSYW5nZSBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3ZhbHVlczoNCiAgICAgICAgLSBtMS5zbWFsbA0KICAgICAgICAtIG0xLm1lZGl1bQ0KICAgICAgICAtIG0xLmxhcmdlDQogICAgICAgIGRlc2NyaXB0aW9uOiBBbGxvd2VkIHZhbHVlcyBkZXNjcmlwdGlvbg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbYS16QS1aMC05XSsiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IGNvbnNpc3Qgb2YgY2hhcmFjdGVycyBhbmQgbnVtYmVycyBvbmx5Lg0KICAgICAgLSBhbGxvd2VkX3BhdHRlcm46ICJbQS1aXStbYS16QS1aMC05XSoiDQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBtdXN0IHN0YXJ0IHdpdGggYW4gdXBwZXJjYXNlIGNoYXJhY3Rlci4NCiAgICAgIC0gY3VzdG9tX2NvbnN0cmFpbnQ6IG5vdmEua2V5cGFpcg0KICAgICAgICBkZXNjcmlwdGlvbjogQ3VzdG9tIGRlc2NyaXB0aW9uDQoNCnJlc291cmNlczoNCiAgbXlfaW5zdGFuY2UxOg0KICAgIHR5cGU6IE9TOjpOb3ZhOjpTZXJ2ZXINCiAgICBwcm9wZXJ0aWVzOg0KICAgICAgaW1hZ2U6IHsgZ2V0X3BhcmFtOiBpbWFnZV9uYW1lXzEgfQ0KICAgICAgZmxhdm9yOiBtMS5zbWFsbA0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9DQogIG15X2luc3RhbmNlMjoNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8yIH0NCiAgICAgIGZsYXZvcjogbTEudGlueQ0KICAgICAgbmV0d29ya3M6DQogICAgICAgIC0gbmV0d29yayA6IHsgZ2V0X3BhcmFtIDogbmV0d29ya19pZCB9";
+ updatedPayloadData = "aGVhdF90ZW1wbGF0ZV92ZXJzaW9uOiAyMDE2LTA1LTIzDQoNCmRlc2NyaXB0aW9uOiBTaW1wbGUgdGVtcGxhdGRzYWRzYWRzYWUgdG8gZGVwbG95IGEgc3RhY2sgd2l0aCB0d28gdmlydHVhbCBtYWNoaW5lIGluc3RhbmNlcw0KDQpwYXJhbWV0ZXJzOg0KICBpbWFnZV9uYW1lXzE6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFkc2FkYXN3Z2UgbmFtZSBmb3IgaW5zdGFuY2UxDQogICAgZGVmYXVsdDogY2lycm9zLTAuMy4xLXg4Nl82NA0KICBpbWFnZV9uYW1lXzI6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IEltYWdlIE5hbWUNCiAgICBkZXNjcmlwdGlvbjogU0NPSU1BR0UgU3BlY2lmeSBhbiBpbWFnZSBuYW1lIGZvciBpbnN0YW5jZTINCiAgICBkZWZhdWx0OiBjaXJyb3MtMC4zLjEteDg2XzY0DQogIG5ldHdvcmtfaWQ6DQogICAgdHlwZTogc3RyaW5nDQogICAgbGFiZWw6IE5ldHdvcmsgSUQNCiAgICBkZXNjcmlwdGlvbjogU0NPTkVUV09SSyBOZXR3b3JrIHRvIGJlIHVzZWQgZm9yIHRoZSBjb21wdXRlIGluc3RhbmNlDQogICAgaGlkZGVuOiB0cnVlDQogICAgY29uc3RyYWludHM6DQogICAgICAtIGxlbmd0aDogeyBtaW46IDYsIG1heDogOCB9DQogICAgICAgIGRlc2NyaXB0aW9uOiBQYXNzd29yZCBsZW5ndGggbXVzdCBiZSBiZXR3ZWVuIDYgYW5kIDggY2hhcmFjdGVycy4NCiAgICAgIC0gcmFuZ2U6IHsgbWluOiA2LCBtYXg6IDggfQ0KICAgICAgICBkZXNjcmlwdGlvbjogUmFuZ2UgZGVzY3JpcHRpb24NCiAgICAgIC0gYWxsb3dlZF92YWx1ZXM6DQogICAgICAgIC0gbTEuc21hbGwNCiAgICAgICAgLSBtMS5tZWRpdW0NCiAgICAgICAgLSBtMS5sYXJnZQ0KICAgICAgICBkZXNjcmlwdGlvbjogQWxsb3dlZCB2YWx1ZXMgZGVzY3JpcHRpb24NCiAgICAgIC0gYWxsb3dlZF9wYXR0ZXJuOiAiW2EtekEtWjAtOV0rIg0KICAgICAgICBkZXNjcmlwdGlvbjogUGFzc3dvcmQgbXVzdCBjb25zaXN0IG9mIGNoYXJhY3RlcnMgYW5kIG51bWJlcnMgb25seS4NCiAgICAgIC0gYWxsb3dlZF9wYXR0ZXJuOiAiW0EtWl0rW2EtekEtWjAtOV0qIg0KICAgICAgICBkZXNjcmlwdGlvbjogUGFzc3dvcmQgbXVzdCBzdGFydCB3aXRoIGFuIHVwcGVyY2FzZSBjaGFyYWN0ZXIuDQogICAgICAtIGN1c3RvbV9jb25zdHJhaW50OiBub3ZhLmtleXBhaXINCiAgICAgICAgZGVzY3JpcHRpb246IEN1c3RvbSBkZXNjcmlwdGlvbg0KDQpyZXNvdXJjZXM6DQogIG15X2luc3RhbmNlMToNCiAgICB0eXBlOiBPUzo6Tm92YTo6U2VydmVyDQogICAgcHJvcGVydGllczoNCiAgICAgIGltYWdlOiB7IGdldF9wYXJhbTogaW1hZ2VfbmFtZV8xIH0NCiAgICAgIGZsYXZvcjogbTEuc21hbGwNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICAtIG5ldHdvcmsgOiB7IGdldF9wYXJhbSA6IG5ldHdvcmtfaWQgfQ0KICBteV9pbnN0YW5jZTI6DQogICAgdHlwZTogT1M6Ok5vdmE6OlNlcnZlcg0KICAgIHByb3BlcnRpZXM6DQogICAgICBpbWFnZTogeyBnZXRfcGFyYW06IGltYWdlX25hbWVfMiB9DQogICAgICBmbGF2b3I6IG0xLnRpbnkNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICAtIG5ldHdvcmsgOiB7IGdldF9wYXJhbSA6IG5ldHdvcmtfaWQgfQ";
timeout = 0;
artifactLabel = normalizeArtifactLabel(artifactName);
break;
@@ -522,12 +554,21 @@ public class ElementFactory {
default: {// dummy
artifactName = generateUUIDforSufix() + "testArtifact.sh";
payloadData = "dGVzdA==";
+ updatedPayloadData = "YmVzYg==";
artifactLabel = normalizeArtifactLabel(artifactName);
break;
}
}
-
- ArtifactReqDetails artifactDetails = new ArtifactReqDetails(artifactName, artifactType, artifactDescription, payloadData, artifactLabel);
+ artifactLabel = normalizeArtifactLabel("ci" + artifactName);
+
+ ArtifactReqDetails artifactDetails = null;
+
+ if (!updatedPayload){
+ artifactDetails = new ArtifactReqDetails(artifactName, artifactType, artifactDescription, payloadData, artifactLabel);
+ }
+ else artifactDetails = new ArtifactReqDetails(artifactName, artifactType, artifactDescription,
+ updatedPayloadData, artifactLabel);
+
artifactDetails.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT.getType());
artifactDetails.setUrl(url);
artifactDetails.setTimeout(timeout);
@@ -687,6 +728,43 @@ public class ElementFactory {
return expectedExternalArtifactAudit;
}
+
+ public static ExpectedExternalAudit getDefaultExternalArtifactAuditSuccess(AssetTypeEnum assetType, AuditingActionEnum action, ArtifactDefinition artifactDefinition, Component component) {
+
+ //ExpectedExternalAudit expectedExternalArtifactAudit = new ExpectedExternalAudit();
+
+ ExpectedExternalAudit expectedExternalArtifactAudit = getDefaultExternalAuditObject(assetType, action, null);
+ expectedExternalArtifactAudit.setMODIFIER(AuditValidationUtils.getModifierString(artifactDefinition.getUpdaterFullName(), artifactDefinition.getUserIdLastUpdater()));
+ expectedExternalArtifactAudit.setPREV_ARTIFACT_UUID("");
+ expectedExternalArtifactAudit.setCURR_ARTIFACT_UUID(artifactDefinition.getArtifactUUID());
+ expectedExternalArtifactAudit.setARTIFACT_DATA(AuditValidationUtils.buildArtifactDataAudit(artifactDefinition));
+ expectedExternalArtifactAudit.setRESOURCE_URL(expectedExternalArtifactAudit.getRESOURCE_URL() + "/" + component.getUUID() + "/artifacts");
+ expectedExternalArtifactAudit.setRESOURCE_NAME(component.getName());
+ expectedExternalArtifactAudit.setRESOURCE_TYPE(component.getComponentType().getValue());
+ return expectedExternalArtifactAudit;
+
+ }
+
+ public static ExpectedResourceAuditJavaObject getDefaultCreateResourceExternalAPI(String resourceName) {
+
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = new ExpectedResourceAuditJavaObject();
+ expectedResourceAuditJavaObject.setAction(AuditingActionEnum.CREATE_RESOURCE_BY_API.getName());
+ expectedResourceAuditJavaObject.setResourceName(resourceName);
+ expectedResourceAuditJavaObject.setResourceType("Resource");
+ expectedResourceAuditJavaObject.setCONSUMER_ID("ci");
+ expectedResourceAuditJavaObject.setRESOURCE_URL("/asdc/v1/catalog/resources");
+ expectedResourceAuditJavaObject.setMODIFIER("");
+ expectedResourceAuditJavaObject.setPrevVersion("");
+ expectedResourceAuditJavaObject.setCurrVersion("0.1");
+ expectedResourceAuditJavaObject.setPrevState("");
+ expectedResourceAuditJavaObject.setCurrState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.toString());
+ expectedResourceAuditJavaObject.setStatus("201");
+ expectedResourceAuditJavaObject.setDesc("OK");
+
+ return expectedResourceAuditJavaObject;
+
+
+ }
public static ExpectedExternalAudit getDefaultExternalArtifactAuditSuccess(AssetTypeEnum assetType, AuditingActionEnum action, ArtifactDefinition artifactDefinition, String componentUUID, String resourceInstanceName) {
@@ -768,26 +846,26 @@ public class ElementFactory {
// Category/Subcategory/Group
public static CategoryDefinition getDefaultCategory() {
CategoryDefinition productCategoryDefinition = new CategoryDefinition();
- productCategoryDefinition.setName("Category1");
+ productCategoryDefinition.setName("CiCateg" + generateUUIDforSufix());
return productCategoryDefinition;
}
public static SubCategoryDefinition getDefaultSubCategory() {
SubCategoryDefinition productSubCategoryDefinition = new SubCategoryDefinition();
- productSubCategoryDefinition.setName("SubCategory1");
+ productSubCategoryDefinition.setName("CiSubCateg" + generateUUIDforSufix());
return productSubCategoryDefinition;
}
public static GroupingDefinition getDefaultGroup() {
GroupingDefinition productGroupDefinition = new GroupingDefinition();
- productGroupDefinition.setName("Grouping1");
+ productGroupDefinition.setName("CiGrouping1" + generateUUIDforSufix());
return productGroupDefinition;
}
// Product
public static ProductReqDetails getDefaultProduct() {
- return createDefaultProductReqDetails("Product1", null);
+ return createDefaultProductReqDetails("CiProduct1", null);
}
public static ProductReqDetails getDefaultProduct(String name) {
@@ -822,10 +900,7 @@ public class ElementFactory {
product.setProjectCode("12345");
product.setIcon("myIcon");
ArrayList<String> contacts = new ArrayList<String>();
- // contacts.add(ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1).getUserId());
- // contacts.add(ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST2).getUserId());
contacts.add(ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1).getUserId());
- // contacts.add(ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER2).getUserId());
product.setContacts(contacts);
product.setCategories(categories);
String fullName = "This is my full name: " + name;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
index b785563a4d..b07a3c3d7b 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileUtils.java
@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory;
import fj.data.Either;
public class FileUtils {
-
static Logger logger = LoggerFactory.getLogger(Utils.class.getName());
public static void writeToFile(String filePath, String content) {
@@ -99,16 +98,18 @@ public class FileUtils {
return null;
}
- public static String loadPayloadFileFromListUsingPosition(List<String> listFileName, String pattern, Boolean isBase64, int positionInList) throws IOException {
+ public static String loadPayloadFileFromListUsingPosition(List<String> listFileName, String pattern,
+ Boolean isBase64, int positionInList) throws IOException {
List<String> newList = new ArrayList<String>(Arrays.asList(listFileName.get(positionInList)));
return loadPayloadFile(newList, pattern, isBase64);
}
- public static String loadPayloadFile(List<String> listFileName, String pattern, Boolean isBase64) throws IOException {
+ public static String loadPayloadFile(List<String> listFileName, String pattern, Boolean isBase64)
+ throws IOException {
String fileName;
String payload = null;
fileName = FileUtils.getFilePathFromListByPattern(listFileName, pattern);
- logger.debug("fileName: {}", fileName);
+ logger.debug("fileName: {}",fileName);
if (fileName != null) {
payload = Decoder.readFileToString(fileName);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
index 040cdba444..c1f311a91e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java
@@ -20,14 +20,21 @@
package org.openecomp.sdc.ci.tests.utils.general;
+import java.io.File;
import java.io.IOException;
import java.util.List;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.utils.Utils;
public class ImportUtils {
- public static ImportReqDetails getImportResourceDetailsByPathAndName(ImportReqDetails importReqDetails, String filePath, String fileName) throws IOException {
+ public static ImportReqDetails getImportResourceDetailsByPathAndName(ImportReqDetails importReqDetails,
+ String filePath, String fileName) throws IOException {
// ImportReqDetails importReqDetails;
// User sdncUserDetails;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/graph/GraphFileUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/graph/GraphFileUtils.java
new file mode 100644
index 0000000000..2fa5807aff
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/graph/GraphFileUtils.java
@@ -0,0 +1,39 @@
+package org.openecomp.sdc.ci.tests.utils.graph;
+
+import com.thinkaurelius.titan.core.TitanVertex;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GraphFileUtils {
+
+ public static final String TEMP_FILES_PATH = "src/main/resources/ci/tempFiles/%s.txt";
+
+ public static void writeVerticesUIDToFile(String fileName, Iterable<TitanVertex> vertices) throws IOException {
+ Path path = Paths.get(String.format(TEMP_FILES_PATH, fileName));
+ Files.deleteIfExists(path);
+ Path file = Files.createFile(path);
+ final String newLine = System.getProperty("line.separator");
+ for (TitanVertex vertex : vertices) {
+ FileUtils.writeStringToFile(file.toFile(), String.valueOf(vertex.id()) + newLine, Charset.defaultCharset(), true);
+ }
+ }
+
+ public static List<String> getVerticesIdsFromFile(String fileName) throws IOException {
+ List<String> verticesUids = new ArrayList<>();
+ Files.lines(Paths.get(String.format(TEMP_FILES_PATH, fileName))).forEach(verticesUids::add);
+ return verticesUids;
+ }
+
+ private static String getUid(TitanVertex titanVertex) {
+ return (String )titanVertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
+ }
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
index 4360621364..ddd9209d83 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
@@ -34,6 +34,7 @@ import org.json.simple.JSONValue;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.Urls;
@@ -58,53 +59,197 @@ import com.google.gson.Gson;
public class ArtifactRestUtils extends BaseRestUtils {
private static Logger logger = LoggerFactory.getLogger(ArtifactRestUtils.class.getName());
-
+
+
// External API
- // Upload Artifact of the asset
+ // Delete Artifact on rI of the asset
+ public static RestResponse externalAPIDeleteArtifactOfComponentInstanceOnAsset(Component component, User user, ComponentInstance resourceInstance, String artifactUUID) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+ String resourceInstanceName = resourceInstance.getNormalizedName();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.DELETE_EXTRNAL_API_DELETE_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, resourceInstanceName, artifactUUID);
+
+ return deleteInformationalArtifact(user, url);
+ }
+
+ // Delete Artifact of the asset
+ public static RestResponse externalAPIDeleteArtifactOfTheAsset(Component component, User user, String artifactUUID) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.DELETE_EXTRNAL_API_DELETE_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, artifactUUID);
+
+ RestResponse restResponse = deleteInformationalArtifact(user, url);
+
+ return restResponse;
+ }
+
+
+ // Update Artifact on rI of the asset
+ public static RestResponse externalAPIUpdateArtifactOfComponentInstanceOnAsset(Component component, User user, ArtifactReqDetails artifactReqDetails, ComponentInstance resourceInstance, String artifactUUID) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+ String resourceInstanceName = resourceInstance.getNormalizedName();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.POST_EXTERNAL_API_UPDATE_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, resourceInstanceName, artifactUUID);
+
+ return updateInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails), url);
+ }
+
+ // Update Artifact of the asset
+ public static RestResponse externalAPIUpdateArtifactOfTheAsset(Component component, User user, ArtifactReqDetails artifactReqDetails, String artifactUUID) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.POST_EXTERNAL_API_UPDATE_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, artifactUUID);
+
+ return updateInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails), url);
+ }
+
+
+ // Upload Artifact on rI of the asset
+ public static RestResponse externalAPIUploadArtifactOfComponentInstanceOnAsset(Component component, User user, ArtifactReqDetails artifactReqDetails, ComponentInstance resourceInstance) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+ String resourceInstanceName = resourceInstance.getNormalizedName();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, resourceInstanceName);
+
+ return uploadInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails), url);
+ }
+
+ // Upload Artifact of the asset
public static RestResponse externalAPIUploadArtifactOfTheAsset(Component component, User user, ArtifactReqDetails artifactReqDetails) throws IOException {
Config config = Utils.getConfig();
String resourceType = null;
String resourceUUID = component.getUUID();
-
+
System.out.println(component.getComponentType());
-
- if (component.getComponentType().toString().toLowerCase().equals("resource")) {
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
resourceType = "resources";
} else {
resourceType = "services";
}
-
+
String url = String.format(Urls.POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID);
-
+
return uploadInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails), url);
}
-
+
+
+ // Upload Artifact of the asset with invalid checksum
+ public static RestResponse externalAPIUploadArtifactWithInvalidCheckSumOfComponentInstanceOnAsset(Component component, User user, ArtifactReqDetails artifactReqDetails, ComponentInstance resourceInstance) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+ String resourceInstanceName = resourceInstance.getNormalizedName();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_COMPONENTINSTANCE_ON_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID, resourceInstanceName);
+
+ return uploadInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails) + "123", url);
+ }
+
+ // Upload Artifact of the asset with invalid checksum
+ public static RestResponse externalAPIUploadArtifactWithInvalidCheckSumOfTheAsset(Component component, User user, ArtifactReqDetails artifactReqDetails) throws IOException {
+ Config config = Utils.getConfig();
+ String resourceType = null;
+ String resourceUUID = component.getUUID();
+
+ System.out.println(component.getComponentType());
+
+ if(component.getComponentType().toString().toLowerCase().equals("resource")) {
+ resourceType = "resources";
+ } else {
+ resourceType = "services";
+ }
+
+ String url = String.format(Urls.POST_EXTERNAL_API_UPLOAD_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceType, resourceUUID);
+
+ return uploadInformationalArtifact(artifactReqDetails, user, calculateChecksum(artifactReqDetails) + "123", url);
+ }
+
+
//
// Testing
//
- public static RestResponse getResourceDeploymentArtifactExternalAPI(String resourceUUID, String artifactUUID, User sdncModifierDetails, String resourceType) throws IOException {
+ public static RestResponse getResourceDeploymentArtifactExternalAPI(String resourceUUID, String artifactUUID,User sdncModifierDetails, String resourceType) throws IOException {
Config config = Utils.getConfig();
String url = null;
-
- if (resourceType.equals("Service")) {
+
+ if (resourceType.toUpperCase().equals("SERVICE")) {
url = String.format(Urls.GET_DOWNLOAD_SERVICE_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, artifactUUID);
} else {
url = String.format(Urls.GET_DOWNLOAD_RESOURCE_ARTIFACT_OF_ASSET, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, artifactUUID);
}
-
- Map<String, String> headersMap = new HashMap<String, String>();
+
+ Map<String, String> headersMap = new HashMap<String,String>();
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
-
+
HttpRequest http = new HttpRequest();
- logger.debug("Send GET request to get Resource Assets: {}", url);
+ logger.debug("Send GET request to get Resource Assets: {}",url);
System.out.println("Send GET request to get Resource Assets: " + url);
-
- logger.debug("Request headers: {}", headersMap);
+
+ logger.debug("Request headers: {}",headersMap);
System.out.println("Request headers: " + headersMap);
RestResponse sendGetResourceAssets = http.httpSendGet(url, headersMap);
@@ -112,30 +257,32 @@ public class ArtifactRestUtils extends BaseRestUtils {
return sendGetResourceAssets;
}
-
- public static RestResponse getComponentInstanceDeploymentArtifactExternalAPI(String resourceUUID, String componentInstanceUID, String artifactUUID, User sdncModifierDetails, String resourceType) throws IOException {
+
+
+
+ public static RestResponse getComponentInstanceDeploymentArtifactExternalAPI(String resourceUUID, String componentNormalizedName, String artifactUUID,User sdncModifierDetails, String resourceType) throws IOException {
Config config = Utils.getConfig();
String url = null;
-
- if (resourceType.equals("Service")) {
- url = String.format(Urls.GET_DOWNLOAD_SERVICE_ARTIFACT_OF_COMPONENT_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, componentInstanceUID, artifactUUID);
+
+ if (resourceType.toLowerCase().equals("service")) {
+ url = String.format(Urls.GET_DOWNLOAD_SERVICE_ARTIFACT_OF_COMPONENT_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, componentNormalizedName, artifactUUID);
} else {
- url = String.format(Urls.GET_DOWNLOAD_RESOURCE_ARTIFACT_OF_COMPONENT_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, componentInstanceUID, artifactUUID);
+ url = String.format(Urls.GET_DOWNLOAD_RESOURCE_ARTIFACT_OF_COMPONENT_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUUID, componentNormalizedName, artifactUUID);
}
-
- Map<String, String> headersMap = new HashMap<String, String>();
+
+ Map<String, String> headersMap = new HashMap<String,String>();
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
-
+
HttpRequest http = new HttpRequest();
- logger.debug("Send GET request to get Resource Assets: {}", url);
+ logger.debug("Send GET request to get Resource Assets: {}",url);
System.out.println("Send GET request to get Resource Assets: " + url);
-
- logger.debug("Request headers: {}", headersMap);
+
+ logger.debug("Request headers: {}",headersMap);
System.out.println("Request headers: " + headersMap);
RestResponse sendGetResourceAssets = http.httpSendGet(url, headersMap);
@@ -143,8 +290,9 @@ public class ArtifactRestUtils extends BaseRestUtils {
return sendGetResourceAssets;
}
-
- // *********** SERVICE ****************
+
+
+ //*********** SERVICE ****************
public static RestResponse getArtifactTypesList() throws IOException {
Config config = Utils.getConfig();
String url = String.format(Urls.GET_ALL_ARTIFACTS, config.getCatalogBeHost(), config.getCatalogBePort());
@@ -163,90 +311,117 @@ public class ArtifactRestUtils extends BaseRestUtils {
return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, checksum, url);
}
- public static RestResponse downloadServiceArtifact(ServiceReqDetails service, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders) throws Exception {
-
- return downloadServiceArtifact(service, artifact, user, addionalHeaders, true);
+ public static RestResponse downloadServiceArtifact(ServiceReqDetails service, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders) throws Exception
+ {
+
+ return downloadServiceArtifact( service, artifact, user,addionalHeaders,true);
}
-
- public static RestResponse downloadServiceArtifact(ServiceReqDetails service, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders, boolean addEcompHeader) throws Exception {
+
+ public static RestResponse downloadServiceArtifact(ServiceReqDetails service, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders,boolean addEcompHeader) throws Exception
+ {
Config config = Utils.getConfig();
- String relativeUrl = encodeUrlForDownload(
- String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(service.getName()), service.getVersion(), ValidationUtils.normalizeFileName(artifact.getArtifactName())));
- String fullUrl = String.format(Urls.DOWNLOAD_SERVICE_ARTIFACT_FULL_URL, config.getCatalogBeHost(), config.getCatalogBePort(), relativeUrl);
-
- return downloadArtifact(fullUrl, user, addionalHeaders, addEcompHeader);
- }
-
- public static RestResponse downloadResourceArtifact(ServiceReqDetails service, ResourceReqDetails resource, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders) throws Exception {
- return downloadResourceArtifact(service, resource, artifact, user, addionalHeaders, true);
- }
-
- public static RestResponse downloadResourceArtifact(ServiceReqDetails service, ResourceReqDetails resource, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders, boolean addEcompHeader) throws Exception {
+ String relativeUrl = encodeUrlForDownload(String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(service.getName()), service.getVersion(), ValidationUtils.normalizeFileName(artifact.getArtifactName())));
+ String fullUrl = String.format(Urls.DOWNLOAD_SERVICE_ARTIFACT_FULL_URL, config.getCatalogBeHost(),config.getCatalogBePort(), relativeUrl);
+
+ return downloadArtifact(fullUrl, user, addionalHeaders,addEcompHeader);
+ }
+
+ public static RestResponse downloadResourceArtifact(ServiceReqDetails service, ResourceReqDetails resource, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders) throws Exception
+ {
+ return downloadResourceArtifact(service, resource, artifact, user,addionalHeaders, true);
+ }
+
+ public static RestResponse downloadResourceArtifact(ServiceReqDetails service,ResourceReqDetails resource, ArtifactReqDetails artifact, User user, Map<String, String> addionalHeaders,boolean addEcompHeader) throws Exception
+ {
Config config = Utils.getConfig();
- String relativeUrl = encodeUrlForDownload(String.format(Urls.DISTRIB_DOWNLOAD_RESOURCE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(service.getName()), service.getVersion(),
- ValidationUtils.convertToSystemName(resource.getName()), resource.getVersion(), ValidationUtils.normalizeFileName(artifact.getArtifactName())));
- String fullUrl = String.format(Urls.DOWNLOAD_RESOURCE_ARTIFACT_FULL_URL, config.getCatalogBeHost(), config.getCatalogBePort(), relativeUrl);
-
- return downloadArtifact(fullUrl, user, addionalHeaders, addEcompHeader);
- }
-
- public static RestResponse downloadResourceInstanceArtifact(String serviceUniqueId, String resourceInstanceId, User user, String artifactUniqeId) throws Exception {
+ String relativeUrl = encodeUrlForDownload(String.format(Urls.DISTRIB_DOWNLOAD_RESOURCE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(service.getName()),service.getVersion(),ValidationUtils.convertToSystemName(resource.getName()), resource.getVersion(), ValidationUtils.normalizeFileName(artifact.getArtifactName())));
+ String fullUrl = String.format(Urls.DOWNLOAD_RESOURCE_ARTIFACT_FULL_URL, config.getCatalogBeHost(),config.getCatalogBePort(), relativeUrl);
+
+ return downloadArtifact(fullUrl, user, addionalHeaders,addEcompHeader);
+ }
+
+
+
+ public static RestResponse downloadResourceInstanceArtifact(String serviceUniqueId,String resourceInstanceId, User user, String artifactUniqeId) throws Exception
+ {
Config config = Utils.getConfig();
- String url = String.format(Urls.DOWNLOAD_COMPONENT_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceUniqueId, resourceInstanceId, artifactUniqeId);
- RestResponse res = sendGet(url, user.getUserId(), null);
+ String url = String.format(Urls.DOWNLOAD_COMPONENT_INSTANCE_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUniqueId, resourceInstanceId, artifactUniqeId);
+ RestResponse res = sendGet(url, user.getUserId(), null);
return res;
}
+
+ ////
- ////
-
- // update
-
+ //update
+
public static RestResponse updateInformationalArtifactOfServiceByMethod(ArtifactReqDetails artifactReqDetails, String serviceUid, String artifactUid, User sdncModifierDetails, String httpMethod) throws IOException {
- // TODO Auto-generated method stub
return updateInformationalArtifactOfServiceByMethod(artifactReqDetails, serviceUid, artifactUid, sdncModifierDetails, httpMethod, calculateChecksum(artifactReqDetails));
}
-
+
public static RestResponse updateInformationalArtifactOfServiceByMethod(ArtifactReqDetails artifactReqDetails, String serviceUid, User sdncModifierDetails, String httpMethod) throws IOException {
- // TODO Auto-generated method stub
return updateInformationalArtifactOfServiceByMethod(artifactReqDetails, serviceUid, artifactReqDetails.getUniqueId(), sdncModifierDetails, httpMethod, calculateChecksum(artifactReqDetails));
}
-
- public static RestResponse downloadResourceArtifactInternalApi(String resourceId, User user, String artifactUniqeId) throws Exception {
+
+ public static RestResponse downloadResourceArtifactInternalApi(String resourceId, User user, String artifactUniqeId) throws Exception
+ {
return downloadComponentArtifactInternalApi(resourceId, user, artifactUniqeId, Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT);
}
- public static RestResponse downloadServiceArtifactInternalApi(String componentId, User user, String artifactUniqeId) throws Exception {
+ public static RestResponse downloadServiceArtifactInternalApi(String componentId, User user, String artifactUniqeId) throws Exception
+ {
return downloadComponentArtifactInternalApi(componentId, user, artifactUniqeId, Urls.UI_DOWNLOAD_SERVICE_ARTIFACT);
}
-
- public static RestResponse downloadComponentArtifactInternalApi(String componentId, User user, String artifactUniqeId, String urlTemplate) throws Exception {
+ public static RestResponse downloadComponentArtifactInternalApi(String componentId, User user, String artifactUniqeId, String urlTemplate) throws Exception
+ {
Config config = Utils.getConfig();
- String url = String.format(urlTemplate, config.getCatalogBeHost(), config.getCatalogBePort(), componentId, artifactUniqeId);
- RestResponse res = sendGet(url, user.getUserId(), null);
+ String url = String.format(urlTemplate, config.getCatalogBeHost(),config.getCatalogBePort(), componentId, artifactUniqeId);
+ RestResponse res = sendGet(url, user.getUserId(), null);
return res;
}
-
+
+// public static RestResponse downloadServiceArtifactInternalApi(String resourceId, User user, String artifactUniqeId) throws Exception
+// {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), resourceId, artifactUniqeId);
+// RestResponse res = sendGet(url, user.getUserId(), null);
+// return res;
+// }
+
/*
- * public static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum) throws IOException { return
- * updateInformationalArtifactOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, checksum, true); }
- *
- * public static RestResponse updateInformationalArtifactMetadataOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid) throws IOException { return
- * updateInformationalArtifactOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, calculateChecksum(artifactDetails), false); }
- *
- * public static RestResponse updateInformationalArtifactOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum, boolean isPayloadUpdate) throws IOException { Config config =
- * Utils.getConfig(); Map<String, String> headersMap = getHeadersMap(sdncModifierDetails);
- *
- * if (isPayloadUpdate){ headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), checksum); }
- *
- * Gson gson = new Gson(); String jsonBody = gson.toJson(artifactDetails);
- *
- * HttpRequest http = new HttpRequest();
- *
- * String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUid, artifactUid); RestResponse res = http.httpSendPost(url, jsonBody, headersMap);
- * System.out.println("update artifact was finished with response: "+ res.getErrorCode()); return res; }
- */
+ public static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum) throws IOException
+ {
+ return updateInformationalArtifactOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, checksum, true);
+ }
+
+ public static RestResponse updateInformationalArtifactMetadataOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid) throws IOException
+ {
+ return updateInformationalArtifactOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, calculateChecksum(artifactDetails), false);
+ }
+
+ public static RestResponse updateInformationalArtifactOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum, boolean isPayloadUpdate) throws IOException
+ {
+ Config config = Utils.getConfig();
+ Map<String, String> headersMap = getHeadersMap(sdncModifierDetails);
- public static RestResponse updateInformationalArtifactOfServiceByMethod(ArtifactReqDetails artifactReqDetails, String serviceUid, String artifactUid, User sdncModifierDetails, String httpMethod, String checksum) throws IOException {
+ if (isPayloadUpdate){
+ headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
+ }
+
+ Gson gson = new Gson();
+ String jsonBody = gson.toJson(artifactDetails);
+
+ HttpRequest http = new HttpRequest();
+
+ String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUid, artifactUid);
+ RestResponse res = http.httpSendPost(url, jsonBody, headersMap);
+ System.out.println("update artifact was finished with response: "+ res.getErrorCode());
+ return res;
+ }*/
+
+
+
+ public static RestResponse updateInformationalArtifactOfServiceByMethod(ArtifactReqDetails artifactReqDetails, String serviceUid, String artifactUid, User sdncModifierDetails, String httpMethod, String checksum) throws IOException
+ {
Config config = Utils.getConfig();
Map<String, String> headersMap = getHeadersMap(sdncModifierDetails);
@@ -256,150 +431,168 @@ public class ArtifactRestUtils extends BaseRestUtils {
String userBodyJson = gson.toJson(artifactReqDetails);
HttpRequest http = new HttpRequest();
- String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), serviceUid, artifactUid);
+ String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUid, artifactUid);
RestResponse updateResourceResponse = http.httpSendByMethod(url, httpMethod, userBodyJson, headersMap);
- // System.out.println("update artifact was finished with response: "+
- // updateResourceResponse.getErrorCode());
+// System.out.println("update artifact was finished with response: "+ updateResourceResponse.getErrorCode());
return updateResourceResponse;
}
-
+
+
public static Map<String, String> getHeadersMap(User sdncModifierDetails) {
- Map<String, String> headersMap = new HashMap<String, String>();
+ Map<String, String> headersMap = new HashMap<String,String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptJsonHeader);
-
- try {
- headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
- } catch (Exception e) {
-
+
+ try{
+ headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
}
-
+ catch(Exception e)
+ {
+
+ }
+
return headersMap;
}
- // *********** RESOURCE ****************
- // add
- public static RestResponse addInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException {
+ //*********** RESOURCE ****************
+ //add
+ public static RestResponse addInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException{
return addInformationalArtifactToResource(artifactDetails, sdncModifierDetails, resourceUid, calculateChecksum(artifactDetails));
}
-
- public static RestResponse explicitAddInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException {
+
+ public static RestResponse explicitAddInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException{
Config config = Utils.getConfig();
- String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid);
+
+ String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(),config.getCatalogBePort(), resourceUid);
return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, calculateChecksum(artifactDetails), url);
}
- public static RestResponse addInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid, String checksum) throws IOException {
+
+ public static RestResponse addInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid, String checksum) throws IOException{
Config config = Utils.getConfig();
-
- if (artifactDetails.getArtifactGroupType() != null && artifactDetails.getArtifactGroupType().equals(ArtifactGroupTypeEnum.DEPLOYMENT.getType())) {
- // YANG_XML and OTHER deployment artifact should be added through
- // this API, not updated
- String artifactType = artifactDetails.getArtifactType();
- if (!(ArtifactTypeEnum.YANG_XML.getType().equals(artifactType) || ArtifactTypeEnum.OTHER.getType().equals(artifactType) || ArtifactTypeEnum.VNF_CATALOG.getType().equals(artifactType)
- || ArtifactTypeEnum.VF_LICENSE.getType().equals(artifactType) || ArtifactTypeEnum.VENDOR_LICENSE.getType().equals(artifactType) || ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType().equals(artifactType)
- || ArtifactTypeEnum.MODEL_QUERY_SPEC.getType().equals(artifactType) || ArtifactTypeEnum.APPC_CONFIG.getType().equals(artifactType))) {
- // return updateInformationalArtifactToResource(artifactDetails,
- // sdncModifierDetails, resourceUid);
+
+ if (artifactDetails.getArtifactGroupType()!=null && artifactDetails.getArtifactGroupType().equals(ArtifactGroupTypeEnum.DEPLOYMENT.getType())){
+ //YANG_XML and OTHER deployment artifact should be added through this API, not updated
+ String artifactType = artifactDetails.getArtifactType();
+ if (!(ArtifactTypeEnum.YANG_XML.getType().equals(artifactType) ||
+ ArtifactTypeEnum.OTHER.getType().equals(artifactType) ||
+ ArtifactTypeEnum.VNF_CATALOG.getType().equals(artifactType) ||
+ ArtifactTypeEnum.VF_LICENSE.getType().equals(artifactType) ||
+ ArtifactTypeEnum.VENDOR_LICENSE.getType().equals(artifactType) ||
+ ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.getType().equals(artifactType) ||
+ ArtifactTypeEnum.MODEL_QUERY_SPEC.getType().equals(artifactType) ||
+ ArtifactTypeEnum.APPC_CONFIG.getType().equals(artifactType))){
+ //return updateInformationalArtifactToResource(artifactDetails, sdncModifierDetails, resourceUid);
+ }
}
- }
- String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid);
-
+ String url = String.format(Urls.ADD_ARTIFACT_TO_RESOURCE, config.getCatalogBeHost(),config.getCatalogBePort(), resourceUid);
+
return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, checksum, url);
}
-
- // update
- public static RestResponse updateInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException {
+ //update
+ public static RestResponse updateInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException{
return updateInformationalArtifactToResource(artifactDetails, sdncModifierDetails, resourceUid, calculateChecksum(artifactDetails));
}
public static RestResponse updateInformationalArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid, String checksum) throws IOException {
Config config = Utils.getConfig();
- if (artifactDetails.getArtifactGroupType() != null && artifactDetails.getArtifactGroupType().equals("DEPLOYMENT")) {
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceUid);
+ if (artifactDetails.getArtifactGroupType()!=null && artifactDetails.getArtifactGroupType().equals("DEPLOYMENT")){
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceUid );
Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
Map<String, ArtifactDefinition> deploymentArtifacts = resourceRespJavaObject.getDeploymentArtifacts();
ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactDetails.getArtifactLabel());
artifactDetails.setUniqueId(artifactDefinition.getUniqueId());
artifactDetails.setArtifactLabel(artifactDefinition.getArtifactLabel());
-
+
}
-
+
String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid, artifactDetails.getUniqueId());
return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, calculateChecksum(artifactDetails), url);
}
-
+
public static RestResponse uploadArtifactToPlaceholderOnResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid, String placeHolderLabel) throws IOException {
Config config = Utils.getConfig();
- if (artifactDetails.getArtifactLabel() != null && !artifactDetails.getArtifactLabel().isEmpty()) {
- RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceUid);
+ if (artifactDetails.getArtifactLabel() != null && !artifactDetails.getArtifactLabel().isEmpty()){
+ RestResponse resourceGetResponse = ResourceRestUtils.getResource(sdncModifierDetails, resourceUid );
Resource resourceRespJavaObject = ResponseParser.convertResourceResponseToJavaObject(resourceGetResponse.getResponse());
Map<String, ArtifactDefinition> deploymentArtifacts = resourceRespJavaObject.getDeploymentArtifacts();
ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactDetails.getArtifactLabel());
AssertJUnit.assertNotNull(artifactDefinition);
artifactDetails.setUniqueId(artifactDefinition.getUniqueId());
artifactDetails.setArtifactLabel(artifactDefinition.getArtifactLabel());
-
+
}
-
+
String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid, artifactDetails.getUniqueId());
return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, calculateChecksum(artifactDetails), url);
}
-
+
+ public static RestResponse updateArtifactToResourceInstance(ArtifactDefinition artifactDefinition, User sdncModifierDetails, String resourceInstanceId, String serviceId) throws IOException {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.UPDATE_RESOURCE_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceInstanceId, artifactDefinition.getUniqueId());
+ return updateDeploymentArtifact(artifactDefinition, sdncModifierDetails, url);
+ }
+
+ public static RestResponse updateDeploymentArtifactToResource(ArtifactDefinition artifact, User sdncModifierDetails, String resourceUid) throws IOException {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid, artifact.getUniqueId());
+
+ return updateDeploymentArtifact(artifact, sdncModifierDetails, url);
+ }
public static RestResponse updateDeploymentArtifactToResource(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceUid) throws IOException {
Config config = Utils.getConfig();
String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid, artifactDetails.getUniqueId());
-
+
return updateDeploymentArtifact(artifactDetails, sdncModifierDetails, url);
}
- public static RestResponse updateArtifactToResourceInstance(ArtifactDefinition artifactDefinition, User sdncModifierDetails, String resourceInstanceId, String serviceId) throws IOException {
- Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_RESOURCE_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceInstanceId, artifactDefinition.getUniqueId());
- return updateDeploymentArtifact(artifactDefinition, sdncModifierDetails, url);
- }
public static RestResponse updateDeploymentArtifactToRI(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceInstanceId, String serviceId) throws IOException {
Config config = Utils.getConfig();
String url = String.format(Urls.UPDATE_RESOURCE_INSTANCE_HEAT_ENV_PARAMS, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceInstanceId, artifactDetails.getUniqueId());
return updateDeploymentArtifact(artifactDetails, sdncModifierDetails, url);
}
-
- // delete
- public static RestResponse deleteArtifactFromResourceInstance(ArtifactDefinition artifactDefinition, User sdncModifierDetails, String resourceUid, String serviceId) throws IOException {
+ public static RestResponse updateDeploymentArtifactToRI(ArtifactDefinition artifactDetails, User sdncModifierDetails, String resourceInstanceId, String serviceId) throws IOException {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.UPDATE_RESOURCE_INSTANCE_HEAT_ENV_PARAMS, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceInstanceId, artifactDetails.getUniqueId());
+ return updateDeploymentArtifact(artifactDetails, sdncModifierDetails, url);
+ }
+
+ //delete
+ public static RestResponse deleteArtifactFromResourceInstance (ArtifactDefinition artifactDefinition, User sdncModifierDetails, String resourceUid, String serviceId) throws IOException{
Config config = Utils.getConfig();
String url = String.format(Urls.DELETE_RESOURCE_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceUid, artifactDefinition.getUniqueId());
- return sendDelete(url, sdncModifierDetails.getUserId());
+ return sendDelete(url, sdncModifierDetails.getUserId());
}
-
- public static RestResponse deleteInformationalArtifactFromResource(String resourceUid, ArtifactReqDetails artifactDetails, User sdncModifierDetails) throws IOException {
- return deleteInformationalArtifactFromResource(resourceUid, artifactDetails.getUniqueId(), sdncModifierDetails);
+
+ public static RestResponse deleteInformationalArtifactFromResource(String resourceUid, ArtifactReqDetails artifactDetails, User sdncModifierDetails) throws IOException{
+ return deleteInformationalArtifactFromResource( resourceUid, artifactDetails.getUniqueId(), sdncModifierDetails);
}
-
- public static RestResponse deleteInformationalArtifactFromResource(String resourceUid, String artifactId, User sdncModifierDetails) throws IOException {
+
+ public static RestResponse deleteInformationalArtifactFromResource( String resourceUid, String artifactId, User sdncModifierDetails) throws IOException{
Config config = Utils.getConfig();
String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceUid, artifactId);
return sendDelete(url, sdncModifierDetails.getUserId());
}
-
- public static RestResponse deleteServiceApiArtifact(ArtifactReqDetails artifactDetails, String serviceUniqueId, User user) throws Exception {
+
+ public static RestResponse deleteServiceApiArtifact(ArtifactReqDetails artifactDetails, String serviceUniqueId, User user) throws Exception
+ {
Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_DELETE_SERVICE_API_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceUniqueId, artifactDetails.getUniqueId());
- RestResponse res = sendDelete(url, user.getUserId());
- logger.debug("Deleting api artifact was finished with response: {}", res.getErrorCode());
- logger.debug("Response body: {}", res.getResponseMessage());
+ String url = String.format(Urls.UPDATE_DELETE_SERVICE_API_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUniqueId, artifactDetails.getUniqueId());
+ RestResponse res = sendDelete(url, user.getUserId());
+ logger.debug("Deleting api artifact was finished with response: {}",res.getErrorCode());
+ logger.debug("Response body: {}",res.getResponseMessage());
return res;
}
-
- // *************** RESOURCE INSTANCE **************
+
+ //*************** RESOURCE INSTANCE **************
/**
* Add DCAE artifacts to resource instance.
- *
* @param artifactDetails
* @param sdncModifierDetails
* @param resourceInstanceId
@@ -409,132 +602,160 @@ public class ArtifactRestUtils extends BaseRestUtils {
*/
public static RestResponse addArtifactToResourceInstance(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String resourceInstanceId, String serviceId) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.ADD_RESOURCE_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId, resourceInstanceId, artifactDetails.getUniqueId());
+ String url = String.format(Urls.ADD_RESOURCE_INSTANCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId,resourceInstanceId, artifactDetails.getUniqueId());
return addArtifactToInstance(artifactDetails, sdncModifierDetails, calculateChecksum(artifactDetails), url);
}
-
- // *************** COMPONENT **************
-
+
+ //*************** COMPONENT **************
+
public static RestResponse uploadDeploymentArtifact(ArtifactReqDetails artifactDetails, Component component, User sdncModifierDetails) throws IOException {
Config config = Utils.getConfig();
Map<String, String> additionalHeaders = null;
String checksum = ResponseParser.calculateMD5Header(artifactDetails);
additionalHeaders = new HashMap<String, String>();
additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
-
+
ComponentTypeEnum componentType = component.getComponentType();
-
+
String url = null;
+
+ switch (componentType){
- switch (componentType) {
-
- case RESOURCE: {
- url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), component.getUniqueId(), artifactDetails.getUniqueId());
-
+ case RESOURCE:
+ {
+ url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(),config.getCatalogBePort(), component.getUniqueId(), artifactDetails.getUniqueId());
+
break;
}
case SERVICE: {
-
+
break;
}
-
+
case PRODUCT: {
-
+
break;
}
-
- default: {// dummy
+
+ default: {//dummy
assertTrue("failed on enum selection", false);
-
+
break;
}
}
+
+
+
Gson gson = new Gson();
String jsonBody = gson.toJson(artifactDetails);
- // System.out.println("ArtifactDetails: "+ jsonBody);
+// System.out.println("ArtifactDetails: "+ jsonBody);
RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), acceptHeaderData, additionalHeaders);
if (res.getErrorCode() == STATUS_CODE_SUCCESS) {
artifactDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(res));
}
- // System.out.println("Add artifact was finished with response: "+
- // res.getErrorCode());
+// System.out.println("Add artifact was finished with response: "+ res.getErrorCode());
return res;
}
-
+
public static RestResponse uploadArtifact(ArtifactReqDetails artifactDetails, Component component, User sdncModifierDetails) throws IOException {
Config config = Utils.getConfig();
List<String> placeHolderlst = Utils.getListOfResPlaceHoldersDepArtTypes();
Map<String, String> additionalHeaders = null;
- String checksum = null;
- String url = null;
- //
- //
- // if (artifactDetails.getArtifactGroupType() != null
- // && artifactDetails.getArtifactGroupType().equals("DEPLOYMENT")
- // && placeHolderlst.contains(artifactDetails.getArtifactType())) {
- // Map<String, ArtifactDefinition> deploymentArtifacts =
- // component.getDeploymentArtifacts();
- // ArtifactDefinition artifactDefinition =
- // deploymentArtifacts.get(artifactDetails.getArtifactLabel());
- // artifactDetails.setUniqueId(artifactDefinition.getUniqueId());
- // artifactDetails.setArtifactLabel(artifactDefinition.getArtifactLabel());
- // checksum = ResponseParser.calculateMD5Header(artifactDetails);
- // additionalHeaders = new HashMap<String, String>();
- // additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(),
- // checksum);
- // url = String.format(Urls.UPDATE_ARTIFACT_OF_COMPONENT,
- // config.getCatalogBeHost(),
- // config.getCatalogBePort(),
- // ComponentTypeEnum.findParamByType(component.getComponentType()),
- // component.getUniqueId(), artifactDetails.getUniqueId());
- // }
- //
- // else {
- checksum = ResponseParser.calculateMD5Header(artifactDetails);
- additionalHeaders = new HashMap<String, String>();
- additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
- url = String.format(Urls.UPLOAD_DELETE_ARTIFACT_OF_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId(), artifactDetails.getUniqueId());
- // }
-
+ String checksum = null;
+ String url= null;
+//
+//
+// if (artifactDetails.getArtifactGroupType() != null
+// && artifactDetails.getArtifactGroupType().equals("DEPLOYMENT")
+// && placeHolderlst.contains(artifactDetails.getArtifactType())) {
+// Map<String, ArtifactDefinition> deploymentArtifacts = component.getDeploymentArtifacts();
+// ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactDetails.getArtifactLabel());
+// artifactDetails.setUniqueId(artifactDefinition.getUniqueId());
+// artifactDetails.setArtifactLabel(artifactDefinition.getArtifactLabel());
+// checksum = ResponseParser.calculateMD5Header(artifactDetails);
+// additionalHeaders = new HashMap<String, String>();
+// additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
+// url = String.format(Urls.UPDATE_ARTIFACT_OF_COMPONENT, config.getCatalogBeHost(),
+// config.getCatalogBePort(), ComponentTypeEnum.findParamByType(component.getComponentType()),
+// component.getUniqueId(), artifactDetails.getUniqueId());
+// }
+//
+// else {
+ checksum = ResponseParser.calculateMD5Header(artifactDetails);
+ additionalHeaders = new HashMap<String, String>();
+ additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
+ url = String.format(Urls.UPLOAD_DELETE_ARTIFACT_OF_COMPONENT, config.getCatalogBeHost(),
+ config.getCatalogBePort(), ComponentTypeEnum.findParamByType(component.getComponentType()),
+ component.getUniqueId(), artifactDetails.getUniqueId());
+// }
+
Gson gson = new Gson();
String jsonBody = gson.toJson(artifactDetails);
- // System.out.println("ArtifactDetails: "+ jsonBody);
+// System.out.println("ArtifactDetails: "+ jsonBody);
RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), acceptHeaderData, additionalHeaders);
if (res.getErrorCode() == STATUS_CODE_SUCCESS) {
artifactDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(res));
}
- // System.out.println("Add artifact was finished with response: "+
- // res.getErrorCode());
+// System.out.println("Add artifact was finished with response: "+ res.getErrorCode());
return res;
}
+
+
+
+
+ //*************** PRIVATE **************
+ private static RestResponse deleteInformationalArtifact(User sdncModifierDetails, String url) throws IOException {
+ Map<String, String> additionalHeaders = null;
- // *************** PRIVATE **************
+ additionalHeaders = new HashMap<String, String>();
+
+
+ additionalHeaders.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ additionalHeaders.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
+
+ return sendDelete(url, sdncModifierDetails.getUserId(), additionalHeaders);
+
+// Gson gson = new Gson();
+//// System.out.println("ArtifactDetails: "+ jsonBody);
+// String jsonBody = gson.toJson(artifactDetails);
+//
+// RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), acceptHeaderData, additionalHeaders);
+// if ((res.getErrorCode() == STATUS_CODE_SUCCESS) || (res.getErrorCode() == STATUS_CODE_CREATED)) {
+// artifactDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(res));
+// }
+//// System.out.println("Add artifact was finished with response: "+ res.getErrorCode());
+// return res;
+ }
+
+ private static RestResponse updateInformationalArtifact(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String checksum, String url) throws IOException {
+ return uploadInformationalArtifact(artifactDetails, sdncModifierDetails, checksum, url);
+ }
+
private static RestResponse uploadInformationalArtifact(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String checksum, String url) throws IOException {
Map<String, String> additionalHeaders = null;
if (checksum != null && !checksum.isEmpty()) {
additionalHeaders = new HashMap<String, String>();
additionalHeaders.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
}
-
+
additionalHeaders.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
additionalHeaders.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
Gson gson = new Gson();
- // System.out.println("ArtifactDetails: "+ jsonBody);
+// System.out.println("ArtifactDetails: "+ jsonBody);
String jsonBody = gson.toJson(artifactDetails);
RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), acceptHeaderData, additionalHeaders);
if ((res.getErrorCode() == STATUS_CODE_SUCCESS) || (res.getErrorCode() == STATUS_CODE_CREATED)) {
artifactDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(res));
}
- // System.out.println("Add artifact was finished with response: "+
- // res.getErrorCode());
+// System.out.println("Add artifact was finished with response: "+ res.getErrorCode());
return res;
}
-
+
private static RestResponse addArtifactToInstance(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String checksum, String url) throws IOException {
Map<String, String> additionalHeaders = null;
additionalHeaders = new HashMap<String, String>();
@@ -554,62 +775,62 @@ public class ArtifactRestUtils extends BaseRestUtils {
}
return res;
}
-
+
private static RestResponse updateDeploymentArtifact(ArtifactDefinition artifactDefinition, User sdncModifierDetails, String url) throws IOException {
Map<String, String> additionalHeaders = null;
additionalHeaders = new HashMap<String, String>();
additionalHeaders.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json, text/plain, */*");
additionalHeaders.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json;charset=UTF-8");
-
+
Gson gson = new Gson();
String jsonBody = gson.toJson(artifactDefinition);
RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), "application/json, text/plain, */*", additionalHeaders);
return res;
}
-
+
private static RestResponse updateDeploymentArtifact(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String url) throws IOException {
Map<String, String> additionalHeaders = null;
-
- additionalHeaders = new HashMap<String, String>();
- additionalHeaders.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json, text/plain, */*");
- additionalHeaders.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json;charset=UTF-8");
- // additionalHeaders.put(HttpHeaderEnum..getValue(),
- // "application/json;charset=UTF-8");
+
+ additionalHeaders = new HashMap<String, String>();
+ additionalHeaders.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json, text/plain, */*");
+ additionalHeaders.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json;charset=UTF-8");
+// additionalHeaders.put(HttpHeaderEnum..getValue(), "application/json;charset=UTF-8");
+
Gson gson = new Gson();
String jsonBody = gson.toJson(artifactDetails);
- // System.out.println("ArtifactDetails: "+ jsonBody);
+// System.out.println("ArtifactDetails: "+ jsonBody);
RestResponse res = sendPost(url, jsonBody, sdncModifierDetails.getUserId(), "application/json, text/plain, */*", additionalHeaders);
if (res.getErrorCode() == STATUS_CODE_SUCCESS) {
artifactDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(res));
}
- // System.out.println("Add artifact was finished with response: "+
- // res.getErrorCode());
+// System.out.println("Add artifact was finished with response: "+ res.getErrorCode());
return res;
}
-
- private static RestResponse downloadArtifact(String url, User user, Map<String, String> addionalHeaders, boolean addEcompHeader) throws IOException {
- if (addEcompHeader) {
+
+ private static RestResponse downloadArtifact(String url, User user, Map<String, String> addionalHeaders,boolean addEcompHeader) throws IOException
+ {
+ if(addEcompHeader){
addionalHeaders.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), ecomp);
}
return downloadArtifact(url, user, addionalHeaders, acceptOctetStream);
}
-
- private static RestResponse downloadArtifact(String url, User user, Map<String, String> addionalHeaders, String accept) throws IOException {
+
+ private static RestResponse downloadArtifact(String url, User user, Map<String, String> addionalHeaders, String accept) throws IOException
+ {
addionalHeaders.put(HttpHeaderEnum.ACCEPT.getValue(), accept);
-
- RestResponse res = sendGet(url, user.getUserId(), addionalHeaders);
- // System.out.println("download artifact was finished with response: "+
- // res.getErrorCode());
- // System.out.println("response is: " + res.getResponse());
+
+ RestResponse res = sendGet(url, user.getUserId(), addionalHeaders);
+// System.out.println("download artifact was finished with response: "+ res.getErrorCode());
+// System.out.println("response is: " + res.getResponse());
return res;
}
-
- private static Map<String, Map<String, Object>> getArtifactsListFromResponse(String jsonResponse, String fieldOfArtifactList) {
- JSONObject object = (JSONObject) JSONValue.parse(jsonResponse);
- Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList);
+
+ private static Map<String,Map<String,Object>> getArtifactsListFromResponse(String jsonResponse, String fieldOfArtifactList){
+ JSONObject object = (JSONObject)JSONValue.parse(jsonResponse);
+ Map<String,Map<String,Object>> map = (Map<String,Map<String,Object>>)object.get(fieldOfArtifactList);
return map;
}
@@ -620,40 +841,47 @@ public class ArtifactRestUtils extends BaseRestUtils {
}
return checksum;
}
-
- public static String encodeUrlForDownload(String url) {
+
+ public static String encodeUrlForDownload(String url){
return url.replaceAll(" ", "%20");
}
-
- public static String getPartialUrlByArtifactName(ServiceReqDetails serviceDetails, String serviceVersion, String artifactName) {
+
+ public static String getPartialUrlByArtifactName(ServiceReqDetails serviceDetails,String serviceVersion ,String artifactName){
return encodeUrlForDownload(String.format(Urls.DISTRIB_DOWNLOAD_SERVICE_ARTIFACT_RELATIVE_URL, ValidationUtils.convertToSystemName(serviceDetails.getName()), serviceVersion, artifactName));
}
-
- public static String getUniqueIdOfArtifact(RestResponse createResponse, String artifactField, String requieredArtifactLabel) throws Exception {
+
+ public static String getUniqueIdOfArtifact(RestResponse createResponse, String artifactField, String requieredArtifactLabel) throws Exception
+ {
Map<String, Object> artifact = getArtifactFromRestResponse(createResponse, artifactField, requieredArtifactLabel);
assertNotNull(artifact);
return artifact.get("uniqueId").toString();
}
-
- public static Map<String, Object> getArtifactFromRestResponse(RestResponse response, String artifactField, String requieredArtifactLabel) {
+
+ public static Map<String, Object> getArtifactFromRestResponse(RestResponse response, String artifactField, String requieredArtifactLabel)
+ {
Map<String, Map<String, Object>> map = getArtifactsListFromResponse(response.getResponse(), artifactField);
return map.get(requieredArtifactLabel);
}
+
- public static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid) throws IOException {
+
+ public static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid) throws IOException
+ {
return updateInformationalArtifactPayloadOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, calculateMD5Header(artifactDetails));
}
-
- private static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum) throws IOException {
+
+ private static RestResponse updateInformationalArtifactPayloadOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum) throws IOException
+ {
return updateInformationalArtifactOfService(artifactDetails, sdncModifierDetails, serviceUid, artifactUid, checksum, true);
}
-
- private static RestResponse updateInformationalArtifactOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum, boolean isPayloadUpdate) throws IOException {
+
+ private static RestResponse updateInformationalArtifactOfService(ArtifactReqDetails artifactDetails, User sdncModifierDetails, String serviceUid, String artifactUid, String checksum, boolean isPayloadUpdate) throws IOException
+ {
Config config = Utils.getConfig();
Map<String, String> headersMap = prepareHeadersMap(sdncModifierDetails.getUserId());
- if (isPayloadUpdate) {
+ if (isPayloadUpdate){
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), checksum);
}
@@ -662,22 +890,22 @@ public class ArtifactRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
- String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), serviceUid, artifactUid);
- RestResponse res = http.httpSendPost(url, jsonBody, headersMap);
- // System.out.println("update artifact was finished with response: "+
- // res.getErrorCode());
+ String url = String.format(Urls.UPDATE_OR_DELETE_ARTIFACT_OF_SERVICE, config.getCatalogBeHost(),config.getCatalogBePort(), serviceUid, artifactUid);
+ RestResponse res = http.httpSendPost(url, jsonBody, headersMap);
+// System.out.println("update artifact was finished with response: "+ res.getErrorCode());
return res;
}
-
- public static String calculateMD5Header(ArtifactReqDetails artifactDetails) {
+
+ public static String calculateMD5Header(ArtifactReqDetails artifactDetails)
+ {
Gson gson = new Gson();
String jsonBody = gson.toJson(artifactDetails);
// calculate MD5 for json body
return calculateMD5(jsonBody);
}
-
- public static String calculateMD5(String data) {
+
+ public static String calculateMD5 (String data){
String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
// encode base-64 result
byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
@@ -686,4 +914,7 @@ public class ArtifactRestUtils extends BaseRestUtils {
}
+
+
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
index 39001403b9..7272e345ae 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java
@@ -24,6 +24,7 @@ import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
import java.io.IOException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -36,12 +37,14 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.codehaus.jackson.map.ObjectMapper;
import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactAssetStructure;
@@ -68,7 +71,8 @@ public class AssetRestUtils extends BaseRestUtils {
static Gson gson = new Gson();
static ObjectMapper objectMapper = new ObjectMapper();
- static Logger logger = LoggerFactory.getLogger(UserRestUtils.class.getName());
+ private static Logger logger = LoggerFactory.getLogger(UserRestUtils.class.getName());
+
static final String contentTypeHeaderData = "application/json";
static final String acceptHeaderDate = "application/json";
static final String basicAuthentication = "Basic Y2k6MTIzNDU2";
@@ -87,10 +91,35 @@ public class AssetRestUtils extends BaseRestUtils {
httpGet.addHeader(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
httpGet.addHeader(HttpHeaderEnum.AUTHORIZATION.getValue(), basicAuthentication);
- logger.debug("Send GET request to get Tosca model: {}", url);
+ logger.debug("Send GET request to get Tosca model: {}",url);
return httpclient.execute(httpGet);
}
+
+ public static RestResponse getRestResponseComponentToscaModel(AssetTypeEnum assetType, String uuid) throws IOException {
+ Config config = Utils.getConfig();
+
+ String url = String.format(Urls.GET_TOSCA_MODEL, config.getCatalogBeHost(), config.getCatalogBePort(),
+ assetType.getValue(), uuid);
+
+ Map<String, String> headersMap = new HashMap<String,String>();
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
+
+ HttpRequest http = new HttpRequest();
+
+ logger.debug("Send GET request to get Resource Assets: {}",url);
+ System.out.println("Send GET request to get Resource Assets: " + url);
+
+ logger.debug("Request headers: {}",headersMap);
+ System.out.println("Request headers: " + headersMap);
+
+ RestResponse sendGetResourceAssets = http.httpSendGet(url, headersMap);
+
+ return sendGetResourceAssets;
+
+ }
public static RestResponse getComponentListByAssetType(boolean isBasicAuthentication, AssetTypeEnum assetType,
String... filterArrayString) throws IOException {
@@ -128,8 +157,8 @@ public class AssetRestUtils extends BaseRestUtils {
String url = String.format(Urls.GET_FILTERED_ASSET_LIST, config.getCatalogBeHost(), config.getCatalogBePort(),
assetType.getValue(), query);
- logger.debug("Send GET request to get Resource Assets: {}", url);
- logger.debug("Request headers: {}", headersMap);
+ logger.debug("Send GET request to get Resource Assets: {}",url);
+ logger.debug("Request headers: {}",headersMap);
RestResponse sendGetResourceAssets = http.httpSendGet(url, headersMap);
@@ -166,8 +195,8 @@ public class AssetRestUtils extends BaseRestUtils {
String url = String.format(Urls.GET_ASSET_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(),
assetType.getValue(), uuid);
- logger.debug("Send GET request to get Resource Assets: {}", url);
- logger.debug("Request headers: {} ", headersMap);
+ logger.debug("Send GET request to get Resource Assets: {}",url);
+ logger.debug("Request headers: {}",headersMap);
RestResponse sendGetResourceAssets = http.httpSendGet(url, headersMap);
@@ -395,9 +424,9 @@ public class AssetRestUtils extends BaseRestUtils {
.equals(resourceInstanceAssetStructure.getResourceVersion()));
assertTrue(
"Expected RI asset resourceType is " + componentInstance.getOriginType() + " actual: "
- + resourceInstanceAssetStructure.getResourceType(),
+ + resourceInstanceAssetStructure.getResoucreType(),
componentInstance.getOriginType().toString()
- .equals(resourceInstanceAssetStructure.getResourceType()));
+ .equals(resourceInstanceAssetStructure.getResoucreType()));
assertTrue(
"Expected RI asset resourceUUID is " + componentInstance.getComponentUid() + " actual: "
+ resourceInstanceAssetStructure.getResourceUUID(),
@@ -507,4 +536,24 @@ public class AssetRestUtils extends BaseRestUtils {
resourceAsset.getResourceType().equals(resourceType.toString()));
}
}
+
+ public static void checkComponentTypeInObjectList(List<ResourceAssetStructure> resourceAssetList,
+ ComponentTypeEnum componentType) {
+ ComponentTypeEnum actualComponentType;
+ for (ResourceAssetStructure resourceAsset : resourceAssetList) {
+ actualComponentType = detectComponentType(resourceAsset);
+ assertTrue(
+ "Expected componentType is " + componentType.getValue() + " actual: " + actualComponentType.getValue(),
+ actualComponentType.equals(componentType));
+ }
+ }
+
+ private static ComponentTypeEnum detectComponentType(ResourceAssetStructure resourceAsset) {
+ String resourceType = resourceAsset.getResourceType();
+ if(ResourceTypeEnum.getType(resourceType) !=null){
+ return ComponentTypeEnum.RESOURCE;
+ }
+ return null;
+ }
+
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
index 9ffe5782e7..080583b901 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
@@ -210,8 +210,15 @@ public class BaseRestUtils extends BaseValidationUtils {
// DELETE
protected static RestResponse sendDelete(String url, String userId) throws IOException {
+ return sendDelete(url, userId, null);
+ }
+
+ protected static RestResponse sendDelete(String url, String userId, Map<String, String> additionalHeaders) throws IOException {
Map<String, String> headersMap = prepareHeadersMap(userId);
-
+ if (additionalHeaders != null) {
+ headersMap.putAll(additionalHeaders);
+ }
+
HttpRequest http = new HttpRequest();
RestResponse deleteResourceResponse = http.httpSendDelete(url, headersMap);
return deleteResourceResponse;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
index d9ae91b955..f5791efbb3 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CategoryRestUtils.java
@@ -61,7 +61,8 @@ public class CategoryRestUtils extends BaseRestUtils {
// GET categories
public static RestResponse getAllCategories(User sdncModifierDetails, String categoryType) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_ALL_CATEGORIES, config.getCatalogBeHost(), config.getCatalogBePort(), categoryType);
+ String url = String.format(Urls.GET_ALL_CATEGORIES, config.getCatalogBeHost(), config.getCatalogBePort(),
+ categoryType);
String userId = sdncModifierDetails.getUserId();
Map<String, String> headersMap = prepareHeadersMap(userId);
HttpRequest http = new HttpRequest();
@@ -70,9 +71,11 @@ public class CategoryRestUtils extends BaseRestUtils {
return getCategotyResponse;
}
- public static RestResponse getAllCategoriesTowardsFe(User sdncModifierDetails, String categoryType) throws Exception {
+ public static RestResponse getAllCategoriesTowardsFe(User sdncModifierDetails, String categoryType)
+ throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(), categoryType);
+ String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(),
+ categoryType);
String userId = sdncModifierDetails.getUserId();
Map<String, String> headersMap = prepareHeadersMap(userId);
HttpRequest http = new HttpRequest();
@@ -82,12 +85,14 @@ public class CategoryRestUtils extends BaseRestUtils {
}
// Delete Category
- public static RestResponse deleteCategory(String categoryId, String psUserId, String categoryType) throws Exception {
+ public static RestResponse deleteCategory(String categoryId, String userId, String categoryType)
+ throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_CATEGORY, config.getCatalogBeHost(), config.getCatalogBePort(), categoryType, categoryId);
+ String url = String.format(Urls.DELETE_CATEGORY, config.getCatalogBeHost(), config.getCatalogBePort(),
+ categoryType, categoryId);
url = url.replace("#", "%23"); // HEX
url = url.replace(" ", "%20"); // HEX
- RestResponse deleteCategoryResponse = sendDelete(url, psUserId);
+ RestResponse deleteCategoryResponse = sendDelete(url, userId);
return deleteCategoryResponse;
}
@@ -166,9 +171,13 @@ public class CategoryRestUtils extends BaseRestUtils {
return addCategoryResponse;
}
- public static RestResponse deleteCatergoryHttpCspAtuUidIsMissing(CategoryDefinition categoryDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse deleteCatergoryHttpCspAtuUidIsMissing(CategoryDefinition categoryDataDefinition,
+ User sdncModifierDetails) throws Exception {
+
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(), categoryDataDefinition.getName());
+ String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(),
+ categoryDataDefinition.getName());
+
String userId = sdncModifierDetails.getUserId();
Map<String, String> headersMap = prepareHeadersMap(userId);
headersMap.remove("USER_ID");
@@ -184,9 +193,11 @@ public class CategoryRestUtils extends BaseRestUtils {
public static RestResponse createGrouping(GroupingDefinition grouping, SubCategoryDefinition subCategory,
CategoryDefinition parentCategory, User sdncModifierDetails, String categoryType) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.CREATE_GROUPING, config.getCatalogBeHost(), config.getCatalogBePort(), categoryType, parentCategory.getUniqueId(), subCategory.getUniqueId());
+ String url = String.format(Urls.CREATE_GROUPING, config.getCatalogBeHost(), config.getCatalogBePort(),
+ categoryType, parentCategory.getUniqueId(), subCategory.getUniqueId());
String bodyJson = gson.toJson(grouping);
- RestResponse addGroupingResponse = BaseRestUtils.sendPost(url, bodyJson, sdncModifierDetails.getUserId(), acceptHeaderData);
+ RestResponse addGroupingResponse = BaseRestUtils.sendPost(url, bodyJson, sdncModifierDetails.getUserId(),
+ acceptHeaderData);
return addGroupingResponse;
}
@@ -281,8 +292,7 @@ public class CategoryRestUtils extends BaseRestUtils {
}
public enum CategoryAuditJsonKeysEnum {
- ACTION("ACTION"), MODIFIER("MODIFIER"), CATEGORY_NAME("CATEGORY_NAME"), SUB_CATEGORY_NAME("SUB_CATEGORY_NAME"), GROUPING_NAME("GROUPING_NAME"), RESOURCE_TYPE("RESOURCE_TYPE"), ECOMP_USER("ECOMP_USER"), STATUS("STATUS"),
- DESCRIPTION("DESCRIPTION"), DETAILS("DETAILS");
+ ACTION("ACTION"), MODIFIER("MODIFIER"), CATEGORY_NAME("CATEGORY_NAME"), SUB_CATEGORY_NAME("SUB_CATEGORY_NAME"), GROUPING_NAME("GROUPING_NAME"), RESOURCE_TYPE("RESOURCE_TYPE"), ECOMP_USER("ECOMP_USER"), STATUS("STATUS"), DESCRIPTION("DESCRIPTION"), DETAILS("DETAILS");
private String auditJsonKeyName;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
index 10587390f2..21332a253c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentInstanceRestUtils.java
@@ -100,7 +100,24 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
return sendGetServerRequest;
}
+
+ public static RestResponse getComponentInstancePropertiesByID(ComponentTypeEnum type, String componentId, String resourceInstanceId, User user)
+ throws IOException {
+
+ Config config = Utils.getConfig();
+
+ Map<String, String> headersMap = new HashMap<String, String>();
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
+ headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderData);
+ headersMap.put(HttpHeaderEnum.USER_ID.getValue(), user.getUserId());
+
+ String url = String.format(Urls.GET_COMPONENT_INSTANCE_PROPERTIES_BY_ID, config.getCatalogBeHost(), config.getCatalogBePort(),
+ ComponentTypeEnum.findParamByType(type), componentId, resourceInstanceId);
+
+ return sendGet(url, user.getUserId(), headersMap);
+ }
+
public static RestResponse deleteComponentInstance(User sdncModifierDetails, String componentId,
String resourceInstanceId, ComponentTypeEnum componentType) throws Exception {
@@ -130,8 +147,19 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
RestResponse updateResourceInstance = sendPost(url, serviceBodyJson, userId, acceptHeaderData);
return updateResourceInstance;
}
+ public static RestResponse updateComponentInstance(ComponentInstance componentInstance,
+ User sdncModifierDetails, String componentId, ComponentTypeEnum componentType) throws IOException {
+
+ Config config = Utils.getConfig();
+ String userId = sdncModifierDetails.getUserId();
+ String serviceBodyJson = gson.toJson(componentInstance);
+ String url = String.format(Urls.UPDATE_COMPONENT_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ ComponentTypeEnum.findParamByType(componentType), componentId,
+ componentInstance.getUniqueId());
+ RestResponse updateResourceInstance = sendPost(url, serviceBodyJson, userId, acceptHeaderData);
+ return updateResourceInstance;
+ }
- // TODO Tal CI for New API Multiple Instance Update
public static RestResponse updateMultipleComponentInstance(
List<ComponentInstanceReqDetails> componentInstanceReqDetailsList, User sdncModifierDetails,
String componentId, ComponentTypeEnum componentType) throws IOException {
@@ -161,7 +189,7 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
break;
}
String serviceBodyJson = gson.toJson(relation);
- String url = String.format(Urls.ASSOCIATE__RESOURCE_INSTANCE, config.getCatalogBeHost(),
+ String url = String.format(Urls.ASSOCIATE_RESOURCE_INSTANCE, config.getCatalogBeHost(),
config.getCatalogBePort(), componentType, componentId);
RestResponse associateInstance = sendPost(url, serviceBodyJson, sdncModifierDetails.getUserId(),
@@ -187,7 +215,7 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
break;
}
String serviceBodyJson = gson.toJson(relation);
- String url = String.format(Urls.DISSOCIATE__RESOURCE_INSTANCE, config.getCatalogBeHost(),
+ String url = String.format(Urls.DISSOCIATE_RESOURCE_INSTANCE, config.getCatalogBeHost(),
config.getCatalogBePort(), componentType, componentId);
RestResponse associateInstance = sendPut(url, serviceBodyJson, sdncModifierDetails.getUserId(),
@@ -236,7 +264,7 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
Config config = Utils.getConfig();
String resourceUid = ("{\"componentUid\":\"" + component.getUniqueId() + "\"}");
- String url = String.format(Urls.CHANGE__RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
+ String url = String.format(Urls.CHANGE_RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentType), containerUID,
componentInstanceToReplace.getUniqueId());
RestResponse changeResourceInstanceVersion = sendPost(url, resourceUid, sdncModifierDetails.getUserId(),
@@ -264,7 +292,7 @@ public class ComponentInstanceRestUtils extends BaseRestUtils {
ComponentTypeEnum componentType) throws IOException {
Config config = Utils.getConfig();
String resourceUid = ("{\"componentUid\":\"" + serviceUniqueId + "\"}");
- String url = String.format(Urls.CHANGE__RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
+ String url = String.format(Urls.CHANGE_RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentType), componentUniqueId,
serviceInstanceToReplaceUniqueId);
RestResponse changeResourceInstanceVersion = sendPost(url, resourceUid, sdncModifierDetails.getUserId(),
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
index dcebe4afa8..8237819d7a 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ComponentRestUtils.java
@@ -59,4 +59,12 @@ public class ComponentRestUtils extends BaseRestUtils {
CapReqDef capReqDef = ResponseParser.parseToObject(getComponentReqCap.getResponse(), CapReqDef.class);
return capReqDef;
}
+
+ public static RestResponse validateConformanceLevel(String uuid, String userId) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VALIDATE_CONFORMANCE_LEVEL, config.getCatalogBeHost(), config.getCatalogBePort(), "services", uuid);
+
+ RestResponse res = sendGet(url, userId);
+ return res;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
index 1b93d8d778..71735d5a4a 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
@@ -45,7 +45,8 @@ public class ConsumerRestUtils extends BaseRestUtils {
private static Long expectedsLastupdatedtime;
private static Long expectedLastAuthenticationTime;
- public static RestResponse createConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse createConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails)
+ throws Exception {
Config config = Utils.getConfig();
String url = String.format(Urls.CREATE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort());
@@ -63,14 +64,17 @@ public class ConsumerRestUtils extends BaseRestUtils {
RestResponse createConsumerResponse = http.httpSendPost(url, userBodyJson, headersMap);
if (createConsumerResponse.getErrorCode() == STATUS_CODE_CREATED) {
ConsumerDataDefinition getConsumerDataObject = parseComsumerResp(createConsumerResponse);
- consumerDataDefinition.setConsumerDetailsLastupdatedtime(getConsumerDataObject.getConsumerDetailsLastupdatedtime());
- consumerDataDefinition.setConsumerLastAuthenticationTime(getConsumerDataObject.getConsumerLastAuthenticationTime());
+ consumerDataDefinition
+ .setConsumerDetailsLastupdatedtime(getConsumerDataObject.getConsumerDetailsLastupdatedtime());
+ consumerDataDefinition
+ .setConsumerLastAuthenticationTime(getConsumerDataObject.getConsumerLastAuthenticationTime());
consumerDataDefinition.setLastModfierAtuid(getConsumerDataObject.getLastModfierAtuid());
}
return createConsumerResponse;
}
- public static RestResponse createConsumerHttpCspAtuUidIsMissing(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse createConsumerHttpCspAtuUidIsMissing(ConsumerDataDefinition consumerDataDefinition,
+ User sdncModifierDetails) throws Exception {
Config config = Utils.getConfig();
String url = String.format(Urls.CREATE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort());
@@ -86,17 +90,21 @@ public class ConsumerRestUtils extends BaseRestUtils {
RestResponse createConsumerResponse = http.httpSendPost(url, userBodyJson, headersMap);
if (createConsumerResponse.getErrorCode() == STATUS_CODE_CREATED) {
ConsumerDataDefinition getConsumerDataObject = parseComsumerResp(createConsumerResponse);
- consumerDataDefinition.setConsumerDetailsLastupdatedtime(getConsumerDataObject.getConsumerDetailsLastupdatedtime());
- consumerDataDefinition.setConsumerLastAuthenticationTime(getConsumerDataObject.getConsumerLastAuthenticationTime());
+ consumerDataDefinition
+ .setConsumerDetailsLastupdatedtime(getConsumerDataObject.getConsumerDetailsLastupdatedtime());
+ consumerDataDefinition
+ .setConsumerLastAuthenticationTime(getConsumerDataObject.getConsumerLastAuthenticationTime());
consumerDataDefinition.setLastModfierAtuid(getConsumerDataObject.getLastModfierAtuid());
}
return createConsumerResponse;
}
- public static RestResponse deleteConsumerHttpCspAtuUidIsMissing(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse deleteConsumerHttpCspAtuUidIsMissing(ConsumerDataDefinition consumerDataDefinition,
+ User sdncModifierDetails) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(), consumerDataDefinition.getConsumerName());
+ String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(),
+ consumerDataDefinition.getConsumerName());
String userId = sdncModifierDetails.getUserId();
Map<String, String> headersMap = prepareHeadersMap(userId);
@@ -124,10 +132,12 @@ public class ConsumerRestUtils extends BaseRestUtils {
return null;
}
- public static RestResponse deleteConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse deleteConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails)
+ throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(), consumerDataDefinition.getConsumerName());
+ String url = String.format(Urls.DELETE_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(),
+ consumerDataDefinition.getConsumerName());
String userId = sdncModifierDetails.getUserId();
@@ -138,10 +148,12 @@ public class ConsumerRestUtils extends BaseRestUtils {
return deleteConsumerResponse;
}
- public static RestResponse getConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails) throws Exception {
+ public static RestResponse getConsumer(ConsumerDataDefinition consumerDataDefinition, User sdncModifierDetails)
+ throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(), consumerDataDefinition.getConsumerName());
+ String url = String.format(Urls.GET_CONSUMER, config.getCatalogBeHost(), config.getCatalogBePort(),
+ consumerDataDefinition.getConsumerName());
String userId = sdncModifierDetails.getUserId();
@@ -152,7 +164,8 @@ public class ConsumerRestUtils extends BaseRestUtils {
return getConsumerResponse;
}
- public static void validateConsumerReqVsResp(ConsumerDataDefinition consumerDefinition, ConsumerDataDefinition getConsumerDataObject) {
+ public static void validateConsumerReqVsResp(ConsumerDataDefinition consumerDefinition,
+ ConsumerDataDefinition getConsumerDataObject) {
String expected;
@@ -169,10 +182,12 @@ public class ConsumerRestUtils extends BaseRestUtils {
assertEquals("consumer Salt - ", expected, getConsumerDataObject.getConsumerSalt());
expectedsLastupdatedtime = consumerDefinition.getConsumerDetailsLastupdatedtime();
- assertEquals("consumer Last updated time - ", expectedsLastupdatedtime, getConsumerDataObject.getConsumerDetailsLastupdatedtime());
+ assertEquals("consumer Last updated time - ", expectedsLastupdatedtime,
+ getConsumerDataObject.getConsumerDetailsLastupdatedtime());
expectedLastAuthenticationTime = consumerDefinition.getConsumerLastAuthenticationTime();
- assertEquals("consumer Last authentication time - ", expectedLastAuthenticationTime, getConsumerDataObject.getConsumerLastAuthenticationTime());
+ assertEquals("consumer Last authentication time - ", expectedLastAuthenticationTime,
+ getConsumerDataObject.getConsumerLastAuthenticationTime());
}
///// New
@@ -190,17 +205,41 @@ public class ConsumerRestUtils extends BaseRestUtils {
}
/*
- * protected void resourceArtifatAuditSuccess(String action, ArtifactReqDetails artifact, ResourceReqDetails resourceDetails , User user) throws Exception { ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
- * Convertor.constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), user); String auditAction = action; expectedResourceAuditJavaObject.setAction(auditAction); expectedResourceAuditJavaObject.setPrevState("");
- * expectedResourceAuditJavaObject.setPrevVersion(""); expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum. NOT_CERTIFIED_CHECKOUT).toString()); expectedResourceAuditJavaObject.setStatus("200");
- * expectedResourceAuditJavaObject.setDesc("OK"); expectedResourceAuditJavaObject.setArtifactName(artifact.getArtifactName( )); AuditUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null); }
+ * protected void resourceArtifatAuditSuccess(String action,
+ * ArtifactReqDetails artifact, ResourceReqDetails resourceDetails , User
+ * user) throws Exception { ExpectedResourceAuditJavaObject
+ * expectedResourceAuditJavaObject =
+ * Convertor.constructFieldsForAuditValidation(resourceDetails,
+ * resourceDetails.getVersion(), user); String auditAction = action;
+ * expectedResourceAuditJavaObject.setAction(auditAction);
+ * expectedResourceAuditJavaObject.setPrevState("");
+ * expectedResourceAuditJavaObject.setPrevVersion("");
+ * expectedResourceAuditJavaObject.setCurrState((LifecycleStateEnum.
+ * NOT_CERTIFIED_CHECKOUT).toString());
+ * expectedResourceAuditJavaObject.setStatus("200");
+ * expectedResourceAuditJavaObject.setDesc("OK");
+ * expectedResourceAuditJavaObject.setArtifactName(artifact.getArtifactName(
+ * )); AuditUtils.validateAudit(expectedResourceAuditJavaObject,
+ * auditAction, null); }
*/
/*
- * protected void resourceArtifatValidateAuditWithErrorMessage(String actionStatus, ResourceReqDetails resourceDetails, String auditAction, String setCurrState, Object ... variables)throws Exception { ErrorInfo errorInfo =
- * utils.parseYaml(actionStatus); ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor.constructFieldsForAuditValidation(resourceDetails, resourceDetails.getVersion(), sdncUserDetails);
- * expectedResourceAuditJavaObject.setAction(auditAction); expectedResourceAuditJavaObject.setPrevState(""); expectedResourceAuditJavaObject.setPrevVersion(""); expectedResourceAuditJavaObject.setCurrState(setCurrState);
- * expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString()) ; expectedResourceAuditJavaObject.setDesc(errorInfo.getAuditDesc(variables) ); expectedResourceAuditJavaObject.setArtifactName("");
- * AuditUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, null); }
+ * protected void resourceArtifatValidateAuditWithErrorMessage(String
+ * actionStatus, ResourceReqDetails resourceDetails, String auditAction,
+ * String setCurrState, Object ... variables)throws Exception { ErrorInfo
+ * errorInfo = utils.parseYaml(actionStatus);
+ * ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject =
+ * Convertor.constructFieldsForAuditValidation(resourceDetails,
+ * resourceDetails.getVersion(), sdncUserDetails);
+ * expectedResourceAuditJavaObject.setAction(auditAction);
+ * expectedResourceAuditJavaObject.setPrevState("");
+ * expectedResourceAuditJavaObject.setPrevVersion("");
+ * expectedResourceAuditJavaObject.setCurrState(setCurrState);
+ * expectedResourceAuditJavaObject.setStatus(errorInfo.getCode().toString())
+ * ;
+ * expectedResourceAuditJavaObject.setDesc(errorInfo.getAuditDesc(variables)
+ * ); expectedResourceAuditJavaObject.setArtifactName("");
+ * AuditUtils.validateAudit(expectedResourceAuditJavaObject, auditAction,
+ * null); }
*/
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
index a71711dde6..ec40c13894 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/EcompUserRestUtils.java
@@ -42,8 +42,8 @@ import com.google.gson.Gson;
public class EcompUserRestUtils extends BaseRestUtils {
static Gson gson = new Gson();
+ private static Logger logger = LoggerFactory.getLogger(UserRestUtils.class.getName());
- static Logger logger = LoggerFactory.getLogger(UserRestUtils.class.getName());
static String contentTypeHeaderData = "application/json";
static String acceptHeaderDate = "application/json";
static String ecompUsername = "12345";
@@ -69,9 +69,9 @@ public class EcompUserRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
String url = String.format(Urls.ECOMP_PUSH_USER, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send POST request to create user: {}", url);
- logger.debug("User body: {}", userBodyJson);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send POST request to create user: {}",url);
+ logger.debug("User body: {}",userBodyJson);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendPushUserResponse = http.httpSendPost(url, userBodyJson, headersMap);
@@ -95,9 +95,9 @@ public class EcompUserRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
String url = String.format(Urls.ECOMP_EDIT_USER, config.getCatalogBeHost(), config.getCatalogBePort(), loginId);
- logger.debug("Send POST request to edit user: {}", url);
- logger.debug("User body: {}", userBodyJson);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send POST request to edit user: {}",url);
+ logger.debug("User body: {}",userBodyJson);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendEditUserResponse = http.httpSendPost(url, userBodyJson, headersMap);
@@ -119,8 +119,8 @@ public class EcompUserRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
String url = String.format(Urls.ECOMP_GET_USER, config.getCatalogBeHost(), config.getCatalogBePort(), loginId);
- logger.debug("Send GET request to get user: {}", url);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send GET request to get user: {}",url);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendGetUserRequest = http.httpSendGet(url, headersMap);
@@ -139,8 +139,8 @@ public class EcompUserRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
String url = String.format(Urls.ECOMP_GET_ALL_USERS, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send POST request to get all users: {}", url);
- logger.debug("User headers: {}" , headersMap);
+ logger.debug("Send POST request to get all users: {}",url);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendGetAllUsersRequest = http.httpSendGet(url, headersMap);
@@ -160,8 +160,8 @@ public class EcompUserRestUtils extends BaseRestUtils {
String url = String.format(Urls.ECOMP_GET_ALL_AVAILABLE_ROLES, config.getCatalogBeHost(),
config.getCatalogBePort());
- logger.debug("Send GET request to get all available roles: {}", url);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send GET request to get all available roles: {}",url);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendUpdateUserRequest = http.httpSendGet(url, headersMap);
@@ -186,9 +186,9 @@ public class EcompUserRestUtils extends BaseRestUtils {
String url = String.format(Urls.ECOMP_PUSH_USER_ROLES, config.getCatalogBeHost(), config.getCatalogBePort(),
loginId);
- logger.debug("Send POST request to push user role: {}", url);
- logger.debug("Roles body: {}", roleBodyJson);
- logger.debug("Request headers: {}", headersMap);
+ logger.debug("Send POST request to push user role: {}",url);
+ logger.debug("Roles body: {}",roleBodyJson);
+ logger.debug("Request headers: {}",headersMap);
RestResponse sendpushUserRolesResponse = http.httpSendPost(url, roleBodyJson, headersMap);
@@ -211,8 +211,8 @@ public class EcompUserRestUtils extends BaseRestUtils {
String url = String.format(Urls.ECOMP_GET_USER_ROLES, config.getCatalogBeHost(), config.getCatalogBePort(),
loginId);
- logger.debug("Send GET request to get user roles: {}", url);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send GET request to get user roles: {}",url);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendGetUserRolesRequest = http.httpSendGet(url, headersMap);
@@ -239,7 +239,6 @@ public class EcompUserRestUtils extends BaseRestUtils {
* System.out.println("\n-----------------------------\n Testing pushUser");
* System.out.println(pushUser(ecompUser));
* System.out.println("\n-----------------------------\n Testing editUser");
- * // System.out.println(editUser("tt0001", ecompUser));
* System.out.println("\n-----------------------------\n Testing getUser");
* // System.out.println(getUser(ecompUser.getLoginId())); System.out.
* println("\n-----------------------------\n Testing getAllUsers"); //
@@ -247,9 +246,7 @@ public class EcompUserRestUtils extends BaseRestUtils {
* println("\n-----------------------------\n Testing getAllAvailableRoles"
* ); // System.out.println(getAllAvailableRoles().toString()); System.out.
* println("\n-----------------------------\n Testing pushUserRoles"); //
- * System.out.println(pushUserRoles("tt0001", listOfRoles)); System.out.
* println("\n-----------------------------\n Testing getUserRoles"); //
- * System.out.println(getUserRoles("tt0001")); } catch (IOException e) { //
* TODO Auto-generated catch block e.printStackTrace(); } }
*/
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
index 3ce48962fd..9755ff2d91 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java
@@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.io.IOUtils;
@@ -75,15 +76,19 @@ public class ImportRestUtils extends BaseRestUtils {
}
@SuppressWarnings("unused")
- private static Integer importNormativeResource(NormativeTypesEnum resource, UserRoleEnum userRole) throws IOException {
+ private static Integer importNormativeResource(NormativeTypesEnum resource, UserRoleEnum userRole)
+ throws IOException {
Config config = Utils.getConfig();
CloseableHttpResponse response = null;
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(resource.getFolderName())));
- mpBuilder.addPart("resourceMetadata", new StringBody(getTestJsonStringOfFile(resource.getFolderName(), resource.getFolderName() + ".json"), ContentType.APPLICATION_JSON));
+ mpBuilder.addPart("resourceMetadata",
+ new StringBody(getTestJsonStringOfFile(resource.getFolderName(), resource.getFolderName() + ".json"),
+ ContentType.APPLICATION_JSON));
- String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(), config.getCatalogBePort());
+ String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(),
+ config.getCatalogBePort());
CloseableHttpClient client = HttpClients.createDefault();
try {
@@ -98,16 +103,61 @@ public class ImportRestUtils extends BaseRestUtils {
}
}
-
- public static RestResponse importResourceByName(ResourceReqDetails resourceDetails, User importer) throws Exception {
+
+ /*
+ * public static RestResponse importResourceByName(String resourceName, User
+ * user) throws IOException { Config config = Utils.getConfig();
+ * CloseableHttpResponse response = null; MultipartEntityBuilder mpBuilder =
+ * MultipartEntityBuilder.create();
+ *
+ * mpBuilder.addPart("resourceZip", new
+ * FileBody(getTestZipFile(resourceName)));
+ * mpBuilder.addPart("resourceMetadata", new
+ * StringBody(getTestJsonStringOfFile(resourceName, resourceName + ".json"),
+ * ContentType.APPLICATION_JSON));
+ *
+ * String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE,
+ * config.getCatalogBeHost(), config.getCatalogBePort());
+ *
+ * CloseableHttpClient client = HttpClients.createDefault(); try { HttpPost
+ * httpPost = new HttpPost(url); RestResponse restResponse = new
+ * RestResponse(); httpPost.addHeader("USER_ID", user.getUserId());
+ * httpPost.setEntity(mpBuilder.build()); response =
+ * client.execute(httpPost); HttpEntity entity = response.getEntity();
+ * String responseBody = null; if (entity != null) { InputStream instream =
+ * entity.getContent(); StringWriter writer = new StringWriter();
+ * IOUtils.copy(instream, writer); responseBody = writer.toString(); try {
+ *
+ * } finally { instream.close(); } }
+ *
+ * restResponse.setErrorCode(response.getStatusLine().getStatusCode());
+ * restResponse.setResponse(responseBody); if (restResponse.getErrorCode()
+ * == STATUS_CODE_CREATED ){
+ *
+ * }
+ *
+ * return restResponse;
+ *
+ * } finally { closeResponse(response); closeHttpClient(client);
+ *
+ * }
+ *
+ * }
+ */
+
+ public static RestResponse importResourceByName(ResourceReqDetails resourceDetails, User importer)
+ throws Exception {
Config config = Utils.getConfig();
CloseableHttpResponse response = null;
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(resourceDetails.getName())));
- mpBuilder.addPart("resourceMetadata", new StringBody(getTestJsonStringOfFile(resourceDetails.getName(), resourceDetails.getName() + ".json"), ContentType.APPLICATION_JSON));
+ mpBuilder.addPart("resourceMetadata",
+ new StringBody(getTestJsonStringOfFile(resourceDetails.getName(), resourceDetails.getName() + ".json"),
+ ContentType.APPLICATION_JSON));
- String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(), config.getCatalogBePort());
+ String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(),
+ config.getCatalogBePort());
CloseableHttpClient client = HttpClients.createDefault();
try {
@@ -157,7 +207,8 @@ public class ImportRestUtils extends BaseRestUtils {
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(resourceName)));
- mpBuilder.addPart("resourceMetadata", new StringBody(getTestJsonStringOfFile(resourceName, resourceName + ".json"), ContentType.APPLICATION_JSON));
+ mpBuilder.addPart("resourceMetadata", new StringBody(
+ getTestJsonStringOfFile(resourceName, resourceName + ".json"), ContentType.APPLICATION_JSON));
HttpEntity requestEntity = mpBuilder.build();
String url = String.format(Urls.IMPORT_USER_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
Map<String, String> headers = new HashMap<String, String>();
@@ -166,30 +217,37 @@ public class ImportRestUtils extends BaseRestUtils {
return HttpRequest.sendHttpPostWithEntity(requestEntity, url, headers);
}
- public static RestResponse importNormativeResourceByName(String resourceName, UserRoleEnum userRole) throws IOException {
+ public static RestResponse importNormativeResourceByName(String resourceName, UserRoleEnum userRole)
+ throws IOException {
Config config = Utils.getConfig();
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(resourceName)));
- mpBuilder.addPart("resourceMetadata", new StringBody(getTestJsonStringOfFile(resourceName, resourceName + ".json"), ContentType.APPLICATION_JSON));
+ mpBuilder.addPart("resourceMetadata", new StringBody(
+ getTestJsonStringOfFile(resourceName, resourceName + ".json"), ContentType.APPLICATION_JSON));
HttpEntity requestEntity = mpBuilder.build();
- String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(), config.getCatalogBePort());
+ String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(),
+ config.getCatalogBePort());
Map<String, String> headers = new HashMap<String, String>();
headers.put("USER_ID", userRole.getUserId());
return HttpRequest.sendHttpPostWithEntity(requestEntity, url, headers);
}
- public static RestResponse importTestResource(ImportTestTypesEnum resource, UserRoleEnum userRole) throws IOException {
+ public static RestResponse importTestResource(ImportTestTypesEnum resource, UserRoleEnum userRole)
+ throws IOException {
Config config = Utils.getConfig();
CloseableHttpResponse response = null;
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(resource.getFolderName())));
- mpBuilder.addPart("resourceMetadata", new StringBody(getTestJsonStringOfFile(resource.getFolderName(), resource.getFolderName() + ".json"), ContentType.APPLICATION_JSON));
+ mpBuilder.addPart("resourceMetadata",
+ new StringBody(getTestJsonStringOfFile(resource.getFolderName(), resource.getFolderName() + ".json"),
+ ContentType.APPLICATION_JSON));
- String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(), config.getCatalogBePort());
+ String url = String.format(Urls.IMPORT_RESOURCE_NORMATIVE, config.getCatalogBeHost(),
+ config.getCatalogBePort());
CloseableHttpClient client = HttpClients.createDefault();
try {
@@ -223,16 +281,20 @@ public class ImportRestUtils extends BaseRestUtils {
}
}
- public static Boolean removeNormativeTypeResource(NormativeTypesEnum current) throws FileNotFoundException, IOException, ClientProtocolException {
- User user = new User(UserRoleEnum.ADMIN.getFirstName(), UserRoleEnum.ADMIN.getLastName(), UserRoleEnum.ADMIN.getUserId(), null, null, null);
- RestResponse deleteResponse = ResourceRestUtils.deleteResourceByNameAndVersion(user, current.getNormativeName(), "1.0");
+ public static Boolean removeNormativeTypeResource(NormativeTypesEnum current)
+ throws FileNotFoundException, IOException, ClientProtocolException {
+ User user = new User(UserRoleEnum.ADMIN.getFirstName(), UserRoleEnum.ADMIN.getLastName(),
+ UserRoleEnum.ADMIN.getUserId(), null, null, null);
+ RestResponse deleteResponse = ResourceRestUtils.deleteResourceByNameAndVersion(user, current.getNormativeName(),
+ "1.0");
if (deleteResponse.getErrorCode() == 200) {
return true;
}
return false;
}
- public static void validateImportTestTypesResp(ImportTestTypesEnum currResource, RestResponse restResponse) throws IOException, JSONException {
+ public static void validateImportTestTypesResp(ImportTestTypesEnum currResource, RestResponse restResponse)
+ throws IOException, JSONException {
// assertTrue( status != ResourceUtils.STATUS_CODE_IMPORT_SUCCESS );
@@ -243,9 +305,11 @@ public class ImportRestUtils extends BaseRestUtils {
assertEquals("Check response code after create service", errorInfo.getCode(), restResponse.getErrorCode());
// validate create service response vs actual
- List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams() : new ArrayList<String>());
+ List<String> variables = (currResource.getErrorParams() != null ? currResource.getErrorParams()
+ : new ArrayList<String>());
if (restResponse.getErrorCode() != 200) {
- ErrorValidationUtils.checkBodyResponseOnError(currResource.getActionStatus().name(), variables, restResponse.getResponse());
+ ErrorValidationUtils.checkBodyResponseOnError(currResource.getActionStatus().name(), variables,
+ restResponse.getResponse());
}
}
@@ -253,7 +317,8 @@ public class ImportRestUtils extends BaseRestUtils {
// String sourceDir = "src/test/resources/CI/importResourceTests";
Config config = Utils.getConfig();
String sourceDir = config.getImportResourceTestsConfigDir();
- java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + folderName, fileName);
+ java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + folderName,
+ fileName);
byte[] fileContent = Files.readAllBytes(filePath);
String content = new String(fileContent);
return content;
@@ -262,7 +327,8 @@ public class ImportRestUtils extends BaseRestUtils {
private static File getTestZipFile(String elementName) throws IOException {
Config config = Utils.getConfig();
String sourceDir = config.getImportResourceTestsConfigDir();
- java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + elementName, "normative-types-new-" + elementName + ".zip");
+ java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + elementName,
+ "normative-types-new-" + elementName + ".zip");
return filePath.toFile();
}
@@ -289,18 +355,11 @@ public class ImportRestUtils extends BaseRestUtils {
public static RestResponseAsByteArray getCsar(String csarUid, User sdncModifierDetails) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_CSAR_USING_SIMULATOR, config.getCatalogBeHost(), config.getCatalogBePort(), csarUid);
+ String url = String.format(Urls.GET_CSAR_USING_SIMULATOR, config.getCatalogBeHost(), config.getCatalogBePort(),
+ csarUid);
String userId = sdncModifierDetails.getUserId();
-
Map<String, String> headersMap = prepareHeadersMap(userId);
-
- // Gson gson = new Gson();
- // String userBodyJson = gson.toJson(resourceDetails);
- HttpRequest http = new HttpRequest();
- // System.out.println(url);
- // System.out.println(userBodyJson);
-
HttpRestClient httpRestClient = new HttpRestClient();
for (Map.Entry<String, String> mapEntry : headersMap.entrySet()) {
@@ -318,11 +377,13 @@ public class ImportRestUtils extends BaseRestUtils {
Config config = Utils.getConfig();
String sourceDir = config.getImportResourceTestsConfigDir();
sourceDir += File.separator + ".." + File.separator + "importTypesTest" + File.separator;
- java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + elementName, elementName + ".zip");
+ java.nio.file.Path filePath = FileSystems.getDefault().getPath(sourceDir + File.separator + elementName,
+ elementName + ".zip");
return filePath.toFile();
}
- public static RestResponse importNewGroupTypeByName(String groupTypeName, UserRoleEnum userRole) throws IOException {
+ public static RestResponse importNewGroupTypeByName(String groupTypeName, UserRoleEnum userRole)
+ throws IOException {
Config config = Utils.getConfig();
MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
index 34651c1b7a..a5b8c7a4bf 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java
@@ -99,7 +99,40 @@ public class LifecycleRestUtils extends BaseRestUtils {
}
return LifeCycleStatesEnumResourceResponse;
}
+
+ public static RestResponse changeExternalResourceState(String uuid, User sdncModifierDetails, LifeCycleStatesEnum lifeCycleStatesEnum) throws IOException {
+ String url = String.format(Urls.CHANGE_RESOURCE_LIFECYCLE_STATE_EXTERNAL_API, "localhost", "8080", uuid, lifeCycleStatesEnum);
+ String userId = sdncModifierDetails.getUserId();
+ Map<String, String> headersMap = new HashMap<>();
+ headersMap.put(HttpHeaderEnum.CACHE_CONTROL.getValue(), "no-cache");
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), "Basic dGVzdDoxMjM0NTY=");
+ headersMap.put("X-ECOMP-InstanceID", "test");
+ return sendPost(url, createLifecycleCommentJson(COMMENT), userId, acceptHeaderData,headersMap);
+ }
+ public static RestResponse changeExternalServiceState(ServiceReqDetails serviceDetails, User sdncModifierDetails, LifeCycleStatesEnum lifeCycleStatesEnum) throws IOException {
+ String url = String.format(Urls.CHANGE_SERVICE_LIFECYCLE_STATE_EXTERNAL_API, "localhost", "8080", serviceDetails.getUUID(), lifeCycleStatesEnum);
+ String userId = sdncModifierDetails.getUserId();
+ Map<String, String> headersMap = new HashMap<>();
+ headersMap.put(HttpHeaderEnum.CACHE_CONTROL.getValue(), "no-cache");
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), "Basic dGVzdDoxMjM0NTY=");
+ headersMap.put("X-ECOMP-InstanceID", "test");
+ RestResponse lifeCycleStatesEnumServiceResponse = sendPost(url, createLifecycleCommentJson(COMMENT), userId, acceptHeaderData,headersMap);
+
+ if (lifeCycleStatesEnumServiceResponse.getErrorCode() == STATUS_CODE_SUCCESS) {
+ String serviceUniqueId = ResponseParser
+ .getValueFromJsonResponse(lifeCycleStatesEnumServiceResponse.getResponse(), "uniqueId");
+ serviceDetails.setUniqueId(serviceUniqueId);
+ String serviceVersion = ResponseParser
+ .getValueFromJsonResponse(lifeCycleStatesEnumServiceResponse.getResponse(), "version");
+ serviceDetails.setVersion(serviceVersion);
+ String stateFromJsonResponse = ResponseParser
+ .getValueFromJsonResponse(lifeCycleStatesEnumServiceResponse.getResponse(), "lifecycleState");
+ serviceDetails.setLifecycleState(LifecycleStateEnum.valueOf(stateFromJsonResponse));
+ }
+ return lifeCycleStatesEnumServiceResponse;
+ }
+
public static RestResponse changeServiceState(ServiceReqDetails serviceDetails, User sdncModifierDetails,
String version, LifeCycleStatesEnum LifeCycleStatesEnum) throws Exception {
{
@@ -302,20 +335,37 @@ public class LifecycleRestUtils extends BaseRestUtils {
public static RestResponse changeDistributionStatus(ServiceReqDetails serviceDetails, String version, User user,
String userRemarks, DistributionStatusEnum reqDistributionStatus) throws Exception {
String uniqueId = serviceDetails.getUniqueId();
- if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTION_APPROVED) {
- return sendApproveDistribution(user, uniqueId, userRemarks);
- } else if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTION_REJECTED) {
- return rejectDistribution(user, userRemarks, uniqueId);
- } else if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTED) {
- Config config = Utils.getConfig();
- // String url =
- // String.format("http://%s:%s/sdc2/rest/v1/catalog/services/%s/tempUrlToBeDeleted",
- // config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId);
- String url = String.format(Urls.ACTIVATE_DISTRIBUTION, config.getCatalogBeHost(), config.getCatalogBePort(),
- uniqueId, "PROD");
- return sendDistrState(user, userRemarks, url);
- } else
- return null;
+ Config config = Utils.getConfig();
+ String environmentName = "PROD-Andreys-Only";
+// String environmentName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0);
+ DistributionStatusEnum distributionStatusEnum = DistributionStatusEnum.findState(reqDistributionStatus.getValue());
+ switch(distributionStatusEnum){
+ case DISTRIBUTION_APPROVED:
+ return sendApproveDistribution(user, uniqueId, userRemarks);
+ case DISTRIBUTED:
+ String url = String.format(Urls.ACTIVATE_DISTRIBUTION, config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId, environmentName);
+ return sendDistrState(user, userRemarks, url);
+ case DISTRIBUTION_REJECTED:
+ return rejectDistribution(user, userRemarks, uniqueId);
+ default:
+ return null;
+
+ }
+
+// if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTION_APPROVED) {
+// return sendApproveDistribution(user, uniqueId, userRemarks);
+// } else if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTION_REJECTED) {
+// return rejectDistribution(user, userRemarks, uniqueId);
+// } else if (reqDistributionStatus == DistributionStatusEnum.DISTRIBUTED) {
+// Config config = Utils.getConfig();
+// // String url =
+// // String.format("http://%s:%s/sdc2/rest/v1/catalog/services/%s/tempUrlToBeDeleted",
+// // config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId);
+// String url = String.format(Urls.ACTIVATE_DISTRIBUTION, config.getCatalogBeHost(), config.getCatalogBePort(),
+// uniqueId, "PROD");
+// return sendDistrState(user, userRemarks, url);
+// } else
+// return null;
}
@@ -349,9 +399,9 @@ public class LifecycleRestUtils extends BaseRestUtils {
HttpRequest httpRequest = new HttpRequest();
logger.debug(url);
- logger.debug("Send POST request to create service: {}", url);
- logger.debug("Service body: {}", serviceBodyJson);
- logger.debug("Service headers: {}", headersMap);
+ logger.debug("Send POST request to create service: {}",url);
+ logger.debug("Service body: {}",serviceBodyJson);
+ logger.debug("Service headers: {}",headersMap);
RestResponse rejectDistributionResponse = httpRequest.httpSendPost(url, serviceBodyJson, headersMap);
return rejectDistributionResponse;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
index 8e617ed75c..ebc80ae537 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java
@@ -22,6 +22,8 @@ package org.openecomp.sdc.ci.tests.utils.rest;
import java.io.IOException;
+import com.google.gson.Gson;
+
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Product;
@@ -30,13 +32,13 @@ import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
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.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gson.Gson;
-
public class ProductRestUtils extends BaseRestUtils {
private static Gson gson = new Gson();
private static Logger logger = LoggerFactory.getLogger(ProductRestUtils.class.getName());
@@ -46,8 +48,8 @@ public class ProductRestUtils extends BaseRestUtils {
String url = String.format(Urls.CREATE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort());
String serviceBodyJson = gson.toJson(product);
- logger.debug("Send POST request to create service: {}", url);
- logger.debug("Service body: {}", serviceBodyJson);
+ logger.debug("Send POST request to create service: {}",url);
+ logger.debug("Service body: {}",serviceBodyJson);
RestResponse res = sendPost(url, serviceBodyJson, user.getUserId(), acceptHeaderData);
if (res.getErrorCode() == STATUS_CODE_CREATED) {
@@ -76,8 +78,8 @@ public class ProductRestUtils extends BaseRestUtils {
product.getUniqueId());
String serviceBodyJson = gson.toJson(product);
- logger.debug("Send POST request to create service: {}", url);
- logger.debug("Service body: {}", serviceBodyJson);
+ logger.debug("Send POST request to create service: {}",url);
+ logger.debug("Service body: {}",serviceBodyJson);
RestResponse res = sendPut(url, serviceBodyJson, user.getUserId(), acceptHeaderData);
if (res.getErrorCode() == STATUS_CODE_CREATED) {
@@ -116,11 +118,20 @@ public class ProductRestUtils extends BaseRestUtils {
return sendDelete(url, userId);
}
+ public static RestResponse getProduct(String productId) throws Exception {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.GET_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), productId);
+ logger.debug("Send GET request to get product: {}",url);
+
+ return sendGet(url, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER).getUserId());
+ }
+
public static RestResponse getProduct(String productId, String userId) throws Exception {
Config config = Utils.getConfig();
String url = String.format(Urls.GET_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), productId);
- logger.debug("Send GET request to get product: {}", url);
+ logger.debug("Send GET request to get product: {}",url);
return sendGet(url, userId);
}
@@ -128,7 +139,7 @@ public class ProductRestUtils extends BaseRestUtils {
public static RestResponse getFollowed(String userId) throws Exception {
Config config = Utils.getConfig();
String url = String.format(Urls.GET_FOLLWED_LIST, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send GET request to get user followed page: {}", url);
+ logger.debug("Send GET request to get user followed page: {}",url);
return sendGet(url, userId);
}
@@ -164,7 +175,7 @@ public class ProductRestUtils extends BaseRestUtils {
ComponentTypeEnum componentType) throws IOException {
Config config = Utils.getConfig();
String resourceUid = ("{\"componentUid\":\"" + serviceUniqueId + "\"}");
- String url = String.format(Urls.CHANGE__RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
+ String url = String.format(Urls.CHANGE_RESOURCE_INSTANCE_VERSION, config.getCatalogBeHost(),
config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentType), componentUniqueId,
serviceInstanceToReplaceUniqueId);
RestResponse changeResourceInstanceVersion = sendPost(url, resourceUid, sdncModifierDetails.getUserId(),
@@ -178,7 +189,7 @@ public class ProductRestUtils extends BaseRestUtils {
Config config = Utils.getConfig();
String url = String.format(Urls.GET_PRODUCT_BY_NAME_AND_VERSION, config.getCatalogBeHost(),
config.getCatalogBePort(), productName, productVersion);
- logger.debug("Send GET request to get product by name and version: {}", url);
+ logger.debug("Send GET request to get product by name and version: {}",url);
return sendGet(url, userId);
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
index 56ff5ec12b..a8661830ee 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java
@@ -46,70 +46,57 @@ public class PropertyRestUtils extends BaseRestUtils {
public static RestResponse createProperty(String resourceId, String body, User user) throws Exception {
Config config = Config.instance();
- String url = String.format(Urls.CREATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
- resourceId);
+ String url = String.format(Urls.CREATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
return sendPost(url, body, user.getUserId(), acceptHeaderData);
}
- public static RestResponse updateProperty(String resourceId, String propertyId, String body, User user)
- throws Exception {
+ public static RestResponse updateProperty(String resourceId, String propertyId, String body, User user) throws Exception {
Config config = Config.instance();
- String url = String.format(Urls.UPDATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
- resourceId, propertyId);
+ String url = String.format(Urls.UPDATE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId, propertyId);
return sendPut(url, body, user.getUserId(), acceptHeaderData);
}
public static RestResponse getProperty(String resourceId, String propertyId, User user) throws Exception {
Config config = Config.instance();
- String url = String.format(Urls.GET_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId,
- propertyId);
+ String url = String.format(Urls.GET_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId, propertyId);
return sendGet(url, user.getUserId());
}
public static RestResponse deleteProperty(String resourceId, String propertyId, User user) throws Exception {
Config config = Config.instance();
- String url = String.format(Urls.DELETE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(),
- resourceId, propertyId);
+ String url = String.format(Urls.DELETE_PROPERTY, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId, propertyId);
return sendDelete(url, user.getUserId());
}
- public static ComponentInstanceProperty getPropFromListByPropNameAndType(List<ComponentInstanceProperty> propList,
- String propNameToUpdate, String propTypeToUpdate) {
+ public static ComponentInstanceProperty getPropFromListByPropNameAndType(List<ComponentInstanceProperty> propList, String propNameToUpdate, String propTypeToUpdate) {
for (ComponentInstanceProperty componentInstanceProperty : propList) {
- if (componentInstanceProperty.getName().equals(propNameToUpdate)
- && componentInstanceProperty.getType().equals(propTypeToUpdate)) {
+ if (componentInstanceProperty.getName().equals(propNameToUpdate) && componentInstanceProperty.getType().equals(propTypeToUpdate)) {
return componentInstanceProperty;
}
}
return null;
}
- public static ComponentInstanceProperty getPropFromListByPropNameTypeAndPath(
- List<ComponentInstanceProperty> propList, String propNameToUpdate, String propTypeToUpdate,
- List<String> path) {
+ public static ComponentInstanceProperty getPropFromListByPropNameTypeAndPath(List<ComponentInstanceProperty> propList, String propNameToUpdate, String propTypeToUpdate, List<String> path) {
for (ComponentInstanceProperty componentInstanceProperty : propList) {
if (componentInstanceProperty.getPath() == null) {
return getPropFromListByPropNameAndType(propList, propNameToUpdate, propTypeToUpdate);
}
- if (componentInstanceProperty.getName().equals(propNameToUpdate)
- && componentInstanceProperty.getType().equals(propTypeToUpdate)
- && path.containsAll(componentInstanceProperty.getPath())) {
+ if (componentInstanceProperty.getName().equals(propNameToUpdate) && componentInstanceProperty.getType().equals(propTypeToUpdate) && path.containsAll(componentInstanceProperty.getPath())) {
return componentInstanceProperty;
}
}
return null;
}
- public static ComponentInstanceProperty getPropFromListByPropIdAndPath(List<ComponentInstanceProperty> propList,
- String propId, List<String> path) {
+ public static ComponentInstanceProperty getPropFromListByPropIdAndPath(List<ComponentInstanceProperty> propList, String propId, List<String> path) {
for (ComponentInstanceProperty componentInstanceProperty : propList) {
if (path != null) {
- if (componentInstanceProperty.getUniqueId().equals(propId)
- && componentInstanceProperty.getPath().equals(path)) {
+ if (componentInstanceProperty.getUniqueId().equals(propId) && componentInstanceProperty.getPath().equals(path)) {
return componentInstanceProperty;
}
} else {
@@ -121,12 +108,9 @@ public class PropertyRestUtils extends BaseRestUtils {
return null;
}
- public static void comparePropertyLists(List<ComponentInstanceProperty> expectedList,
- List<ComponentInstanceProperty> actualList, Boolean isUpdate) {
+ public static void comparePropertyLists(List<ComponentInstanceProperty> expectedList, List<ComponentInstanceProperty> actualList, Boolean isUpdate) {
- assertTrue(
- "list size are not equals, expected size is: " + expectedList.size() + " ,actual: " + actualList.size(),
- expectedList.size() == actualList.size());
+ assertTrue("list size are not equals, expected size is: " + expectedList.size() + " ,actual: " + actualList.size(), expectedList.size() == actualList.size());
Boolean flag = false;
for (ComponentInstanceProperty expectedcompInstProp : expectedList) {
for (ComponentInstanceProperty actualcompInstProp : actualList) {
@@ -138,47 +122,31 @@ public class PropertyRestUtils extends BaseRestUtils {
}
// System.out.println("expected: " + expectedList + ", actual: " +
// actualList);
- logger.debug("expected: {}, actual: {}", expectedList, actualList);
+ logger.debug("expected: {}, actual: {}",expectedList,actualList);
assertTrue("actual lists does not contain all uniqeIds", flag);
}
- public static Boolean comparePropertyObjects(ComponentInstanceProperty expectedCompInstProp,
- ComponentInstanceProperty actualCompInstProp, Boolean isUpdate) {
+ public static Boolean comparePropertyObjects(ComponentInstanceProperty expectedCompInstProp, ComponentInstanceProperty actualCompInstProp, Boolean isUpdate) {
String uniqueId = expectedCompInstProp.getUniqueId();
String type = expectedCompInstProp.getType();
String defaulValue = expectedCompInstProp.getDefaultValue();
- if (actualCompInstProp.getUniqueId().equals(uniqueId)
- && actualCompInstProp.getPath().equals(expectedCompInstProp.getPath())) {
- assertTrue("expected type is: " + type + " ,actual: " + actualCompInstProp.getType(),
- actualCompInstProp.getType().equals(type));
+ if (actualCompInstProp.getUniqueId().equals(uniqueId) && actualCompInstProp.getPath().equals(expectedCompInstProp.getPath())) {
+ assertTrue("expected type is: " + type + " ,actual: " + actualCompInstProp.getType(), actualCompInstProp.getType().equals(type));
if (defaulValue == null) {
- assertTrue(
- "expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
- actualCompInstProp.getDefaultValue() == defaulValue);
+ assertTrue("expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(), actualCompInstProp.getDefaultValue() == defaulValue);
} else {
- assertTrue(
- "expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(),
- actualCompInstProp.getDefaultValue().equals(defaulValue));
+ assertTrue("expected defaulValue is: " + defaulValue + " ,actual: " + actualCompInstProp.getDefaultValue(), actualCompInstProp.getDefaultValue().equals(defaulValue));
}
if (isUpdate) {
- assertTrue(
- "actual [Value] parameter " + actualCompInstProp.getName()
- + "should equal to expected [Value]: " + actualCompInstProp.getValue() + " ,Value: "
- + actualCompInstProp.getValue(),
+ assertTrue("actual [Value] parameter " + actualCompInstProp.getName() + "should equal to expected [Value]: " + actualCompInstProp.getValue() + " ,Value: " + actualCompInstProp.getValue(),
actualCompInstProp.getValue().equals(expectedCompInstProp.getValue()));
assertNotNull("valueId is null", actualCompInstProp.getValueUniqueUid());
} else {
if (defaulValue == null) {
- assertTrue(
- "actual [Value] parameter " + actualCompInstProp.getName()
- + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
- + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
+ assertTrue("actual [Value] parameter " + actualCompInstProp.getName() + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue() + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
actualCompInstProp.getValue() == expectedCompInstProp.getDefaultValue());
} else {
- assertTrue(
- "actual [Value] parameter " + actualCompInstProp.getName()
- + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue()
- + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
+ assertTrue("actual [Value] parameter " + actualCompInstProp.getName() + "should equal to expected [defaultValue]: " + actualCompInstProp.getValue() + " ,defaultValue: " + actualCompInstProp.getDefaultValue(),
actualCompInstProp.getValue().equals(expectedCompInstProp.getDefaultValue()));
}
assertNull("valueId is not null", actualCompInstProp.getValueUniqueUid());
@@ -188,16 +156,14 @@ public class PropertyRestUtils extends BaseRestUtils {
return false;
}
- public static List<ComponentInstanceProperty> addResourcePropertiesToList(Resource resource,
- List<ComponentInstanceProperty> listToFill) {
+ public static List<ComponentInstanceProperty> addResourcePropertiesToList(Resource resource, List<ComponentInstanceProperty> listToFill) {
for (PropertyDefinition prop : resource.getProperties()) {
listToFill.add(new ComponentInstanceProperty(prop, null, null));
}
return listToFill;
}
- public static List<ComponentInstanceProperty> addComponentInstPropertiesToList(Component component,
- List<ComponentInstanceProperty> listToFill, String componentId) {
+ public static List<ComponentInstanceProperty> addComponentInstPropertiesToList(Component component, List<ComponentInstanceProperty> listToFill, String componentId) {
if (componentId != null) {
List<ComponentInstanceProperty> list = component.getComponentInstancesProperties().get(componentId);
@@ -209,13 +175,10 @@ public class PropertyRestUtils extends BaseRestUtils {
listToFill.add(componentInstanceProperty);
}
} else {
- Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = component
- .getComponentInstancesProperties();
- for (Map.Entry<String, List<ComponentInstanceProperty>> componentInstanceProperties : componentInstancesProperties
- .entrySet()) {
+ Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = component.getComponentInstancesProperties();
+ for (Map.Entry<String, List<ComponentInstanceProperty>> componentInstanceProperties : componentInstancesProperties.entrySet()) {
for (ComponentInstanceProperty prop : componentInstanceProperties.getValue()) {
- ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null,
- null);
+ ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(prop, null, null);
componentInstanceProperty.setPath(prop.getPath());
componentInstanceProperty.setValueUniqueUid(prop.getValueUniqueUid());
componentInstanceProperty.setValue(prop.getValue());
@@ -232,22 +195,18 @@ public class PropertyRestUtils extends BaseRestUtils {
return listToFill;
}
- public static ComponentInstanceProperty getCompPropInstListByInstIdAndPropName(Component component,
- ComponentInstance componentInstanceDetails, String name, String type) {
- List<ComponentInstanceProperty> propList = component.getComponentInstancesProperties()
- .get(componentInstanceDetails.getUniqueId());
+ public static ComponentInstanceProperty getCompPropInstListByInstIdAndPropName(Component component, ComponentInstance componentInstanceDetails, String name, String type) {
+ List<ComponentInstanceProperty> propList = component.getComponentInstancesProperties().get(componentInstanceDetails.getUniqueId());
if (propList != null) {
return getPropFromListByPropNameAndType(propList, name, type);
}
return null;
}
- private static void updatePropertyListWithPathParameter(Resource resource, List<String> path,
- List<ComponentInstanceProperty> expectedPropertyList) {
+ private static void updatePropertyListWithPathParameter(Resource resource, List<String> path, List<ComponentInstanceProperty> expectedPropertyList) {
List<PropertyDefinition> propertyList = resource.getProperties();
for (PropertyDefinition propertyDefinition : propertyList) {
- ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameAndType(
- expectedPropertyList, propertyDefinition.getName(), propertyDefinition.getType());
+ ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameAndType(expectedPropertyList, propertyDefinition.getName(), propertyDefinition.getType());
ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
propDetailsToAdd.setPath(path);
expectedPropertyList.remove(propDetailsToRemove);
@@ -255,24 +214,19 @@ public class PropertyRestUtils extends BaseRestUtils {
}
}
- private static void updatePropertyListWithPathParameterOnCompInst(Service service, List<String> path,
- List<ComponentInstanceProperty> expectedPropertyList) {
+ private static void updatePropertyListWithPathParameterOnCompInst(Service service, List<String> path, List<ComponentInstanceProperty> expectedPropertyList) {
List<ComponentInstanceProperty> servicePropertyList = new ArrayList<>();
- servicePropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, servicePropertyList,
- path.get(0));
+ servicePropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, servicePropertyList, path.get(0));
for (ComponentInstanceProperty serviceCompInstProperty : servicePropertyList) {
- ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameTypeAndPath(
- expectedPropertyList, serviceCompInstProperty.getName(), serviceCompInstProperty.getType(),
- serviceCompInstProperty.getPath());
+ ComponentInstanceProperty propDetailsToRemove = PropertyRestUtils.getPropFromListByPropNameTypeAndPath(expectedPropertyList, serviceCompInstProperty.getName(), serviceCompInstProperty.getType(), serviceCompInstProperty.getPath());
ComponentInstanceProperty propDetailsToAdd = propDetailsToRemove;
List<String> tempPathList = new ArrayList<String>();
for (String tempPath : path) {
tempPathList.add(tempPath);
}
// path parameter can not contain the same service unique ID twice
- if (propDetailsToAdd.getPath() != null
- && !propDetailsToAdd.getPath().get(0).contains(service.getUniqueId())) {
+ if (propDetailsToAdd.getPath() != null && !propDetailsToAdd.getPath().get(0).contains(service.getUniqueId())) {
if (!propDetailsToAdd.getPath().containsAll(tempPathList)) {
tempPathList.addAll(propDetailsToAdd.getPath());
}
@@ -283,8 +237,7 @@ public class PropertyRestUtils extends BaseRestUtils {
}
}
- public static void updatePropertyListWithPathOnResource(ComponentInstance componentInstDetails, Resource resource,
- List<ComponentInstanceProperty> list, Component container) {
+ public static void updatePropertyListWithPathOnResource(ComponentInstance componentInstDetails, Resource resource, List<ComponentInstanceProperty> list, Component container) {
List<String> path = new ArrayList<>();
if (container != null) {
List<ComponentInstance> componentInstances = container.getComponentInstances();
@@ -301,8 +254,7 @@ public class PropertyRestUtils extends BaseRestUtils {
updatePropertyListWithPathParameter(resource, path, list);
}
- public static void updatePropertyListWithPathOnComponentInstance(ComponentInstance componentInstDetails,
- Service service, List<ComponentInstanceProperty> list) {
+ public static void updatePropertyListWithPathOnComponentInstance(ComponentInstance componentInstDetails, Service service, List<ComponentInstanceProperty> list) {
List<String> path = new ArrayList<>();
path.add(componentInstDetails.getUniqueId());
updatePropertyListWithPathParameterOnCompInst(service, path, list);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
index 16ffd2f9e2..6e4a6a8018 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
@@ -53,20 +53,21 @@ 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.ElementFactory;
import org.openecomp.sdc.common.util.GeneralUtility;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ResourceRestUtils extends BaseRestUtils {
private static Logger logger = LoggerFactory.getLogger(ResourceRestUtils.class.getName());
// ****** CREATE *******
- public static RestResponse createResource(ResourceReqDetails resourceDetails, User sdncModifierDetails) throws Exception {
+ public static RestResponse createResource(ResourceReqDetails resourceDetails, User sdncModifierDetails)
+ throws Exception {
Config config = Utils.getConfig();
String url = String.format(Urls.CREATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
@@ -87,9 +88,11 @@ public class ResourceRestUtils extends BaseRestUtils {
resourceDetails.setUUID(ResponseParser.getUuidFromResponse(createResourceResponse));
resourceDetails.setVersion(ResponseParser.getVersionFromResponse(createResourceResponse));
resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(createResourceResponse));
- String lastUpdaterUserId = ResponseParser.getValueFromJsonResponse(createResourceResponse.getResponse(), "lastUpdaterUserId");
+ String lastUpdaterUserId = ResponseParser.getValueFromJsonResponse(createResourceResponse.getResponse(),
+ "lastUpdaterUserId");
resourceDetails.setLastUpdaterUserId(lastUpdaterUserId);
- String lastUpdaterFullName = ResponseParser.getValueFromJsonResponse(createResourceResponse.getResponse(), "lastUpdaterFullName");
+ String lastUpdaterFullName = ResponseParser.getValueFromJsonResponse(createResourceResponse.getResponse(),
+ "lastUpdaterFullName");
resourceDetails.setLastUpdaterFullName(lastUpdaterFullName);
// Creator details never change after component is created - Ella,
// 12/1/2016
@@ -100,7 +103,8 @@ public class ResourceRestUtils extends BaseRestUtils {
}
- public static RestResponse createImportResource(ImportReqDetails importReqDetails, User sdncModifierDetails, Map<String, String> additionalHeaders) throws JSONException, IOException {
+ public static RestResponse createImportResource(ImportReqDetails importReqDetails, User sdncModifierDetails,
+ Map<String, String> additionalHeaders) throws JSONException, IOException {
Config config = Utils.getConfig();
String url = String.format(Urls.CREATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
@@ -116,7 +120,8 @@ public class ResourceRestUtils extends BaseRestUtils {
if (additionalHeaders != null) {
headersMap.putAll(additionalHeaders);
} else {
- headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), ArtifactRestUtils.calculateMD5(resourceImportBodyJson));
+ headersMap.put(HttpHeaderEnum.Content_MD5.getValue(),
+ ArtifactRestUtils.calculateMD5(resourceImportBodyJson));
}
RestResponse createResourceResponse = http.httpSendPost(url, resourceImportBodyJson, headersMap);
@@ -127,7 +132,8 @@ public class ResourceRestUtils extends BaseRestUtils {
// 12/1/2016
importReqDetails.setCreatorUserId(userId);
importReqDetails.setCreatorFullName(sdncModifierDetails.getFullName());
- importReqDetails.setToscaResourceName(ResponseParser.getToscaResourceNameFromResponse(createResourceResponse));
+ importReqDetails
+ .setToscaResourceName(ResponseParser.getToscaResourceNameFromResponse(createResourceResponse));
importReqDetails.setDerivedList(ResponseParser.getDerivedListFromJson(createResourceResponse));
}
return createResourceResponse;
@@ -135,11 +141,13 @@ public class ResourceRestUtils extends BaseRestUtils {
}
// ***** DELETE ****
- public static RestResponse deleteResource(ResourceReqDetails resourceDetails, User sdncModifierDetails, String version) throws IOException {
+ public static RestResponse deleteResource(ResourceReqDetails resourceDetails, User sdncModifierDetails,
+ String version) throws IOException {
if (resourceDetails.getUniqueId() != null) {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(), config.getCatalogBePort(), resourceDetails.getName(), version);
+ String url = String.format(Urls.DELETE_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(),
+ config.getCatalogBePort(), resourceDetails.getName(), version);
return sendDelete(url, sdncModifierDetails.getUserId());
} else {
return null;
@@ -150,7 +158,8 @@ public class ResourceRestUtils extends BaseRestUtils {
public static RestResponse markResourceToDelete(String resourceId, String userId) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
+ String url = String.format(Urls.DELETE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ resourceId);
RestResponse sendDelete = sendDelete(url, userId);
return sendDelete;
@@ -160,7 +169,8 @@ public class ResourceRestUtils extends BaseRestUtils {
public static RestResponse deleteResource(String resourceId, String userId) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
+ String url = String.format(Urls.DELETE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ resourceId);
RestResponse sendDelete = sendDelete(url, userId);
deleteMarkedResources(userId);
@@ -176,9 +186,11 @@ public class ResourceRestUtils extends BaseRestUtils {
sendDelete(url, userId);
}
- public static RestResponse deleteResourceByNameAndVersion(User sdncModifierDetails, String resourceName, String resourceVersion) throws IOException {
+ public static RestResponse deleteResourceByNameAndVersion(User sdncModifierDetails, String resourceName,
+ String resourceVersion) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(), config.getCatalogBePort(), resourceName, resourceVersion);
+ String url = String.format(Urls.DELETE_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(),
+ config.getCatalogBePort(), resourceName, resourceVersion);
RestResponse sendDelete = sendDelete(url, sdncModifierDetails.getUserId());
deleteMarkedResources(sdncModifierDetails.getUserId());
@@ -186,13 +198,17 @@ public class ResourceRestUtils extends BaseRestUtils {
return sendDelete;
}
- public static Boolean deleteResourceByNameAndVersion(String resourceName, String resourceVersion) throws IOException {
- RestResponse deleteResponse = ResourceRestUtils.deleteResourceByNameAndVersion(ElementFactory.getDefaultUser(UserRoleEnum.ADMIN), resourceName, resourceVersion);
+ public static Boolean deleteResourceByNameAndVersion(String resourceName, String resourceVersion)
+ throws IOException {
+ RestResponse deleteResponse = ResourceRestUtils.deleteResourceByNameAndVersion(
+ ElementFactory.getDefaultUser(UserRoleEnum.ADMIN), resourceName, resourceVersion);
return checkErrorCode(deleteResponse);
}
- public static Boolean removeResource(String resourceId) throws FileNotFoundException, IOException, ClientProtocolException {
- RestResponse response = deleteResource(resourceId, ElementFactory.getDefaultUser(UserRoleEnum.ADMIN).getUserId());
+ public static Boolean removeResource(String resourceId)
+ throws FileNotFoundException, IOException, ClientProtocolException {
+ RestResponse response = deleteResource(resourceId,
+ ElementFactory.getDefaultUser(UserRoleEnum.ADMIN).getUserId());
return checkErrorCode(response);
}
@@ -204,30 +220,38 @@ public class ResourceRestUtils extends BaseRestUtils {
return sendGet(url, sdncModifierDetails.getUserId());
}
- public static RestResponse getModule(User sdncModifierDetails, String componentId, String moduleId) throws IOException {
+ public static RestResponse getModule(User sdncModifierDetails, String componentId, String moduleId)
+ throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_MODULE_BY_ID, config.getCatalogBeHost(), config.getCatalogBePort(), componentId, moduleId);
+ String url = String.format(Urls.GET_MODULE_BY_ID, config.getCatalogBeHost(), config.getCatalogBePort(),
+ componentId, moduleId);
return sendGet(url, sdncModifierDetails.getUserId());
}
- public static RestResponse getLatestResourceFromCsarUuid(User sdncModifierDetails, String csarUuid) throws IOException {
+ public static RestResponse getLatestResourceFromCsarUuid(User sdncModifierDetails, String csarUuid)
+ throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_RESOURCE_BY_CSAR_UUID, config.getCatalogBeHost(), config.getCatalogBePort(), csarUuid);
+ String url = String.format(Urls.GET_RESOURCE_BY_CSAR_UUID, config.getCatalogBeHost(), config.getCatalogBePort(),
+ csarUuid);
return sendGet(url, sdncModifierDetails.getUserId());
}
- public static RestResponse getResource(ResourceReqDetails resourceDetails, User sdncModifierDetails) throws IOException {
+ public static RestResponse getResource(ResourceReqDetails resourceDetails, User sdncModifierDetails)
+ throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceDetails.getUniqueId());
+ String url = String.format(Urls.GET_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ resourceDetails.getUniqueId());
return sendGet(url, sdncModifierDetails.getUserId());
}
- public static RestResponse getResourceByNameAndVersion(String userId, String resourceName, String resourceVersion) throws IOException {
+ public static RestResponse getResourceByNameAndVersion(String userId, String resourceName, String resourceVersion)
+ throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(), config.getCatalogBePort(), resourceName, resourceVersion);
+ String url = String.format(Urls.GET_RESOURCE_BY_NAME_AND_VERSION, config.getCatalogBeHost(),
+ config.getCatalogBePort(), resourceName, resourceVersion);
return sendGet(url, userId);
}
@@ -240,19 +264,47 @@ public class ResourceRestUtils extends BaseRestUtils {
return sendGet(url, sdncModifierDetails.getUserId());
}
+
+ public static RestResponse getResourceListFilterByCategory(User sdncModifierDetails, String componentType, String category) throws IOException {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.GET_FILTERED_ASSET_LIST, config.getCatalogBeHost(), config.getCatalogBePort(), componentType, "category=" + category);
+
+ Map<String, String> headersMap = prepareHeadersMap(sdncModifierDetails.getUserId());
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
+
+ return sendGet(url, sdncModifierDetails.getUserId(), headersMap);
+
+ }
+
+ public static RestResponse getResourceListFilterByCriteria(User sdncModifierDetails, String componentType, String criteria, String value) throws IOException {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.GET_FILTERED_ASSET_LIST, config.getCatalogBeHost(), config.getCatalogBePort(), componentType, criteria + "=" + value);
+
+ Map<String, String> headersMap = prepareHeadersMap(sdncModifierDetails.getUserId());
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
+
+ return sendGet(url, sdncModifierDetails.getUserId(), headersMap);
+
+ }
public static RestResponse getResource(String resourceId) throws ClientProtocolException, IOException {
return getResource(ElementFactory.getDefaultUser(UserRoleEnum.ADMIN), resourceId);
}
- public static RestResponse getLatestResourceFromCsarUuid(String csarUuid) throws ClientProtocolException, IOException {
+ public static RestResponse getLatestResourceFromCsarUuid(String csarUuid)
+ throws ClientProtocolException, IOException {
return getLatestResourceFromCsarUuid(ElementFactory.getDefaultUser(UserRoleEnum.ADMIN), csarUuid);
}
public static RestResponse getResourceLatestVersionList(User sdncModifierDetails) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_RESOURCE_lATEST_VERSION, config.getCatalogBeHost(), config.getCatalogBePort());
+ String url = String.format(Urls.GET_RESOURCE_lATEST_VERSION, config.getCatalogBeHost(),
+ config.getCatalogBePort());
return sendGet(url, sdncModifierDetails.getUserId());
@@ -261,7 +313,8 @@ public class ResourceRestUtils extends BaseRestUtils {
public static RestResponse putAllCategoriesTowardsCatalogFeWithUuidNotAllowed(String uuid) throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(), BaseRestUtils.RESOURCE_COMPONENT_TYPE);
+ String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(),
+ BaseRestUtils.RESOURCE_COMPONENT_TYPE);
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
@@ -269,7 +322,7 @@ public class ResourceRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), uuid);
HttpRequest http = new HttpRequest();
- logger.debug("Send PUT request to get all categories (should be 405): {}", url);
+ logger.debug("Send PUT request to get all categories (should be 405): {}",url);
return http.httpSendByMethod(url, "PUT", null, headersMap);
}
@@ -283,7 +336,6 @@ public class ResourceRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderData);
- // logger.debug("Send GET request to get all tags: {}", url);
return http.httpSendGet(url, headersMap);
}
@@ -299,9 +351,7 @@ public class ResourceRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), "cs0008");
- // logger.debug("Send GET request to get all property scopes: {}", url);
return http.httpSendGet(url, headersMap);
-
}
public static RestResponse getAllArtifactTypesTowardsCatalogBe() throws IOException {
@@ -316,7 +366,6 @@ public class ResourceRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), "cs0008");
- // logger.debug("Send GET request to get all property scopes: {}", url);
return http.httpSendGet(url, headersMap);
}
@@ -332,7 +381,6 @@ public class ResourceRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), "cs0008");
- // logger.debug("Send GET request to get all property scopes: {}", url);
return http.httpSendGet(url, headersMap);
}
@@ -340,21 +388,24 @@ public class ResourceRestUtils extends BaseRestUtils {
public static RestResponse sendOptionsTowardsCatalogFeWithUuid() throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(), BaseRestUtils.RESOURCE_COMPONENT_TYPE);
+ String url = String.format(Urls.GET_ALL_CATEGORIES_FE, config.getCatalogFeHost(), config.getCatalogFePort(),
+ BaseRestUtils.RESOURCE_COMPONENT_TYPE);
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderData);
HttpRequest http = new HttpRequest();
- logger.debug("Send OPTIONS request for categories: {}", url);
+ logger.debug("Send OPTIONS request for categories: {}",url);
return http.httpSendByMethod(url, "OPTIONS", null, headersMap);
}
// ********** UPDATE *************
- public static RestResponse updateResourceMetadata(ResourceReqDetails updatedResourceDetails, User sdncModifierDetails, String uniqueId, String encoding) throws Exception {
+ public static RestResponse updateResourceMetadata(ResourceReqDetails updatedResourceDetails,
+ User sdncModifierDetails, String uniqueId, String encoding) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId);
+ String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(),
+ uniqueId);
String ContentTypeString = String.format("%s;%s", contentTypeHeaderData, encoding);
@@ -370,9 +421,11 @@ public class ResourceRestUtils extends BaseRestUtils {
return updateResourceResponse;
}
- public static RestResponse updateResourceTEST(Resource resource, User sdncModifierDetails, String uniqueId, String encoding) throws Exception {
+ public static RestResponse updateResourceTEST(Resource resource, User sdncModifierDetails, String uniqueId,
+ String encoding) throws Exception {
Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(), uniqueId);
+ String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(),
+ uniqueId);
String ContentTypeString = String.format("%s;%s", contentTypeHeaderData, encoding);
@@ -381,25 +434,43 @@ public class ResourceRestUtils extends BaseRestUtils {
String userId = sdncModifierDetails.getUserId();
RestResponse updateResourceResponse = sendPut(url, userBodyJson, userId, ContentTypeString);
+
+ // String resourceUniqueId =
+ // ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(),
+ // "uniqueId");
+ // updatedResourceDetails.setUniqueId(resourceUniqueId);
+ // String resourceVersion =
+ // ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(),
+ // "version");
+ // updatedResourceDetails.setUniqueId(resourceVersion);
+
return updateResourceResponse;
}
- public static RestResponse updateResourceMetadata(ResourceReqDetails updatedResourceDetails, User sdncModifierDetails, String uniqueId) throws Exception {
+ public static RestResponse updateResourceMetadata(ResourceReqDetails updatedResourceDetails,
+ User sdncModifierDetails, String uniqueId) throws Exception {
return updateResourceMetadata(updatedResourceDetails, sdncModifierDetails, uniqueId, "");
}
- public static RestResponse updateResourceMetadata(String json, User sdncModifierDetails, String resourceId) throws IOException {
+ public static RestResponse updateResourceMetadata(String json, User sdncModifierDetails, String resourceId)
+ throws IOException {
Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
+ String url = String.format(Urls.UPDATE_RESOURCE_METADATA, config.getCatalogBeHost(), config.getCatalogBePort(),
+ resourceId);
String userId = sdncModifierDetails.getUserId();
+
RestResponse updateResourceResponse = sendPut(url, json, userId, contentTypeHeaderData);
+
return updateResourceResponse;
}
- public static RestResponse updateResource(ResourceReqDetails resourceDetails, User sdncModifierDetails, String resourceId) throws IOException {
+ public static RestResponse updateResource(ResourceReqDetails resourceDetails, User sdncModifierDetails,
+ String resourceId) throws IOException {
+
String userId = sdncModifierDetails.getUserId();
Config config = Utils.getConfig();
- String url = String.format(Urls.UPDATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(), resourceId);
+ String url = String.format(Urls.UPDATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ resourceId);
Map<String, String> headersMap = prepareHeadersMap(userId);
@@ -413,9 +484,11 @@ public class ResourceRestUtils extends BaseRestUtils {
resourceDetails.setUUID(ResponseParser.getUuidFromResponse(updateResourceResponse));
resourceDetails.setVersion(ResponseParser.getVersionFromResponse(updateResourceResponse));
resourceDetails.setUniqueId(ResponseParser.getUniqueIdFromResponse(updateResourceResponse));
- String lastUpdaterUserId = ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(), "lastUpdaterUserId");
+ String lastUpdaterUserId = ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(),
+ "lastUpdaterUserId");
resourceDetails.setLastUpdaterUserId(lastUpdaterUserId);
- String lastUpdaterFullName = ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(), "lastUpdaterFullName");
+ String lastUpdaterFullName = ResponseParser.getValueFromJsonResponse(updateResourceResponse.getResponse(),
+ "lastUpdaterFullName");
resourceDetails.setLastUpdaterFullName(lastUpdaterFullName);
resourceDetails.setCreatorUserId(userId);
resourceDetails.setCreatorFullName(sdncModifierDetails.getFullName());
@@ -423,21 +496,26 @@ public class ResourceRestUtils extends BaseRestUtils {
return updateResourceResponse;
}
- public static RestResponse createResourceInstance(ResourceReqDetails resourceDetails, User modifier, String vfResourceUniqueId) throws Exception {
- ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory.getComponentResourceInstance(resourceDetails);
- RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(resourceInstanceReqDetails, modifier, vfResourceUniqueId, ComponentTypeEnum.RESOURCE);
+ public static RestResponse createResourceInstance(ResourceReqDetails resourceDetails, User modifier,
+ String vfResourceUniqueId) throws Exception {
+ ComponentInstanceReqDetails resourceInstanceReqDetails = ElementFactory
+ .getComponentResourceInstance(resourceDetails);
+ RestResponse createResourceInstanceResponse = ComponentInstanceRestUtils.createComponentInstance(
+ resourceInstanceReqDetails, modifier, vfResourceUniqueId, ComponentTypeEnum.RESOURCE);
ResourceRestUtils.checkCreateResponse(createResourceInstanceResponse);
return createResourceInstanceResponse;
}
- public static RestResponse associateResourceInstances(JSONObject body, User sdncModifierDetails, Component component) throws IOException {
+ public static RestResponse associateResourceInstances(JSONObject body, User sdncModifierDetails,
+ Component component) throws IOException {
Config config = Utils.getConfig();
Gson gson = new Gson();
String bodyJson = gson.toJson(body);
component.getComponentType();
String componentType = ComponentTypeEnum.findParamByType(component.getComponentType());
- String url = String.format(Urls.ASSOCIATE__RESOURCE_INSTANCE, config.getCatalogBeHost(), config.getCatalogBePort(), componentType, component.getUniqueId());
+ String url = String.format(Urls.ASSOCIATE_RESOURCE_INSTANCE, config.getCatalogBeHost(),
+ config.getCatalogBePort(), componentType, component.getUniqueId());
return sendPost(url, bodyJson, sdncModifierDetails.getUserId(), null);
}
@@ -476,11 +554,14 @@ public class ResourceRestUtils extends BaseRestUtils {
// =======================================resource
// associate==================================================
- public static RestResponse associate2ResourceInstances(Component container, ComponentInstance fromNode, ComponentInstance toNode, String assocType, User sdncUserDetails) throws IOException {
- return associate2ResourceInstances(container, fromNode.getUniqueId(), toNode.getUniqueId(), assocType, sdncUserDetails);
+ public static RestResponse associate2ResourceInstances(Component container, ComponentInstance fromNode,
+ ComponentInstance toNode, String assocType, User sdncUserDetails) throws IOException {
+ return associate2ResourceInstances(container, fromNode.getUniqueId(), toNode.getUniqueId(), assocType,
+ sdncUserDetails);
}
- public static RestResponse associate2ResourceInstances(Component component, String fromNode, String toNode, String assocType, User sdncUserDetails) throws IOException {
+ public static RestResponse associate2ResourceInstances(Component component, String fromNode, String toNode,
+ String assocType, User sdncUserDetails) throws IOException {
RelationshipInstData relationshipInstData = new RelationshipInstData();
Map<String, List<CapabilityDefinition>> capabilitiesMap = component.getCapabilities();
@@ -495,12 +576,15 @@ public class ResourceRestUtils extends BaseRestUtils {
relationshipInstData.setRequirementOwnerId(requirementDefinitionFrom.getOwnerId());
relationshipInstData.setRequirementId(requirementDefinitionFrom.getUniqueId());
- JSONObject assocBody = assocBuilder(relationshipInstData, capabilityDefinitionTo, requirementDefinitionFrom, toNode, fromNode);
+ JSONObject assocBody = assocBuilder(relationshipInstData, capabilityDefinitionTo, requirementDefinitionFrom,
+ toNode, fromNode);
return ResourceRestUtils.associateResourceInstances(assocBody, sdncUserDetails, component);
}
- private static JSONObject assocBuilder(RelationshipInstData relationshipInstData, CapabilityDefinition capabilityDefinitionTo, RequirementDefinition requirementDefinitionFrom, String toNode, String fromNode) {
+ private static JSONObject assocBuilder(RelationshipInstData relationshipInstData,
+ CapabilityDefinition capabilityDefinitionTo, RequirementDefinition requirementDefinitionFrom, String toNode,
+ String fromNode) {
String type = capabilityDefinitionTo.getType();
String requirement = requirementDefinitionFrom.getName();
@@ -529,7 +613,8 @@ public class ResourceRestUtils extends BaseRestUtils {
}
- private static CapabilityDefinition getCapabilityDefinitionByOwnerId(List<CapabilityDefinition> capabilityDefinitionList, String ownerId) {
+ private static CapabilityDefinition getCapabilityDefinitionByOwnerId(
+ List<CapabilityDefinition> capabilityDefinitionList, String ownerId) {
for (CapabilityDefinition capabilityDefinition : capabilityDefinitionList) {
if (capabilityDefinition.getOwnerId().equals(ownerId)) {
@@ -539,7 +624,8 @@ public class ResourceRestUtils extends BaseRestUtils {
return null;
}
- private static RequirementDefinition getRequirementDefinitionByOwnerId(List<RequirementDefinition> requirementDefinitionList, String ownerId) {
+ private static RequirementDefinition getRequirementDefinitionByOwnerId(
+ List<RequirementDefinition> requirementDefinitionList, String ownerId) {
for (RequirementDefinition requirementDefinition : requirementDefinitionList) {
if (requirementDefinition.getOwnerId().equals(ownerId)) {
@@ -562,14 +648,18 @@ public class ResourceRestUtils extends BaseRestUtils {
return name;
}
- public static Resource convertResourceGetResponseToJavaObject(ResourceReqDetails resourceDetails) throws IOException {
- RestResponse response = ResourceRestUtils.getResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ public static Resource convertResourceGetResponseToJavaObject(ResourceReqDetails resourceDetails)
+ throws IOException {
+ RestResponse response = ResourceRestUtils.getResource(resourceDetails,
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
assertEquals("Check response code after get resource", 200, response.getErrorCode().intValue());
return ResponseParser.convertResourceResponseToJavaObject(response.getResponse());
}
- public static RestResponse changeResourceInstanceVersion(String containerUniqueId, String instanceToReplaceUniqueId, String newResourceUniqueId, User sdncModifierDetails, ComponentTypeEnum componentType) throws IOException {
- return ProductRestUtils.changeServiceInstanceVersion(containerUniqueId, instanceToReplaceUniqueId, newResourceUniqueId, sdncModifierDetails, componentType);
+ public static RestResponse changeResourceInstanceVersion(String containerUniqueId, String instanceToReplaceUniqueId,
+ String newResourceUniqueId, User sdncModifierDetails, ComponentTypeEnum componentType) throws IOException {
+ return ProductRestUtils.changeServiceInstanceVersion(containerUniqueId, instanceToReplaceUniqueId,
+ newResourceUniqueId, sdncModifierDetails, componentType);
}
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
new file mode 100644
index 0000000000..10f573cf0e
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utils.rest;
+
+import java.util.Map;
+
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
+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.common.util.GeneralUtility;
+
+import com.google.gson.Gson;
+
+public class ResourceRestUtilsExternalAPI extends BaseRestUtils {
+
+ public static RestResponse createResource(ResourceExternalReqDetails resourceDetails, User sdncModifierDetails)
+ throws Exception {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.POST_EXTERNAL_API_CREATE_RESOURCE, config.getCatalogBeHost(), config.getCatalogBePort());
+
+ String userId = sdncModifierDetails.getUserId();
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ Gson gson = new Gson();
+ String userBodyJson = gson.toJson(resourceDetails);
+ String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
+ headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
+ headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
+ headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
+
+ HttpRequest http = new HttpRequest();
+ RestResponse createResourceResponse = http.httpSendPost(url, userBodyJson, headersMap);
+
+ return createResourceResponse;
+ }
+
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
index dfcb9c2736..39f2c04b55 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.ci.tests.utils.rest;
import java.io.IOException;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -30,8 +31,10 @@ import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
+import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.Version;
import org.codehaus.jackson.map.JsonDeserializer;
+import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.module.SimpleModule;
import org.json.JSONArray;
@@ -50,7 +53,9 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserialiser;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@@ -59,7 +64,34 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ResponseParser {
-
+
+ // comment by Andrey, for test only
+ // public static void main(String[] args) {
+ // String response =
+ // "{\"uniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2\",\"resourceName\":\"importResource4test\",\"resourceVersion\":\"0.1\",\"creatorUserId\":\"jh0003\",\"creatorFullName\":\"Jimmy
+ // Hendrix\",\"lastUpdaterUserId\":\"jh0003\",\"lastUpdaterFullName\":\"Jimmy
+ // Hendrix\",\"creationDate\":1446742241514,\"lastUpdateDate\":1446742241514,\"description\":\"Represents
+ // a generic software component that can be managed and run by a Compute
+ // Node
+ // Type.\",\"icon\":\"defaulticon\",\"tags\":[\"importResource4test\"],\"category\":\"Generic/Infrastructure\",\"lifecycleState\":\"NOT_CERTIFIED_CHECKOUT\",\"derivedFrom\":[\"tosca.nodes.Root\"],\"artifacts\":{},\"deploymentArtifacts\":{},\"properties\":[{\"uniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2.port\",\"type\":\"integer\",\"required\":false,\"description\":\"the
+ // port the DBMS service will listen to for data and
+ // requests\",\"password\":false,\"name\":\"port\",\"parentUniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2\",\"definition\":true},{\"uniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2.root_password\",\"type\":\"string\",\"required\":false,\"description\":\"the
+ // optional root password for the DBMS
+ // service\",\"password\":false,\"name\":\"root_password\",\"parentUniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2\",\"definition\":true}],\"interfaces\":{\"standard\":{\"type\":\"tosca.interfaces.node.lifecycle.Standard\",\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard\",\"operations\":{\"stop\":{\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard.stop\",\"description\":\"Standard
+ // lifecycle stop
+ // operation.\",\"definition\":false},\"start\":{\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard.start\",\"description\":\"Standard
+ // lifecycle start
+ // operation.\",\"definition\":false},\"delete\":{\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard.delete\",\"description\":\"Standard
+ // lifecycle delete
+ // operation.\",\"definition\":false},\"create\":{\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard.create\",\"description\":\"Standard
+ // lifecycle create
+ // operation.\",\"definition\":false},\"configure\":{\"uniqueId\":\"tosca.interfaces.node.lifecycle.standard.configure\",\"description\":\"Standard
+ // lifecycle configure
+ // operation.\",\"definition\":false}},\"definition\":false}},\"capabilities\":{\"feature\":{\"uniqueId\":\"capability.8313348e-3623-4f4a-9b8f-d2fbadaf9a31.feature\",\"type\":\"tosca.capabilities.Node\"},\"feature2\":{\"uniqueId\":\"capability.52eb0139-a855-47b9-a0e6-c90f0a90b1d2.feature2\",\"type\":\"tosca.capabilities.Node\"}},\"requirements\":{\"dependency\":{\"uniqueId\":\"8313348e-3623-4f4a-9b8f-d2fbadaf9a31.dependency\",\"capability\":\"tosca.capabilities.Node\",\"node\":\"tosca.nodes.Root\",\"relationship\":\"tosca.relationships.DependsOn\"},\"dependency2\":{\"uniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2.dependency2\",\"capability\":\"tosca.capabilities.Node\",\"node\":\"tosca.nodes.importResource4test\",\"relationship\":\"tosca.relationships.DependsOn\"}},\"vendorName\":\"ATT
+ // (Tosca)\",\"vendorRelease\":\"1.0.0.wd03\",\"contactId\":\"jh0003\",\"systemName\":\"Importresource4test\",\"additionalInformation\":[{\"uniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2.additionalinformation\",\"lastCreatedCounter\":0,\"parentUniqueId\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2\",\"parameters\":[]}],\"allVersions\":{\"0.1\":\"52eb0139-a855-47b9-a0e6-c90f0a90b1d2\"},\"abstract\":false,\"highestVersion\":true,\"uuid\":\"2e91a2df-b066-49bb-abde-4c1c01e409db\"}";
+ // convertResourceResponseToJavaObject(response);
+ // }
+
private static final String INVARIANT_UUID = "invariantUUID";
public static final String UNIQUE_ID = "uniqueId";
public static final String VERSION = "version";
@@ -183,30 +215,6 @@ public class ResponseParser {
return propertyDefinition;
}
- // public static ResourceInstanceReqDetails
- // convertResourceInstanceResponseToJavaObject(String response) {
- //
- // ObjectMapper mapper = new ObjectMapper();
- // final SimpleModule module = new
- // SimpleModule("customerSerializationModule", new Version(1, 0, 0, "static
- // version"));
- // JsonDeserializer<PropertyConstraint> desrializer = new
- // PropertyConstraintJacksonDeserialiser();
- // addDeserializer(module, PropertyConstraint.class, desrializer);
- //
- // mapper.registerModule(module);
- // ResourceInstanceReqDetails resourceInstanceReqDetails = null;
- // try {
- // resourceInstanceReqDetails = mapper.readValue(response,
- // ResourceInstanceReqDetails.class);
- // logger.debug(resourceInstanceReqDetails.toString());
- // } catch (IOException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // return resourceInstanceReqDetails;
- // }
public static String toJson(Object object) {
Gson gson = new Gson();
return gson.toJson(object);
@@ -231,17 +239,7 @@ public class ResponseParser {
public static ArtifactReqDetails convertArtifactReqDetailsToJavaObject(String response) {
ArtifactReqDetails artifactReqDetails = null;
- // try {
- //
- // artifactDefinition = mapper.readValue(response,
- // ArtifactReqDetails.class);
- // logger.debug(artifactDefinition.toString());
- // } catch (IOException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // return artifactDefinition;
+
Gson gson = new Gson();
artifactReqDetails = gson.fromJson(response, ArtifactReqDetails.class);
return artifactReqDetails;
@@ -283,17 +281,7 @@ public class ResponseParser {
ArtifactDefinition artifactDefinition) {
ArtifactReqDetails artifactReqDetails = null;
- // try {
- //
- // artifactDefinition = mapper.readValue(response,
- // ArtifactReqDetails.class);
- // logger.debug(artifactDefinition.toString());
- // } catch (IOException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // return artifactDefinition;
+
Gson gson = new Gson();
String artDef = gson.toJson(artifactDefinition);
artifactReqDetails = gson.fromJson(artDef, ArtifactReqDetails.class);
@@ -491,9 +479,11 @@ public class ResponseParser {
}
}
- public static Map<String, ArrayList<Component>> convertCatalogResponseToJavaObject(String response) {
+ public static Map<String, List<Component>> convertCatalogResponseToJavaObject(String response) {
- Map<String, ArrayList<Component>> map = new HashMap<String, ArrayList<Component>>();
+ // Map<String, ArrayList<Component>> map = new HashMap<String,
+ // ArrayList<Component>>();
+ Map<String, List<Component>> map = new HashMap<String, List<Component>>();
JsonElement jElement = new JsonParser().parse(response);
JsonObject jObject = jElement.getAsJsonObject();
@@ -538,4 +528,39 @@ public class ResponseParser {
return map;
}
+
+
+ public static Map<Long, ServiceDistributionStatus> convertServiceDistributionStatusToObject(String response) throws ParseException {
+
+ Map<Long, ServiceDistributionStatus> serviceDistributionStatusMap = new HashMap<Long, ServiceDistributionStatus>();
+ ServiceDistributionStatus serviceDistributionStatusObject = null;
+
+ JsonElement jElement = new JsonParser().parse(response);
+ JsonObject jObject = jElement.getAsJsonObject();
+ JsonArray jDistrStatusArray = jObject.getAsJsonArray("distributionStatusOfServiceList");
+
+ for (int i = 0; i < jDistrStatusArray.size(); i++){
+ Gson gson = new Gson();
+ String servDistrStatus = gson.toJson(jDistrStatusArray.get(i));
+ serviceDistributionStatusObject = gson.fromJson(servDistrStatus, ServiceDistributionStatus.class);
+ serviceDistributionStatusMap.put(Utils.getEpochTimeFromUTC(serviceDistributionStatusObject.getTimestamp()), serviceDistributionStatusObject);
+ }
+
+ return serviceDistributionStatusMap;
+
+ }
+
+ public static Map<String, String> getPropertiesNameType(RestResponse restResponse)
+ throws JSONException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ JSONArray propertiesList = getListFromJson(restResponse, "properties");
+ for (int i = 0; i < propertiesList.length() ; i ++){
+ JSONObject prop = (JSONObject) JSONValue.parse(propertiesList.get(i).toString());
+ String propName = prop.get("name").toString();
+ String propType = prop.get("type").toString();
+ propertiesMap.put(propName, propType);
+ }
+
+ return propertiesMap;
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
index d62c74c3d2..0055dbd982 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ServiceRestUtils.java
@@ -27,14 +27,17 @@ import java.util.Map;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
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.ElementFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,9 +52,13 @@ public class ServiceRestUtils extends BaseRestUtils {
private static Gson gson = new Gson();
- public static RestResponse deleteService(String serviceName, String version, User sdncModifierDetails) throws IOException {
+ public static RestResponse deleteService(String serviceName, String version, User sdncModifierDetails)
+ throws IOException {
+
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_SERVICE_BY_NAME_AND_VERSION, config.getCatalogBeHost(), config.getCatalogBePort(), serviceName, version);
+ String url = String.format(Urls.DELETE_SERVICE_BY_NAME_AND_VERSION, config.getCatalogBeHost(),
+ config.getCatalogBePort(), serviceName, version);
+
String userId = sdncModifierDetails.getUserId();
RestResponse sendDelete = sendDelete(url, userId);
deleteMarkedServices(userId);
@@ -59,8 +66,10 @@ public class ServiceRestUtils extends BaseRestUtils {
}
public static RestResponse deleteServiceById(String serviceId, String userId) throws IOException {
+
Config config = Utils.getConfig();
- String url = String.format(Urls.DELETE_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId);
+ String url = String.format(Urls.DELETE_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(),
+ serviceId);
RestResponse sendDelete = sendDelete(url, userId);
deleteMarkedServices(userId);
return sendDelete;
@@ -78,8 +87,8 @@ public class ServiceRestUtils extends BaseRestUtils {
String url = String.format(Urls.CREATE_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort());
String serviceBodyJson = gson.toJson(service);
- logger.debug("Send POST request to create service: {]", url);
- logger.debug("Service body: {}", serviceBodyJson);
+ logger.debug("Send POST request to create service: {}",url);
+ logger.debug("Service body: {}",serviceBodyJson);
RestResponse res = sendPost(url, serviceBodyJson, user.getUserId(), acceptHeaderData);
if (res.getErrorCode() == STATUS_CODE_CREATED) {
@@ -101,8 +110,8 @@ public class ServiceRestUtils extends BaseRestUtils {
service.getUniqueId());
String serviceBodyJson = gson.toJson(service);
- logger.debug("Send PUT request to create service: {}", url);
- logger.debug("Service body: {}", serviceBodyJson);
+ logger.debug("Send PUT request to create service: {}",url);
+ logger.debug("Service body: {}",serviceBodyJson);
RestResponse res = sendPut(url, serviceBodyJson, user.getUserId(), acceptHeaderData);
if (res.getErrorCode() == STATUS_CODE_CREATED) {
@@ -113,6 +122,13 @@ public class ServiceRestUtils extends BaseRestUtils {
return res;
}
+ public static RestResponse getService(String serviceId) throws IOException {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.GET_SERVICE, config.getCatalogBeHost(), config.getCatalogBePort(), serviceId);
+ return getServiceFromUrl(url, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), false);
+ }
+
public static RestResponse getService(ServiceReqDetails serviceReqDetails, User sdncModifierDetails)
throws IOException {
@@ -141,8 +157,8 @@ public class ServiceRestUtils extends BaseRestUtils {
throws IOException {
Map<String, String> headersMap = prepareHeadersMap(sdncModifierDetails, isCached);
HttpRequest http = new HttpRequest();
- logger.debug("Send GET request to create service: {}", url);
- logger.debug("Service headers: {}", headersMap);
+ logger.debug("Send GET request to create service: {}",url);
+ logger.debug("Service headers: {}",headersMap);
RestResponse sendGetServerRequest = http.httpSendGet(url, headersMap);
return sendGetServerRequest;
@@ -208,9 +224,9 @@ public class ServiceRestUtils extends BaseRestUtils {
String url = String.format(urls, config.getCatalogBeHost(), config.getCatalogBePort());
// TODO: ADD AUTHENTICATION IN REQUEST
logger.debug(url);
- logger.debug("Send {} request to create user: {}", method, url);
- logger.debug("User body: {}", serviceBodyJson);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send {} request to create user: {}",method,url);
+ logger.debug("User body: {}",serviceBodyJson);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendCreateUserRequest = http.httpSendByMethod(url, method, serviceBodyJson, headersMap);
return sendCreateUserRequest;
@@ -254,9 +270,16 @@ public class ServiceRestUtils extends BaseRestUtils {
JSONObject jsonResp = (JSONObject) JSONValue.parse(json);
JSONArray servicesArray = (JSONArray) jsonResp.get("services");
- logger.debug("services = {}", servicesArray);
+ logger.debug("services= {}",servicesArray);
return servicesArray;
}
+
+ public static RestResponse getDistributionServiceList(Service service, User user) throws IOException {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.DISTRIBUTION_SERVICE_LIST, config.getCatalogBeHost(), config.getCatalogBePort(), service.getUUID());
+ return getServiceFromUrl(url, user, false);
+ }
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
index a8f39b9ad8..6c6a66d863 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/UserRestUtils.java
@@ -65,9 +65,9 @@ public class UserRestUtils extends BaseRestUtils {
HttpRequest http = new HttpRequest();
String url = String.format(Urls.CREATE_USER, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send POST request to create user: {}", url);
- logger.debug("User body: {}", userBodyJson);
- logger.debug("User headers: {}", headersMap);
+ logger.debug("Send POST request to create user: {}",url);
+ logger.debug("User body: {}",userBodyJson);
+ logger.debug("User headers: {}",headersMap);
RestResponse sendCreateUserRequest = http.httpSendPost(url, userBodyJson, headersMap);
return sendCreateUserRequest;
@@ -119,7 +119,7 @@ public class UserRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(user);
- logger.debug("userBodyJson: {}", userBodyJson);
+ logger.debug("userBodyJson: {}",userBodyJson);
HttpRequest http = new HttpRequest();
String url = String.format(Urls.UPDATE_USER, config.getCatalogBeHost(), config.getCatalogBePort(),
sdncModifierDetails.getUserId());
@@ -141,7 +141,7 @@ public class UserRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(sdncUserDetails);
- logger.debug("userBodyJson: {}", userBodyJson);
+ logger.debug("userBodyJson: {}",userBodyJson);
HttpRequest http = new HttpRequest();
String url = String.format(Urls.UPDATE_USER_ROLE, config.getCatalogBeHost(), config.getCatalogBePort(),
userIdToUpdate);
@@ -181,7 +181,7 @@ public class UserRestUtils extends BaseRestUtils {
// System.out.println(userBodyJson);
HttpRequest http = new HttpRequest();
String url = String.format(Urls.GET_ALL_ADMIN_USERS, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send following url: {} and headers: {}", url, headersMap.toString());
+ logger.debug("Send following url: {} and headers: {}",url,headersMap.toString());
RestResponse sendGetUserRequest = http.httpSendGet(url, headersMap);
return sendGetUserRequest;
@@ -196,7 +196,6 @@ public class UserRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData);
headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), sdncModifierDetails.getUserId());
-
HttpRequest http = new HttpRequest();
String url;
if (roles == "/") {
@@ -205,7 +204,7 @@ public class UserRestUtils extends BaseRestUtils {
url = String.format(Urls.GET_USERS_BY_ROLES, config.getCatalogBeHost(), config.getCatalogBePort(), roles);
}
- logger.debug("Send following url: {} and headers: {}", url, headersMap.toString());
+ logger.debug("Send following url: {} and headers: {}",url,headersMap.toString());
RestResponse sendGetUserRequest = http.httpSendGet(url, headersMap);
return sendGetUserRequest;
}
@@ -245,12 +244,12 @@ public class UserRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.HTTP_CSP_EMAIL.getValue(), sdncUserDetails.getEmail());
}
- logger.debug("headersMap: {}", headersMap.toString());
+ logger.debug("headersMap: {}",headersMap.toString());
Config config = Utils.getConfig();
HttpRequest http = new HttpRequest();
String url = String.format(Urls.AUTHORIZE_USER, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send GET request to login as seal user : {}", url);
+ logger.debug("Send GET request to login as seal user : {}",url);
return http.httpSendGet(url, headersMap);
}
@@ -270,12 +269,12 @@ public class UserRestUtils extends BaseRestUtils {
headersMap.put(HttpHeaderEnum.HTTP_CSP_EMAIL.getValue(), sdncUserDetails.getEmail());
}
- logger.debug("headersMap: {}", headersMap.toString());
+ logger.debug("headersMap: {}",headersMap.toString());
Config config = Utils.getConfig();
HttpRequest http = new HttpRequest();
String url = String.format(Urls.AUTHORIZE_USER, config.getCatalogBeHost(), config.getCatalogBePort());
- logger.debug("Send GET request to login as seal user : {}", url);
+ logger.debug("Send GET request to login as seal user : {}",url);
return http.httpSendGet(url, headersMap);
}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
index 21b520c97a..f3240684cb 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java
@@ -44,7 +44,9 @@ import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.FileUtils;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import com.google.gson.Gson;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ArtifactValidationUtils {
@@ -118,10 +120,7 @@ public class ArtifactValidationUtils {
ObjectMapper mapper = new ObjectMapper();
ESArtifactData esArtifactObject = mapper.readValue(jsourceElement.toString(), ESArtifactData.class);
- // logger.debug("got artifact details from ElasticSearch as json");
-
return esArtifactObject;
-
}
public static void validateArtifactReqVsResp(ArtifactReqDetails expectedArtifactDetails,
@@ -207,7 +206,6 @@ public class ArtifactValidationUtils {
String sourceDir = config.getResourceConfigDir();
String testResourcesPath = sourceDir + File.separator + folderName;
List<String> listFileName = FileUtils.getFileListFromBaseDirectoryByTestName(testResourcesPath);
- // logger.debug("listFileName: {}", listFileName.get(positionInlist));
String payload = FileUtils.loadPayloadFile(listFileName, ext, true);
heatArtifactDetails.setPayload(payload);
heatArtifactDetails.setArtifactName(listFileName.get(positionInlist) + "." + ext);
@@ -217,7 +215,6 @@ public class ArtifactValidationUtils {
public static ArtifactReqDetails replaceDefaultArtWithArtFromList(ArtifactReqDetails heatArtifactDetails,
String heatExtension, String folderName, int positionInlist) throws IOException, Exception {
List<String> listOfArtifactFromFolder = getListOfArtifactFromFolder(folderName);
- // logger.debug("listFileName: {}", listOfArtifactFromFolder.get(positionInlist));
String payload = FileUtils.loadPayloadFileFromListUsingPosition(listOfArtifactFromFolder, heatExtension, true,
positionInlist);
heatArtifactDetails.setPayload(payload);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
index 882498a63c..0d16308e26 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java
@@ -100,7 +100,6 @@ public class AuditValidationUtils {
}
}
- // logger.debug("audit description - {}", auditDesc);
return auditDesc;
}
@@ -205,24 +204,29 @@ public class AuditValidationUtils {
validateField(actualAuditRecord, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
validateField(actualAuditRecord, AuditJsonKeysEnum.CONSUMER_ID.getAuditJsonKeyName(),
externalAuditObject.getCONSUMER_ID());
+ // TODO
validateField(actualAuditRecord, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(),
externalAuditObject.getRESOURCE_URL());
+ //TODO
validateField(actualAuditRecord, AuditJsonKeysEnum.RESOURCE_NAME.getAuditJsonKeyName(),
externalAuditObject.getRESOURCE_NAME());
validateField(actualAuditRecord, AuditJsonKeysEnum.SERVICE_INSTANCE_ID.getAuditJsonKeyName(),
externalAuditObject.getSERVICE_INSTANCE_ID());
+ //TODO
validateField(actualAuditRecord, AuditJsonKeysEnum.RESOURCE_TYPE.getAuditJsonKeyName(),
externalAuditObject.getRESOURCE_TYPE());
validateField(actualAuditRecord, AuditJsonKeysEnum.STATUS.getAuditJsonKeyName(),
externalAuditObject.getSTATUS());
validateField(actualAuditRecord, AuditJsonKeysEnum.DESCRIPTION.getAuditJsonKeyName(),
externalAuditObject.getDESC());
- validateField(actualAuditRecord, AuditJsonKeysEnum.MODIFIER.getAuditJsonKeyName(),
- externalAuditObject.getMODIFIER());
+ //TODO
+// validateField(actualAuditRecord, AuditJsonKeysEnum.MODIFIER.getAuditJsonKeyName(),
+// externalAuditObject.getMODIFIER());
validateField(actualAuditRecord, AuditJsonKeysEnum.PREV_ARTIFACT_UUID.getAuditJsonKeyName(),
externalAuditObject.getPREV_ARTIFACT_UUID());
validateField(actualAuditRecord, AuditJsonKeysEnum.CURR_ARTIFACT_UUID.getAuditJsonKeyName(),
externalAuditObject.getCURR_ARTIFACT_UUID());
+ //TODO
validateField(actualAuditRecord, AuditJsonKeysEnum.ARTIFACT_DATA.getAuditJsonKeyName(),
externalAuditObject.getARTIFACT_DATA());
@@ -495,6 +499,61 @@ public class AuditValidationUtils {
validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(),
expectedDistDownloadAudit.getResourceUrl());
}
+
+ public static void validateAuditExternalSearchAPI(ExpectedExternalAudit expectedDistDownloadAudit, String action, Map<AuditingFieldsKeysEnum, String> body)
+ throws Exception {
+
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ map2 = parseAuditResourceByAction(action, body);
+
+ validateField(map2, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
+ validateField(map2, AuditJsonKeysEnum.STATUS.getAuditJsonKeyName(), expectedDistDownloadAudit.getSTATUS());
+ validateField(map2, AuditJsonKeysEnum.DESCRIPTION.getAuditJsonKeyName(), expectedDistDownloadAudit.getDESC());
+ validateField(map2, AuditJsonKeysEnum.CONSUMER_ID.getAuditJsonKeyName(),
+ expectedDistDownloadAudit.getCONSUMER_ID());
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(),
+ expectedDistDownloadAudit.getRESOURCE_URL());
+ }
+
+ public static void validateAuditExternalCreateResource(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ map2 = parseAuditResourceByAction(action, body);
+
+ validateField(map2, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_NAME.getAuditJsonKeyName(), expectedExternalAudit.getResourceName());
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_TYPE.getAuditJsonKeyName(), expectedExternalAudit.getResourceType());
+ validateField(map2, AuditJsonKeysEnum.CONSUMER_ID.getAuditJsonKeyName(), expectedExternalAudit.getCONSUMER_ID());
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(), expectedExternalAudit.getRESOURCE_URL());
+ validateField(map2, AuditJsonKeysEnum.MODIFIER.getAuditJsonKeyName(), expectedExternalAudit.getMODIFIER());
+
+ validateField(map2, AuditJsonKeysEnum.PREV_VERSION.getAuditJsonKeyName(), expectedExternalAudit.getPrevVersion());
+ validateField(map2, AuditJsonKeysEnum.CURR_VERSION.getAuditJsonKeyName(), expectedExternalAudit.getCurrVersion());
+ validateField(map2, AuditJsonKeysEnum.PREV_STATE.getAuditJsonKeyName(), expectedExternalAudit.getPrevState());
+ validateField(map2, AuditJsonKeysEnum.CURR_STATE.getAuditJsonKeyName(), expectedExternalAudit.getCurrState());
+
+ validateField(map2, AuditJsonKeysEnum.STATUS.getAuditJsonKeyName(), expectedExternalAudit.getStatus());
+ validateField(map2, AuditJsonKeysEnum.DESCRIPTION.getAuditJsonKeyName(), expectedExternalAudit.getDesc());
+ }
+
+ public static void validateAuditExternalChangeLifecycle(ExpectedResourceAuditJavaObject expectedExternalAudit, String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+ Map<String, Object> map2 = new HashMap<String, Object>();
+ map2 = parseAuditResourceByAction(action, body);
+
+ validateField(map2, AuditJsonKeysEnum.ACTION.getAuditJsonKeyName(), action);
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_NAME.getAuditJsonKeyName(), expectedExternalAudit.getResourceName());
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_TYPE.getAuditJsonKeyName(), expectedExternalAudit.getResourceType());
+ validateField(map2, AuditJsonKeysEnum.CONSUMER_ID.getAuditJsonKeyName(), expectedExternalAudit.getCONSUMER_ID());
+ validateField(map2, AuditJsonKeysEnum.RESOURCE_URL.getAuditJsonKeyName(), expectedExternalAudit.getRESOURCE_URL());
+ validateField(map2, AuditJsonKeysEnum.MODIFIER.getAuditJsonKeyName(), expectedExternalAudit.getMODIFIER());
+
+ validateField(map2, AuditJsonKeysEnum.PREV_VERSION.getAuditJsonKeyName(), expectedExternalAudit.getPrevVersion());
+ validateField(map2, AuditJsonKeysEnum.CURR_VERSION.getAuditJsonKeyName(), expectedExternalAudit.getCurrVersion());
+ validateField(map2, AuditJsonKeysEnum.PREV_STATE.getAuditJsonKeyName(), expectedExternalAudit.getPrevState());
+ validateField(map2, AuditJsonKeysEnum.CURR_STATE.getAuditJsonKeyName(), expectedExternalAudit.getCurrState());
+
+ validateField(map2, AuditJsonKeysEnum.STATUS.getAuditJsonKeyName(), expectedExternalAudit.getStatus());
+ validateField(map2, AuditJsonKeysEnum.DESCRIPTION.getAuditJsonKeyName(), expectedExternalAudit.getDesc());
+ }
public void validateAuditDeploy(ExpectedResourceAuditJavaObject resourceAuditJavaObject, String action)
throws Exception {
@@ -634,11 +693,10 @@ public class AuditValidationUtils {
//
// }
- public static Map<String, Object> parseAuditResourceByAction(String action,
- Map<AuditingFieldsKeysEnum, String> body) throws Exception {
+ public static Map<String, Object> parseAuditResourceByAction(String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception {
Map auditingMessage = null;
- auditingMessage = retrieveAuditMessagesByPattern(action, body);
+ auditingMessage = retrieveAuditMessagesByPattern(action, body, false);
return auditingMessage;
@@ -678,12 +736,12 @@ public class AuditValidationUtils {
Map auditingMessage = null;
if (body == null || body.isEmpty()) {
- auditingMessage = retrieveAuditMessagesByPattern(action, null);
+ auditingMessage = retrieveAuditMessagesByPattern(action, null, false);
// String pattern = "/_search?q=ACTION:\"" + action + "\"";
// auditingMessage = retrieveAuditMessagesByPattern(action);
// auditingMessage = retrieveAuditMessagesByPattern(pattern);
} else {
- auditingMessage = retrieveAuditMessagesByPattern(action, body);
+ auditingMessage = retrieveAuditMessagesByPattern(action, body, false);
// auditingMessage = retrieveAuditMessagesUsingBody(body);
}
@@ -737,11 +795,12 @@ public class AuditValidationUtils {
return restResponse.getResponse();
}
- public static Map retrieveAuditMessagesByPattern(String action, Map<AuditingFieldsKeysEnum, String> body)
+ public static Map<String, String> retrieveAuditMessagesByPattern(String action, Map<AuditingFieldsKeysEnum, String> body, Boolean retryFlag)
throws IOException {
// get cassandra table name by action
String esType = AuditingActionEnum.getActionByName(action).getAuditingEsType();
+ Map<String, String> resultsMap = new HashMap<String, String>();
List<Pair<AuditingFieldsKeysEnum, String>> myFields = new ArrayList<Pair<AuditingFieldsKeysEnum, String>>();
Pair<AuditingFieldsKeysEnum, String> myPair = new Pair<AuditingFieldsKeysEnum, String>(
@@ -754,13 +813,16 @@ public class AuditValidationUtils {
}
List<Row> fetchFromTable = CassandraUtils.fetchFromTable(auditKeySpaceName, esType, myFields);
- assertTrue("expected on fetching from data base one record only, actual: " + fetchFromTable.size(),
- fetchFromTable.size() == 1);
+ if(retryFlag){
+ if(fetchFromTable.size() == 0){
+ return resultsMap;
+ }
+ }
+ assertTrue("expected on fetching from data base one record only, actual: " + fetchFromTable.size(), fetchFromTable.size() == 1);
Row row = fetchFromTable.get(0);
ColumnDefinitions columnDefinitions = row.getColumnDefinitions();
- Map<String, String> resultsMap = new HashMap<String, String>();
for (int i = 0; i < columnDefinitions.size(); i++) {
resultsMap.put(columnDefinitions.getName(i), row.getObject(columnDefinitions.getName(i)) == null ? "null"
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
index eb3ee331ed..0d49d97302 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java
@@ -28,6 +28,7 @@ import java.util.Arrays;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.exception.ResponseFormat;
import org.testng.Assert;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
index cd2297fd19..d63a514b3a 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java
@@ -20,10 +20,9 @@
package org.openecomp.sdc.ci.tests.utils.validation;
-import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
-
+import static org.testng.AssertJUnit.assertEquals;
import org.json.JSONObject;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.GroupingDefinition;
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
index 29f9e84dd8..05e3874fc0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java
@@ -53,8 +53,10 @@ public class CsarValidationUtils {
public static String getCsarPayload(String csarName, String fileLocation) throws Exception {
- RestResponseAsByteArray csar = ImportRestUtils.getCsar(csarName, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
- assertTrue("Return response code different from 200", csar.getHttpStatusCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ RestResponseAsByteArray csar = ImportRestUtils.getCsar(csarName,
+ ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
+ assertTrue("Return response code different from 200",
+ csar.getHttpStatusCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
Map<String, byte[]> readZip = null;
byte[] data = csar.getResponse();
if (data != null && data.length > 0) {
@@ -86,7 +88,8 @@ public class CsarValidationUtils {
}
- protected static List<TypeHeatMetaDefinition> getArtifactsByGroup(JSONObject jsonObjectImportStructure, List<TypeHeatMetaDefinition> listHeatMetaDefenition) {
+ protected static List<TypeHeatMetaDefinition> getArtifactsByGroup(JSONObject jsonObjectImportStructure,
+ List<TypeHeatMetaDefinition> listHeatMetaDefenition) {
@SuppressWarnings("unchecked")
Set<Object> typeSet = jsonObjectImportStructure.keySet();
@@ -103,7 +106,8 @@ public class CsarValidationUtils {
return listHeatMetaDefenition;
}
- protected static List<GroupHeatMetaDefinition> fetchArtifactByGroup(JSONArray array, List<GroupHeatMetaDefinition> listGroupHeatMetaDefinition, Boolean openNewGroup) {
+ protected static List<GroupHeatMetaDefinition> fetchArtifactByGroup(JSONArray array,
+ List<GroupHeatMetaDefinition> listGroupHeatMetaDefinition, Boolean openNewGroup) {
GroupHeatMetaDefinition groupHeatMetaDefinition;
@@ -130,8 +134,10 @@ public class CsarValidationUtils {
PropertyHeatMetaDefinition propertyHeatMetaDefinition = new PropertyHeatMetaDefinition();
propertyHeatMetaDefinition.setName(groupKeyStr);
propertyHeatMetaDefinition.setValue((boolean) jsonObject.get(groupKeyStr));
- if (!groupHeatMetaDefinition.getPropertyHeatMetaDefinition().equals(propertyHeatMetaDefinition)) {
- groupHeatMetaDefinition.getPropertyHeatMetaDefinition().setValue((boolean) jsonObject.get(groupKeyStr));
+ if (!groupHeatMetaDefinition.getPropertyHeatMetaDefinition()
+ .equals(propertyHeatMetaDefinition)) {
+ groupHeatMetaDefinition.getPropertyHeatMetaDefinition()
+ .setValue((boolean) jsonObject.get(groupKeyStr));
}
}
if (groupKeyStr.equals("fileName") || groupKeyStr.equals("env")) {
@@ -141,7 +147,8 @@ public class CsarValidationUtils {
groupHeatMetaDefinition.setArtifactList(listArtifactNames);
} else {
if (!groupKeyStr.equals("isBase")) {
- fetchArtifactByGroup((JSONArray) jsonObject.get(groupKeyStr), listGroupHeatMetaDefinition, false);
+ fetchArtifactByGroup((JSONArray) jsonObject.get(groupKeyStr), listGroupHeatMetaDefinition,
+ false);
}
}
}
@@ -150,12 +157,14 @@ public class CsarValidationUtils {
return listGroupHeatMetaDefinition;
}
- private static Integer getArtifactCount(List<TypeHeatMetaDefinition> listHeatMetaDefenition, Boolean isEnvIncluded) {
+ private static Integer getArtifactCount(List<TypeHeatMetaDefinition> listHeatMetaDefenition,
+ Boolean isEnvIncluded) {
int count = 0;
List<String> uniqeArtifactList = new ArrayList<>();
for (TypeHeatMetaDefinition typeHeatMetaDefinition : listHeatMetaDefenition) {
- for (GroupHeatMetaDefinition groupHeatMetaDefinition : typeHeatMetaDefinition.getGroupHeatMetaDefinition()) {
+ for (GroupHeatMetaDefinition groupHeatMetaDefinition : typeHeatMetaDefinition
+ .getGroupHeatMetaDefinition()) {
if (isEnvIncluded) {
count = count + groupHeatMetaDefinition.getArtifactList().size();
} else {
@@ -189,17 +198,27 @@ public class CsarValidationUtils {
public static void validateCsarVfArtifact(String csarUUID, Resource resource) throws Exception {
List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = getListTypeHeatMetaDefinition(csarUUID);
- assertTrue("check group count, expected: " + getGroupCount(listTypeHeatMetaDefinition) + ", actual: " + resource.getGroups().size(), getGroupCount(listTypeHeatMetaDefinition) == resource.getGroups().size());
- assertTrue("check artifact count, expected: " + getArtifactCount(listTypeHeatMetaDefinition, false) + ", actual: " + resource.getDeploymentArtifacts().size(),
+ assertTrue(
+ "check group count, expected: " + getGroupCount(listTypeHeatMetaDefinition) + ", actual: "
+ + resource.getGroups().size(),
+ getGroupCount(listTypeHeatMetaDefinition) == resource.getGroups().size());
+ assertTrue(
+ "check artifact count, expected: " + getArtifactCount(listTypeHeatMetaDefinition, false) + ", actual: "
+ + resource.getDeploymentArtifacts().size(),
getArtifactCount(listTypeHeatMetaDefinition, false) == resource.getDeploymentArtifacts().size());
}
- public static void validateToscaDefinitonObjectVsResource(ToscaDefinition toscaDefinition, Resource resource) throws Exception {
+ public static void validateToscaDefinitonObjectVsResource(ToscaDefinition toscaDefinition, Resource resource)
+ throws Exception {
- assertTrue("check resource instance count, expected: " + getResourceInstanceCount(toscaDefinition) + ", actual: " + resource.getComponentInstances().size(),
+ assertTrue(
+ "check resource instance count, expected: " + getResourceInstanceCount(toscaDefinition) + ", actual: "
+ + resource.getComponentInstances().size(),
getResourceInstanceCount(toscaDefinition) == resource.getComponentInstances().size());
- assertTrue("check resource instance relation count, expected: " + getResourceInstanceRelationCount(toscaDefinition) + ", actual: " + resource.getComponentInstancesRelations().size(),
+ assertTrue(
+ "check resource instance relation count, expected: " + getResourceInstanceRelationCount(toscaDefinition)
+ + ", actual: " + resource.getComponentInstancesRelations().size(),
getResourceInstanceRelationCount(toscaDefinition) == resource.getComponentInstancesRelations().size());
}
@@ -211,9 +230,11 @@ public class CsarValidationUtils {
public static Integer getResourceInstanceRelationCount(ToscaDefinition toscaDefinition) {
int count = 0;
- List<ToscaNodeTemplatesTopologyTemplateDefinition> toscaNodeTemplatesTopologyTemplateDefinition = toscaDefinition.getToscaTopologyTemplate().getToscaNodeTemplatesTopologyTemplateDefinition();
+ List<ToscaNodeTemplatesTopologyTemplateDefinition> toscaNodeTemplatesTopologyTemplateDefinition = toscaDefinition
+ .getToscaTopologyTemplate().getToscaNodeTemplatesTopologyTemplateDefinition();
for (int i = 0; i < toscaNodeTemplatesTopologyTemplateDefinition.size(); i++) {
- List<ToscaRequirementsNodeTemplatesDefinition> requirements = toscaNodeTemplatesTopologyTemplateDefinition.get(i).getRequirements();
+ List<ToscaRequirementsNodeTemplatesDefinition> requirements = toscaNodeTemplatesTopologyTemplateDefinition
+ .get(i).getRequirements();
if (requirements != null) {
for (ToscaRequirementsNodeTemplatesDefinition requirement : requirements) {
if (requirement.getNode() != null) {
@@ -234,7 +255,10 @@ public class CsarValidationUtils {
assertTrue("group description is null", groupDefinition.getDescription() != null);
assertTrue("InvariantUUID is null", groupDefinition.getInvariantUUID() != null);
// groupDefinition.getMembers();
- assertTrue("name format mismatch, expected: " + groupNameBuilder(resource) + "[0-9], actual: " + groupDefinition.getName(), groupDefinition.getName().contains(groupNameBuilder(resource)));
+ assertTrue(
+ "name format mismatch, expected: " + groupNameBuilder(resource) + "[0-9], actual: "
+ + groupDefinition.getName(),
+ groupDefinition.getName().contains(groupNameBuilder(resource)));
// groupDefinition.getProperties();
// groupDefinition.getPropertyValueCounter();
assertTrue(groupDefinition.getType().equals(getGroupType()));
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java
new file mode 100644
index 0000000000..46948d8f5b
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/DistributionValidationUtils.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utils.validation;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.utils.DistributionUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+
+public class DistributionValidationUtils {
+
+ public static Map<String, String> verifyDistributedArtifactDownloadUsingDB(String distributionID, Map<String, String> expectedArtifactsMapOfDistributedService, List<String> distributionStatusEnumList) throws Exception {
+
+ String action = "DStatus";
+ int timer = 0;
+ int timeWaitPerArtifcat = 3;
+ if(expectedArtifactsMapOfDistributedService.size() != 0){
+ timer = (expectedArtifactsMapOfDistributedService.size()/10*15 + expectedArtifactsMapOfDistributedService.size() * timeWaitPerArtifcat * distributionStatusEnumList.size() + 30) * 1000 ;
+ }
+ for (String distributionStatusList : distributionStatusEnumList){
+ for (Entry<String, String> url : expectedArtifactsMapOfDistributedService.entrySet()){
+ Map <AuditingFieldsKeysEnum, String> body = new HashMap<>();
+ body.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, distributionID);
+ body.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, url.getValue());
+ body.put(AuditingFieldsKeysEnum.AUDIT_STATUS, distributionStatusList);
+ Map<String, String> actualAuditRecord = new HashMap<String, String>();
+ actualAuditRecord = AuditValidationUtils.retrieveAuditMessagesByPattern(action, body, true);
+ while (timer != 0) {
+ if(actualAuditRecord.size() == 0 ){
+ Thread.sleep(1000);
+ actualAuditRecord = AuditValidationUtils.retrieveAuditMessagesByPattern(action, body, true);
+ timer-=1000;
+ if(timer == 0 && actualAuditRecord.size() == 0){
+ assertNotNull("audit record did not found in DB for artifact url: " + url.getValue(), null);
+ }
+ }else{
+ timer = timer - timeWaitPerArtifcat * 1000;
+ break;
+ }
+
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void validateDistributedArtifactsByAudit(Service service, List<String> distributionStatusList) throws Exception, IOException, ParseException {
+ String distributionID;
+ AtomicOperationUtils.distributeService(service, true);
+ distributionID = DistributionUtils.getLatestServiceDistributionObject(service).getDistributionID();
+ if(distributionID != null){
+ Map<String, String> expectedArtifactsMapOfDistributedService = DistributionUtils.getArtifactsMapOfDistributedService(service);
+ DistributionValidationUtils.verifyDistributedArtifactDownloadUsingDB(distributionID, expectedArtifactsMapOfDistributedService, distributionStatusList);
+ }
+ else{
+ assertNotNull("distributionID is null", distributionID);
+ }
+ }
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
index ac5a05d7ca..94dcca7edf 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.util.List;
import java.util.Map;
+import org.yaml.snakeyaml.Yaml;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.openecomp.sdc.ci.tests.config.Config;
@@ -37,7 +38,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ExceptionEnumType;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
public class ErrorValidationUtils {
@@ -58,10 +58,19 @@ public class ErrorValidationUtils {
}
}
actualResponse = actualResponse.replaceAll("\\n", "");
- logger.debug("actualResponse - {}", actualResponse);
- logger.debug("expectedResponseBody - {}", expectedResponseBody);
+ logger.debug("actualResponse - {}",actualResponse);
+ logger.debug("expectedResponseBody - {}",expectedResponseBody);
assertEquals(expectedResponseBody, new JSONObject(actualResponse));
}
+
+ public static String checkUIResponseOnError(String errorType)
+ throws FileNotFoundException, JSONException {
+
+ ErrorInfo errorInfo = parseErrorConfigYaml(errorType);
+ String messageId = errorInfo.getMessageId();
+
+ return messageId;
+ }
public static JSONObject restExceptionFormatBuilder(String messageId, String text, List<String> variables,
String type) {
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
index a3440df8ad..7bbadc5c1b 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ResourceValidationUtils.java
@@ -167,7 +167,7 @@ public class ResourceValidationUtils {
resourceRespJavaObject.getCreatorUserId());
validateField(map, RespJsonKeysEnum.CREATOR_FULL_NAME.getRespJsonKeyName(),
resourceRespJavaObject.getCreatorFullName());
- validateField(map, RespJsonKeysEnum.LAST_UPDATER_ATT_UID.getRespJsonKeyName(),
+ validateField(map, RespJsonKeysEnum.LAST_UPDATER_USER_ID.getRespJsonKeyName(),
resourceRespJavaObject.getLastUpdaterUserId());
validateField(map, RespJsonKeysEnum.LAST_UPDATER_FULL_NAME.getRespJsonKeyName(),
resourceRespJavaObject.getLastUpdaterFullName());
@@ -220,6 +220,10 @@ public class ResourceValidationUtils {
assertTrue("expected " + expectedValue + " not equal to actual " + foundValue,
foundValue.equals(expectedValue));
}
+ /*
+ * else if( expectedValue instanceof Number){ assertTrue(foundValue
+ * instanceof Number); assertTrue(foundValue == expectedValue); }
+ */
else if (expectedValue instanceof Boolean) {
assertTrue(foundValue instanceof Boolean);
assertTrue(foundValue == expectedValue);
@@ -270,7 +274,7 @@ public class ResourceValidationUtils {
if (interfaze != null) {
interfaces = resource.getInterfaces();
- Map<String, Operation> operation = interfaces.get(interfaze).getOperations();
+ Map<String, Operation> operation = interfaces.get(interfaze).getOperationsMap();
// operation.get("configure").getUniqueId();
}
@@ -298,7 +302,7 @@ public class ResourceValidationUtils {
resourceRespJavaObject.getCreatorUserId());
validateField(map, RespJsonKeysEnum.CREATOR_FULL_NAME.getRespJsonKeyName(),
resourceRespJavaObject.getCreatorFullName());
- validateField(map, RespJsonKeysEnum.LAST_UPDATER_ATT_UID.getRespJsonKeyName(),
+ validateField(map, RespJsonKeysEnum.LAST_UPDATER_USER_ID.getRespJsonKeyName(),
resourceRespJavaObject.getLastUpdaterUserId());
validateField(map, RespJsonKeysEnum.LAST_UPDATER_FULL_NAME.getRespJsonKeyName(),
resourceRespJavaObject.getLastUpdaterFullName());
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
index 19bd7b9488..a7c7b7d34e 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java
@@ -20,9 +20,8 @@
package org.openecomp.sdc.ci.tests.utils.validation;
-import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
-
+import static org.testng.AssertJUnit.assertEquals;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -73,7 +72,8 @@ public class ServiceValidationUtils {
assertEquals("Check attContant name on response after create service",
expectedService.getContactId().toLowerCase(), service.getContactId());
assertEquals("Check icon name on response after create service", expectedService.getIcon(), service.getIcon());
- assertEquals("Check LastUpdaterUserId after create service", updaterUser.getUserId(), service.getLastUpdaterUserId());
+ assertEquals("Check LastUpdaterUserId after create service", updaterUser.getUserId(),
+ service.getLastUpdaterUserId());
assertEquals("Check LastUpdaterName after create service",
updaterUser.getFirstName() + " " + updaterUser.getLastName(), service.getLastUpdaterFullName());
assertEquals("Check CreatorUserId after create service", creatorUser.getUserId(), service.getCreatorUserId());
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/TestYamlParser.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/TestYamlParser.java
new file mode 100644
index 0000000000..223bf4ed4b
--- /dev/null
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/TestYamlParser.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.utils.validation;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.common.util.ZipUtil;
+import org.testng.annotations.Test;
+import org.yaml.snakeyaml.Yaml;
+
+
+
+
+public class TestYamlParser extends ComponentBaseTest{
+
+
+
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public TestYamlParser() {
+ super(name, TestYamlParser.class.getName());
+ }
+
+
+
+
+
+ @Test
+ public void testYaml() throws IOException{
+
+ System.out.println("");
+
+ File file = new File("\\\\Comp-1\\FileIO\\Stop.txt");
+
+
+ //read file
+
+
+ Map<String, byte[]> readZip = null;
+ Path path = Paths.get("C:\\Users\\ys9693\\Documents\\csar\\attributesWithProporties\\attributesWithProporties.csar");
+ byte[] data = Files.readAllBytes(path);
+ if (data != null && data.length > 0) {
+ readZip = ZipUtil.readZip(data);
+
+ }
+
+ byte[] artifactsBs = readZip.get("Definitions/VF_RI2_G6.yaml");
+ String str = new String(artifactsBs, StandardCharsets.UTF_8);
+
+
+
+
+ Yaml yaml = new Yaml();
+ Map<String, Object> load = (Map<String, Object>) yaml.load(str);
+ Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template");
+ Map<String, Object> node_templates = (Map<String, Object>) topology_template.get("node_templates");
+
+ Set<String> keySet = node_templates.keySet();
+ }
+
+
+}
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
index a75434edcf..9c44aa55ef 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.ci.tests.utils.validation;
-import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
import java.util.List;
@@ -55,7 +55,7 @@ public class UserValidationUtils {
String actualUserId = actual.getUserId();
String expectedUserId = expected.getUserId();
- assertEquals("check user userId - ", expectedUserId, actualUserId);
+ assertEquals("check user UserId - ", expectedUserId, actualUserId);
String actualEmail = actual.getEmail();
String expectedEmail = expected.getEmail();
@@ -203,10 +203,6 @@ public class UserValidationUtils {
}
assertEquals("check audit user desc - ", expected, auditJavaObject.getDESC());
-
- // expected = sdncUserDetails.getUserId();
- // assertEquals(expected, auditJavaObject.getUSER());
-
}
public static void validateUserDetailsOnResponse(User sdncUserDetails, String userDetailsOnResponse) {
@@ -221,7 +217,7 @@ public class UserValidationUtils {
String actualUserId = Utils.getJsonObjectValueByKey(userDetailsOnResponse, "userId");
String expectedUserId = sdncUserDetails.getUserId();
- assertEquals("check user userId - ", expectedUserId, actualUserId);
+ assertEquals("check user UserId - ", expectedUserId, actualUserId);
String actualEmail = Utils.getJsonObjectValueByKey(userDetailsOnResponse, "email");
String expectedEmail = sdncUserDetails.getEmail();
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java b/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
index 8ea8524489..9b98688036 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
@@ -37,6 +37,7 @@ import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactUiDownloadData;
import org.openecomp.sdc.be.model.Resource;
@@ -122,14 +123,14 @@ public class GetAssetServlet extends ComponentBaseTest {
List<String> expectedAssetNamesList = new ArrayList<>();
ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
- resourceDetails.setName("Resource1");
+ resourceDetails.setName("ciResource1");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
Resource resource = ResponseParser.parseToObjectUsingMapper(createResource.getResponse(), Resource.class);
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource2");
+ resourceDetails.setName("ciResource2");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -141,7 +142,7 @@ public class GetAssetServlet extends ComponentBaseTest {
expectedAssetNamesList.add(resource.getName());
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource3");
+ resourceDetails.setName("ciResource3");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -151,7 +152,7 @@ public class GetAssetServlet extends ComponentBaseTest {
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource4");
+ resourceDetails.setName("ciResource4");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -163,7 +164,7 @@ public class GetAssetServlet extends ComponentBaseTest {
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource5");
+ resourceDetails.setName("ciResource5");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -174,7 +175,7 @@ public class GetAssetServlet extends ComponentBaseTest {
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource6");
+ resourceDetails.setName("ciResource6");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -182,7 +183,7 @@ public class GetAssetServlet extends ComponentBaseTest {
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
expectedAssetNamesList.add(resource.getName());
- resourceDetails.setName("Resource7");
+ resourceDetails.setName("ciResource7");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createResource);
@@ -201,7 +202,7 @@ public class GetAssetServlet extends ComponentBaseTest {
List<String> getActualAssetNamesList = AssetRestUtils.getResourceNamesList(resourceAssetList);
Utils.compareArrayLists(getActualAssetNamesList, expectedAssetNamesList, "Element");
- AssetRestUtils.checkResourceTypeInObjectList(resourceAssetList, ResourceTypeEnum.VF);
+ AssetRestUtils.checkComponentTypeInObjectList(resourceAssetList, ComponentTypeEnum.RESOURCE);
// Validate audit message
ExpectedExternalAudit expectedAssetListAudit = ElementFactory.getDefaultAssetListAudit(AssetTypeEnum.RESOURCES, AuditingActionEnum.GET_ASSET_LIST);
@@ -216,13 +217,13 @@ public class GetAssetServlet extends ComponentBaseTest {
ArtifactReqDetails artifactDetails = ElementFactory.getArtifactByType(ArtifactTypeEnum.OTHER, ArtifactTypeEnum.OTHER, true);
ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- serviceDetails.setName("Service1");
+ serviceDetails.setName("ciService1");
RestResponse createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
Service service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service2");
+ serviceDetails.setName("ciService2");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -235,7 +236,7 @@ public class GetAssetServlet extends ComponentBaseTest {
expectedAssetNamesList.add(service.getName());
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service3");
+ serviceDetails.setName("ciService3");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -246,7 +247,7 @@ public class GetAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service4");
+ serviceDetails.setName("ciService4");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -257,7 +258,7 @@ public class GetAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service5");
+ serviceDetails.setName("ciService5");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -267,7 +268,7 @@ public class GetAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service6");
+ serviceDetails.setName("ciService6");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -276,7 +277,7 @@ public class GetAssetServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service7");
+ serviceDetails.setName("ciService7");
createService = ServiceRestUtils.createService(serviceDetails, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
@@ -307,7 +308,7 @@ public class GetAssetServlet extends ComponentBaseTest {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
- resourceDetails.setName("Resource1");
+ resourceDetails.setName("ciResource1");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncUserDetails);
BaseRestUtils.checkCreateResponse(createResource);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java b/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
index 05d305ad9a..791a490288 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/externalApis/GetSpecificAssetMetadataServlet.java
@@ -101,7 +101,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
AuditingActionEnum.GET_ASSET_METADATA.getName(), null);
}
- @Test // (enabled = false)
+ @Test (enabled = false)
public void getResourceAssetMetadataWithResourceInstancesSuccess() throws Exception {
Resource resourceVF = AtomicOperationUtils
@@ -455,7 +455,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
}
- @Test // (enabled = false)
+ @Test (enabled = false)
public void getServiceAssetMetadataWithCertifiedResourceInstancesAndArtifactsOnRIsAndServiceSuccess()
throws Exception {
@@ -570,7 +570,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
// Validate audit message
ArrayList<String> variables = new ArrayList<>();
variables.add(serviceUuid);
- ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), variables,
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), variables,
assetResponse.getResponse());
}
@@ -583,7 +583,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
ResourceReqDetails resourceDetails = ElementFactory
.getDefaultResource(ResourceCategoryEnum.APPLICATION_L4_APP_SERVER);
- resourceDetails.setName("Resource1");
+ resourceDetails.setName("ciResource1");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
RestResponse createResource = ResourceRestUtils.createResource(resourceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
@@ -592,7 +592,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
expectedAssetNamesList.add(resource.getName());
resourceDetails = ElementFactory.getDefaultResource(ResourceCategoryEnum.APPLICATION_L4_BORDER);
- resourceDetails.setName("Resource2");
+ resourceDetails.setName("ciResource2");
resourceDetails.setResourceType(ResourceTypeEnum.VFC.name());
createResource = ResourceRestUtils.createResource(resourceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
@@ -608,7 +608,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
resourceDetails = ElementFactory.getDefaultResource(ResourceCategoryEnum.GENERIC_INFRASTRUCTURE);
- resourceDetails.setName("Resource3");
+ resourceDetails.setName("ciResource3");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
@@ -622,7 +622,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
resourceDetails = ElementFactory.getDefaultResource(ResourceCategoryEnum.APPLICATION_L4_FIREWALL);
- resourceDetails.setName("Resource4");
+ resourceDetails.setName("ciResource4");
resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
createResource = ResourceRestUtils.createResource(resourceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
@@ -679,13 +679,13 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
ArtifactTypeEnum.OTHER, true);
ServiceReqDetails serviceDetails = ElementFactory.getDefaultService();
- serviceDetails.setName("Service1");
+ serviceDetails.setName("ciService1");
RestResponse createService = ServiceRestUtils.createService(serviceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
Service service = ResponseParser.parseToObjectUsingMapper(createService.getResponse(), Service.class);
- serviceDetails.setName("Service2");
+ serviceDetails.setName("ciService2");
createService = ServiceRestUtils.createService(serviceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
@@ -703,7 +703,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
AtomicOperationUtils.distributeService(service, false);
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service3");
+ serviceDetails.setName("ciService3");
createService = ServiceRestUtils.createService(serviceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
@@ -724,7 +724,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
AtomicOperationUtils.distributeService(service, false);
expectedAssetNamesList.add(service.getName());
- serviceDetails.setName("Service4");
+ serviceDetails.setName("ciService4");
createService = ServiceRestUtils.createService(serviceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
@@ -740,7 +740,7 @@ public class GetSpecificAssetMetadataServlet extends ComponentBaseTest {
service = (Service) AtomicOperationUtils
.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
- serviceDetails.setName("Service5");
+ serviceDetails.setName("ciService5");
createService = ServiceRestUtils.createService(serviceDetails,
ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER));
BaseRestUtils.checkCreateResponse(createService);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/post/Install.java b/asdc-tests/src/main/java/org/openecomp/sdc/post/Install.java
index f0494fe177..5e9e02c479 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/post/Install.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/post/Install.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.post;
import java.io.File;
+import org.openecomp.sdc.be.dao.DAOTitanStrategy;
import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
@@ -46,8 +47,8 @@ public class Install {
}
private static boolean createTitanSchema(String titanPropsFile) {
- TitanGraphClient titanGraphClient = new TitanGraphClient();
- TitanOperationStatus status = titanGraphClient.createGraph(titanPropsFile, true);
+ TitanGraphClient titanGraphClient = new TitanGraphClient(new DAOTitanStrategy());
+ TitanOperationStatus status = titanGraphClient.createGraph(titanPropsFile);
if (TitanOperationStatus.OK == status) {
System.out.println("Titan schema ,indexes and default values created successfully.");
return true;
diff --git a/asdc-tests/src/main/resources/ci/conf/sdc-packages.yaml b/asdc-tests/src/main/resources/ci/conf/attsdc-packages.yaml
index 5d1a3e1537..5d1a3e1537 100644
--- a/asdc-tests/src/main/resources/ci/conf/sdc-packages.yaml
+++ b/asdc-tests/src/main/resources/ci/conf/attsdc-packages.yaml
diff --git a/asdc-tests/src/main/resources/ci/conf/sdc.yaml b/asdc-tests/src/main/resources/ci/conf/attsdc.yaml
index c9730811b3..10bf38f89d 100644
--- a/asdc-tests/src/main/resources/ci/conf/sdc.yaml
+++ b/asdc-tests/src/main/resources/ci/conf/attsdc.yaml
@@ -7,6 +7,7 @@ disributionClientHost: disClient
catalogFePort: 8181
catalogBePort: 8080
disributionClientPort: 8181
+isDistributionClientRunning: true
esPort: 9200
neoHost: neoHost
neoPort: 7474
@@ -30,8 +31,8 @@ cassandraPassword: bobo
cassandraSsl: false
cassandraTruststorePath : /path/path
cassandraTruststorePassword : 123123
-cassandraAuditKeySpace: sdcAudit
-cassandraArtifactKeySpace: sdcArtifact
+cassandraAuditKeySpace: sdcaudit
+cassandraArtifactKeySpace: sdcartifact
stopOnClassFailure: false
@@ -78,11 +79,13 @@ resourceCategoriesNotToDelete:
- Network L4+
- Application L4+
- Network Connectivity
- - DcaeComponent
+ - DCAE Component
+ - Template
+ - Allotted Resource
#Service categories to keep
serviceCategoriesNotToDelete:
- Mobility
- Network L1-3
- Network L4+
- - VoIP Call Control \ No newline at end of file
+ - VoIP Call Control
diff --git a/asdc-tests/src/main/resources/ci/conf/titan.properties b/asdc-tests/src/main/resources/ci/conf/titan.properties
index 42e1998f89..0fe7888b9e 100644
--- a/asdc-tests/src/main/resources/ci/conf/titan.properties
+++ b/asdc-tests/src/main/resources/ci/conf/titan.properties
@@ -4,5 +4,5 @@ storage.hostname=localhost
storage.port=9160
cache.db-cache = false
-
+storage.cassandra.keyspace=sdctitan
diff --git a/asdc-tests/src/main/resources/ci/scripts/startTest.sh b/asdc-tests/src/main/resources/ci/scripts/startTest.sh
index ca3add59c5..01b8979781 100644
--- a/asdc-tests/src/main/resources/ci/scripts/startTest.sh
+++ b/asdc-tests/src/main/resources/ci/scripts/startTest.sh
@@ -31,7 +31,7 @@ fi
LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
#############################################
TARGET_DIR=${FULL_PATH}/target
-CONF_FILE=${FULL_PATH}/conf/sdc.yaml
+CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
DEBUG=true
MainClass=org.openecomp.sdc.ci.tests.run.StartTest
diff --git a/asdc-tests/src/main/resources/ci/testSuites/CRUDArtifacts.xml b/asdc-tests/src/main/resources/ci/testSuites/CRUDArtifacts.xml
new file mode 100644
index 0000000000..e53da8da8a
--- /dev/null
+++ b/asdc-tests/src/main/resources/ci/testSuites/CRUDArtifacts.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="CRUDArtifacts" configfailurepolicy="continue" verbose="2" parallel="tests" thread-count="10">
+
+ <test name="Test">
+ <classes>
+ <class
+ name="org.openecomp.sdc.ci.tests.execute.devCI.CRUDExternalAPI">
+ <methods>
+ <include name="uploadArtifactOnVFViaExternalAPI" />
+ <include name="uploadArtifactOnServiceViaExternalAPI" />
+ <include name="uploadArtifactOnRIViaExternalAPI" />
+ <include name="uploadInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI" />
+ <include name="uploadArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset" />
+ <include name="uploadArtifactOnAssetWhichNotExist" />
+ <include name="uploadArtifactOnAssetWhichInInvalidStateForUploading" />
+
+
+ <include name="updateArtifactForServiceViaExternalAPI" />
+ <include name="updateArtifactForVFViaExternalAPI" />
+ <include name="updateArtifactOnRIViaExternalAPI" />
+ <include name="updateArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset" />
+ <include name="updateArtifactOnAssetWhichNotExist" />
+ <include name="updateArtifactOnAssetWhichInInvalidStateForUploading" />
+ <include name="updateInvalidArtifactTypeExtensionLabelDescriptionCheckSumDuplicateLabelViaExternalAPI" />
+
+
+ <include name="deleteArtifactForServiceViaExternalAPI" />
+ <include name="deleteArtifactForVFViaExternalAPI" />
+ <include name="deleteArtifactOnRIViaExternalAPI" />
+ <include name="deleteArtifactOnVFViaExternalAPIByDiffrentUserThenCreatorOfAsset" />
+ <include name="deleteArtifactOnAssetWhichNotExist" />
+ <include name="deleteArtifactOnAssetWhichInInvalidStateForUploading" />
+ </methods>
+
+ </class>
+
+ </classes>
+ </test> <!-- Test -->
+</suite> <!-- Suite --> \ No newline at end of file
diff --git a/asdc-tests/src/main/resources/ci/testSuites/SearchExternalAPI.xml b/asdc-tests/src/main/resources/ci/testSuites/SearchExternalAPI.xml
new file mode 100644
index 0000000000..40c462a4cb
--- /dev/null
+++ b/asdc-tests/src/main/resources/ci/testSuites/SearchExternalAPI.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="CRUDArtifacts" configfailurepolicy="continue" verbose="2" parallel="tests" thread-count="10">
+
+ <test name="Test">
+ <classes>
+ <class
+ name="org.openecomp.sdc.ci.tests.execute.devCI.SearchFilterCategoryExternalAPI">
+ <methods>
+
+ <include name="searchWithInvalidFilter" />
+ <include name="searchForResourceTypeNegativeTest" />
+ <include name="searchingForResouceFilterIncorrectResouceTypeUsingExternalAPI" />
+ <include name="searchingForSeveralResouceTypesUsingExternalAPI" />
+ <include name="searchingForSeveralResourcesOfTypeVFCMTUsingExternalAPI" />
+ <include name="normativeResourceCategory" />
+ </methods>
+
+ </class>
+
+ </classes>
+ </test> <!-- Test -->
+</suite> <!-- Suite --> \ No newline at end of file
diff --git a/asdc-tests/src/main/resources/ci/testSuites/ciFull.xml b/asdc-tests/src/main/resources/ci/testSuites/ciFull.xml
index 9877670a90..26a85fd9c6 100644
--- a/asdc-tests/src/main/resources/ci/testSuites/ciFull.xml
+++ b/asdc-tests/src/main/resources/ci/testSuites/ciFull.xml
@@ -177,7 +177,7 @@
<exclude name="dissociateOnceAgainTest" />
<exclude name="dissociateRelationNotFoundTest" />
<exclude name="dissoicateRelationWhileInstanceNotFound" />
- <exclude name="dissoicateWithEmptyUserIdsHeaderTest" />
+ <exclude name="dissoicateWithEmptyUserIdHeaderTest" />
<exclude name="relationDeletedAfterDeletingResourceInstanceTest" />
</methods>
</class>
diff --git a/asdc-tests/src/main/resources/ci/testSuites/externalApis.xml b/asdc-tests/src/main/resources/ci/testSuites/externalApis.xml
index 5db368ecf4..393d3b1a3e 100644
--- a/asdc-tests/src/main/resources/ci/testSuites/externalApis.xml
+++ b/asdc-tests/src/main/resources/ci/testSuites/externalApis.xml
@@ -6,6 +6,9 @@
<class name="org.openecomp.sdc.externalApis.GetAssetServlet" />
<class name="org.openecomp.sdc.externalApis.GetFilteredAssetServlet"/>
<class name="org.openecomp.sdc.externalApis.GetSpecificAssetMetadataServlet"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.devCI.CRUDExternalAPI"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.devCI.SearchFilterCategoryExternalAPI"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.externalapi.UserAPIs"/>
</classes>
</test>
</suite> \ No newline at end of file
diff --git a/asdc-tests/src/main/resources/ci/testSuites/resource.xml b/asdc-tests/src/main/resources/ci/testSuites/resource.xml
index 5f23325790..803fb01e70 100644
--- a/asdc-tests/src/main/resources/ci/testSuites/resource.xml
+++ b/asdc-tests/src/main/resources/ci/testSuites/resource.xml
@@ -30,6 +30,30 @@
</methods>
</class>
+ <class name="org.openecomp.sdc.ci.tests.execute.artifacts.InformationalArt">
+ <methods>
+ <include name="UpdateAllResourceMandatoryArtifacts"/>
+ <include name="updateInformationalArtifactMetadataOfResource"/>
+ </methods>
+ </class>
+ <class name="org.openecomp.sdc.ci.tests.execute.artifacts.InformationalArtCloudQuestionnaire">
+ <methods>
+ <include name="updateMandatoryInformationalArtifact_CloudQuestionnaire"/>
+ </methods>
+ </class>
+ <class name="org.openecomp.sdc.ci.tests.execute.artifacts.ServiceApiArtifactTest">
+ <methods>
+ <include name="uploadServiceApiArtifactSuccessfullyTest"/>
+ <include name="updateApiArtifactSuccessfullyTest"/>
+ <include name="deleteApiArtifactSuccessfully"/>
+ </methods>
+ </class>
+ <class name="org.openecomp.sdc.ci.tests.execute.artifacts.ServiceInformationalArtifact">
+ <methods>
+ <include name="updateMandatoryInformationalArtifact_ServiceQuestionnaire"/>
+ </methods>
+ </class>
+
<class name="org.openecomp.sdc.ci.tests.execute.artifacts.ValidateArtResponse"/>
<class name="org.openecomp.sdc.ci.tests.execute.category.CatalogDataApiTest"/>
diff --git a/asdc-tests/src/main/resources/ci/testSuites/sanity.xml b/asdc-tests/src/main/resources/ci/testSuites/sanity.xml
index 11b4b79fc4..8e787bc8cd 100644
--- a/asdc-tests/src/main/resources/ci/testSuites/sanity.xml
+++ b/asdc-tests/src/main/resources/ci/testSuites/sanity.xml
@@ -2,10 +2,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Sanity" configfailurepolicy="continue" verbose="2">
- <listeners>
- <listener class-name="org.openecomp.sdc.ci.tests.run.ExtentReporterNG" />
- </listeners>
-
<test name="sanityE2Eflows">
<classes>
<class name="org.openecomp.sdc.ci.tests.sanity.CrudE2E" />
@@ -69,8 +65,6 @@
</methods>
</class>
-
-
<class name="org.openecomp.sdc.ci.tests.execute.artifacts.ValidateArtResponse" />
@@ -268,15 +262,9 @@
name="org.openecomp.sdc.ci.tests.execute.imports.ImportToscaCapabilitiesWithProperties">
<methods>
<include name="importNodeTypeWithCapabilityWithPropertiesFromYmlSucceed" />
- <!--
- This test require the onboarding simulator.
- <include name="importResourceWithCapabilityWithPropertiesOverridingCapTypePropertiesSucceed" />
- -->
+ <include name="importResourceWithCapabilityWithPropertiesOverridingCapTypePropertiesSucceed" />
</methods>
</class>
- <class
- name="org.openecomp.sdc.ci.tests.execute.imports.CsarUtilsTest">
- </class>
</classes>
</test> <!-- Test -->
diff --git a/asdc-tests/src/test/resources/CI/configuration.yaml b/asdc-tests/src/test/resources/CI/configuration.yaml
index cb91316a21..87fada1b4b 100644
--- a/asdc-tests/src/test/resources/CI/configuration.yaml
+++ b/asdc-tests/src/test/resources/CI/configuration.yaml
@@ -141,7 +141,7 @@ informationalResourceArtifacts:
testScripts:
displayName: Test Scripts
type: OTHER
- cloudQuestionnaire:
+ CloudQuestionnaire:
displayName: Cloud Questionnaire (completed)
type: OTHER
HEATTemplateFromVendor:
@@ -329,10 +329,8 @@ cassandraConfig:
- { name: sdcaudit, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
- { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
-heatEnvArtifactHeader:
- ""
-heatEnvArtifactFooter:
- ""
+heatEnvArtifactHeader: ""
+heatEnvArtifactFooter: ""
onboarding:
protocol: http
@@ -341,23 +339,23 @@ onboarding:
downloadCsarUri: "/onboardingci/onbrest/onboarding-api/v1.0/vendor-software-products/packages"
switchoverDetector:
- gBeFqdn:
- gFeFqdn:
- beVip: 1.2.3.4
- feVip: 1.2.3.4
+ gBeFqdn: AIO-BE.ecomp.idns.cip.com
+ gFeFqdn: AIO-FE.ecomp.idns.cip.com
+ beVip: 0.0.0.0
+ feVip: 0.0.0.0
beResolveAttempts: 3
feResolveAttempts: 3
enabled: false
interval: 60
changePriorityUser: ecompasdc
changePriorityPassword: ecompasdc123
- publishNetworkUrl: "http://localhost/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root"
+ publishNetworkUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root"
publishNetworkBody: '{"note":"publish network"}'
groups:
- beSet: { changePriorityUrl: "http://localhost/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip?user=root",
- changePriorityBody: '{"name":"AIO-BE.ecomp.idns.cip","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'}
- feSet: { changePriorityUrl: "http://cora.web/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip?user=root",
- changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.cip","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip.att.com"}'}
+ beSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip.com?user=root",
+ changePriorityBody: '{"name":"AIO-BE.ecomp.idns.cip.com","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip.com","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'}
+ feSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip.att.com?user=root",
+ changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.cip.com","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip.com"}'}
applicationL1Cache:
@@ -379,4 +377,10 @@ applicationL2Cache:
numberOfCacheWorkers: 4
toscaValidators:
- stringMaxLength: 1024 \ No newline at end of file
+ stringMaxLength: 1024
+
+
+genericAssetNodeTypes:
+ VFC: org.openecomp.resource.abstract.nodes.VFC
+ VF : org.openecomp.resource.abstract.nodes.VF
+ Service: org.openecomp.resource.abstract.nodes.service \ No newline at end of file
diff --git a/asdc-tests/src/test/resources/CI/csars/FCGI_with_inputs.csar b/asdc-tests/src/test/resources/CI/csars/FCGI_with_inputs.csar
index a702c78d25..9c1629eae7 100644
--- a/asdc-tests/src/test/resources/CI/csars/FCGI_with_inputs.csar
+++ b/asdc-tests/src/test/resources/CI/csars/FCGI_with_inputs.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC.csar b/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC.csar
new file mode 100644
index 0000000000..7fc5306bcc
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC_empty.csar b/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC_empty.csar
new file mode 100644
index 0000000000..7a77e2011d
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/ImportArtifactsToVFC_empty.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/LDSA1_with_inputs.csar b/asdc-tests/src/test/resources/CI/csars/LDSA1_with_inputs.csar
index a551ce3263..821b62d48a 100644
--- a/asdc-tests/src/test/resources/CI/csars/LDSA1_with_inputs.csar
+++ b/asdc-tests/src/test/resources/CI/csars/LDSA1_with_inputs.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/ToscaTemplateCsar.csar b/asdc-tests/src/test/resources/CI/csars/ToscaTemplateCsar.csar
new file mode 100644
index 0000000000..e12f45e1b1
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/ToscaTemplateCsar.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar
index a6678a47d1..98e20258b2 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_a.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_a.csar
index ca0ab91e39..98e20258b2 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_a.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_a.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csar
index 890ae20cb3..4668bbefb8 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_b.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_a.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_a.csar
index 68819afc4b..4903bff3b6 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_a.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_a.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_add_update.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_add_update.csar
index 528599e0c5..8398e710b4 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_add_update.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_add_update.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_delete_update.csar b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_delete_update.csar
index 6a708d335f..61a494c092 100644
--- a/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_delete_update.csar
+++ b/asdc-tests/src/test/resources/CI/csars/VF_RI2_G4_withArtifacts_group_naming_delete_update.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/jsonPropertyTypeTest.csar b/asdc-tests/src/test/resources/CI/csars/jsonPropertyTypeTest.csar
index 2aa2ef4582..07118fc014 100644
--- a/asdc-tests/src/test/resources/CI/csars/jsonPropertyTypeTest.csar
+++ b/asdc-tests/src/test/resources/CI/csars/jsonPropertyTypeTest.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2G.csar b/asdc-tests/src/test/resources/CI/csars/orig2G.csar
index 609cd0a8b4..2e8670f1eb 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2G.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2G.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2GV001.csar b/asdc-tests/src/test/resources/CI/csars/orig2GV001.csar
index a7e04cbf10..e6e545ea2f 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2GV001.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2GV001.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2GV001_a.csar b/asdc-tests/src/test/resources/CI/csars/orig2GV001_a.csar
index 07371acaf2..d5a7b47b70 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2GV001_a.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2GV001_a.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2GV006-remove-all-nested-artifacts.csar b/asdc-tests/src/test/resources/CI/csars/orig2GV006-remove-all-nested-artifacts.csar
index ebd95548f8..88cebe44f2 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2GV006-remove-all-nested-artifacts.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2GV006-remove-all-nested-artifacts.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2GV008-change-nested-oam-fileContent.csar b/asdc-tests/src/test/resources/CI/csars/orig2GV008-change-nested-oam-fileContent.csar
index dc75ae1549..7c24de025d 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2GV008-change-nested-oam-fileContent.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2GV008-change-nested-oam-fileContent.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2G_a.csar b/asdc-tests/src/test/resources/CI/csars/orig2G_a.csar
index 2f6ad121a6..9af7501b76 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2G_a.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2G_a.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/orig2G_updated.csar b/asdc-tests/src/test/resources/CI/csars/orig2G_updated.csar
index 1968eabf4b..1a4107811d 100644
--- a/asdc-tests/src/test/resources/CI/csars/orig2G_updated.csar
+++ b/asdc-tests/src/test/resources/CI/csars/orig2G_updated.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vf_relate_by_cap_name.csar b/asdc-tests/src/test/resources/CI/csars/vf_relate_by_cap_name.csar
index f2a7efb69e..eec433e8ff 100644
--- a/asdc-tests/src/test/resources/CI/csars/vf_relate_by_cap_name.csar
+++ b/asdc-tests/src/test/resources/CI/csars/vf_relate_by_cap_name.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csar b/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csar
index d4561a0640..ce1541f32c 100644
--- a/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csar
+++ b/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csar b/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csar
index f145ebd5d2..a2a9ad77c9 100644
--- a/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csar
+++ b/asdc-tests/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vfc_artifacts.csar b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts.csar
new file mode 100644
index 0000000000..8b5f58b7ef
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_delete_all.csar b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_delete_all.csar
new file mode 100644
index 0000000000..a15e7b46c1
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_delete_all.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_update.csar b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_update.csar
new file mode 100644
index 0000000000..af712f1a59
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/csars/vfc_artifacts_update.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar b/asdc-tests/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar
index ada1451cea..63a478939c 100644
--- a/asdc-tests/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar
+++ b/asdc-tests/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/LAN_Connector/LAN_Connector.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/LAN_Connector/LAN_Connector.zip
index 1b02f06386..09c3709ace 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/LAN_Connector/LAN_Connector.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/LAN_Connector/LAN_Connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF/VNF.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF/VNF.zip
index c01081f0ab..95183b48d3 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF/VNF.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF/VNF.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF_Container/VNF_Container.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF_Container/VNF_Container.zip
index a8e006e728..fc1a5e54e8 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF_Container/VNF_Container.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/VNF_Container/VNF_Container.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/WAN_Connector/WAN_Connector.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/WAN_Connector/WAN_Connector.zip
index e193820659..3c558f0603 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/WAN_Connector/WAN_Connector.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/WAN_Connector/WAN_Connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/capabilityTypesWanLan.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/capabilityTypesWanLan.zip
index 869be32b53..9424556f08 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/capabilityTypesWanLan.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/capabilityTypesWanLan.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/connector/connector.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/connector/connector.zip
index 3c37303a3a..203db0e34e 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/connector/connector.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/connector/connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/root/root.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/root/root.zip
index ff604d55a7..af28d79174 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/root/root.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/root/root.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/router/router.zip b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/router/router.zip
index 57ff8e0e2a..f6e2fff528 100644
--- a/asdc-tests/src/test/resources/CI/demoResourcesWanLan/router/router.zip
+++ b/asdc-tests/src/test/resources/CI/demoResourcesWanLan/router/router.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/error-configuration.yaml b/asdc-tests/src/test/resources/CI/error-configuration.yaml
index 6d4e2373fa..33207def3b 100644
--- a/asdc-tests/src/test/resources/CI/error-configuration.yaml
+++ b/asdc-tests/src/test/resources/CI/error-configuration.yaml
@@ -55,7 +55,7 @@ errors:
messageId: "SVC4002"
}
#---------SVC4003------------------------------
-# %1 - Users's USER_ID
+# %1 - Users's USER ID
USER_NOT_FOUND: {
code: 404,
message: "Error: User '%1' was not found.",
@@ -76,7 +76,7 @@ errors:
messageId: "SVC4005"
}
#---------SVC4006------------------------------
-# %1 - Users's USER_ID
+# %1 - Users's USER ID
USER_ALREADY_EXIST: {
code: 409,
message: "Error: User with '%1' ID already exists.",
@@ -89,7 +89,7 @@ errors:
messageId: "SVC4007"
}
#---------SVC4008-----------------------------
-# %1 - Users's userId
+# %1 - Users's USER ID
INVALID_USER_ID: {
code: 400,
message: "Error: Invalid userId '%1'.",
@@ -99,7 +99,7 @@ errors:
# %1 - service/resource
COMPONENT_MISSING_CONTACT: {
code: 400,
- message: "Error: Invalid Content. Missing %1 contact id.",
+ message: "Error: Invalid Content. Missing %1 Contact Id.",
messageId: "SVC4049"
}
#---------SVC4050-----------------------------
@@ -240,9 +240,9 @@ errors:
#---------SVC4069------------------------------
# %1 - Service/Resource/Product
- COMPONENT_INVALID_CONTACT_ID: {
+ 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",
+ 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------------------------------
@@ -506,7 +506,7 @@ errors:
#-----------SVC4130---------------------------
INVALID_PROJECT_CODE: {
code: 400,
- message: "Error: Invalid Content. PROJECT_CODE number must be numeric from 5 up to 10 digits.",
+ message: "Error: Invalid Content. PROJECT_CODE must be from 3 up to 50 characters.",
messageId: "SVC4130"
}
#-----------SVC4131---------------------------
@@ -1055,7 +1055,7 @@ errors:
messageId: "SVC4567"
}
#---------SVC4567------------------------------
-# %1 - "User Name and UserId"
+# %1 - "User Name and USER_ID"
# %2 -"checked-out"/"in-certification"
CANNOT_DELETE_USER_WITH_ACTIVE_ELEMENTS: {
code: 409,
@@ -1063,7 +1063,7 @@ errors:
messageId: "SVC4567"
}
#---------SVC4568------------------------------
-# %1 - "User Name and UserId"
+# %1 - "User Name and USER_ID"
# %2 -"checked-out"/"in-certification"
CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS: {
code: 409,
@@ -1139,7 +1139,7 @@ errors:
messageId: "SVC4580"
}
#---------SVC4581------------------------------
-# %1 - userId
+# %1 - USER_ID
INVALID_PRODUCT_CONTACT: {
code: 400,
message: "Error: Invalid content. User '%1' cannot be set as Product Contact.",
diff --git a/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF .yml.old b/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF .yml.old
new file mode 100644
index 0000000000..cd215933ab
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF .yml.old
@@ -0,0 +1,29 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+
+description: >
+ A Proxy-CSCF (P-CSCF) is a SIP proxy that is the first point of contact for the IMS terminal.
+ It can be located either in the visited network (in full IMS networks) or in the home network
+ (when the visited network is not IMS compliant yet).
+ Some networks may use a Session Border Controller (SBC) for this function.
+ The P-CSCF is at its core a specialized SBC for the User network interface which not only
+ protects the network, but also the IMS terminal.
+ The use of an additional SBC between the IMS terminal and the P-CSCF is unnecessary and
+ infeasible due to the signaling being encrypted on this leg.
+ The terminal discovers its P-CSCF with either DHCP, or it may be configured
+ (e.g. during initial provisioning or via a 3GPP IMS Management Object (MO))
+ or in the ISIM or assigned in the PDP Context (in General Packet Radio Service (GPRS)).
+
+node_types:
+ att.nodes.ims.PCSCF:
+ derived_from: tosca.nodes.SoftwareComponent
+ capabilities:
+ pcscf_endpoint:
+ type: tosca.capabilities.Endpoint.Public
+ relationship: tosca.relationships.ConnectTo
+ occurrences: [0, UNBOUNDED]
+ description: Connection with one ore more UAs
+ requirements:
+ icscf_endpoint:
+ capability: tosca.capabilities.Endpoint
+ node: att.nodes.ims.ICSCF
+ relationship: tosca.relationships.ConnectsTo \ No newline at end of file
diff --git a/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF.json b/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF.json
index bf8ee08d30..8c4e5745ab 100644
--- a/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF.json
+++ b/asdc-tests/src/test/resources/CI/importAttResources/PCSCF/PCSCF.json
@@ -2,7 +2,7 @@
"payloadName": "PCSCF.yml",
"contactId": "jh0003",
"resourceName": "att.nodes.ims.PCSCF",
- "description": "A Proxy-CSCF (P-CSCF) is a SIP proxy that is the first point of contact for the IMS terminal. It can be located either in the visited network (in full IMS networks) or in the home network (when the visited network is not IMS compliant yet). The P-CSCF is at its core a specialized SBC for the User network interface which not onlyprotects the network, but also the IMS terminal. The use of an additional SBC between the IMS terminal and the P-CSCF is unnecessary and infeasible due to the signaling being encrypted on this leg. The terminal discovers its P-CSCF with either DHCP, or it may be configured (e.g. during initial provisioning or via a 3GPP IMS Management Object (MO)) or in the ISIM or assigned in the PDP Context (in General Packet Radio Service (GPRS)).",
+ "description": "A Proxy-CSCF (P-CSCF) is a SIP proxy that is the first point of contact for the IMS terminal. It can be located either in the visited network (in full IMS networks) or in the home network (when the visited network is not IMS compliant yet). Some networks may use a Session Border Controller (SBC) for this function. The P-CSCF is at its core a specialized SBC for the User network interface which not onlyprotects the network, but also the IMS terminal. The use of an additional SBC between the IMS terminal and the P-CSCF is unnecessary and infeasible due to the signaling being encrypted on this leg. The terminal discovers its P-CSCF with either DHCP, or it may be configured (e.g. during initial provisioning or via a 3GPP IMS Management Object (MO)) or in the ISIM or assigned in the PDP Context (in General Packet Radio Service (GPRS)).",
"resourceIconPath": "defaulticon",
"category": "IMS",
"tags": [
diff --git a/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.Cinder/asdc.nodes.network.Cinder.json b/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.Cinder/asdc.nodes.network.Cinder.json
index 4217cd4f07..1538d93b2a 100644
--- a/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.Cinder/asdc.nodes.network.Cinder.json
+++ b/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.Cinder/asdc.nodes.network.Cinder.json
@@ -2,7 +2,7 @@
"payloadName": "asdc.nodes.network.Cinder.yml",
"contactId": "jh0003",
"name": "asdc.nodes.network.Cinder",
- "description": "Represents access to cloud shared storae.",
+ "description": "Represents access to Cloud shared storae.",
"resourceIconPath": "network",
"category": "Generic/Network Elements",
"tags": [
diff --git a/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.OAM/asdc.nodes.network.OAM.json b/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.OAM/asdc.nodes.network.OAM.json
index 161897ac22..bb9560be88 100644
--- a/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.OAM/asdc.nodes.network.OAM.json
+++ b/asdc-tests/src/test/resources/CI/importResource-MMSC/asdc.nodes.network.OAM/asdc.nodes.network.OAM.json
@@ -2,7 +2,7 @@
"payloadName": "asdc.nodes.network.OAM.yml",
"contactId": "jh0003",
"name": "asdc.nodes.network.OAM",
- "description": "Represents AT&T Operation, Administration and Management (OA&M) network.",
+ "description": "Represents Operation, Administration and Management (OA&M) network.",
"resourceIconPath": "network",
"category": "Generic/Network Elements",
"tags": [
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/VCE_Brocade_Tosca.yaml b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/VCE_Brocade_Tosca.yaml
index da71792698..aecef6260d 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/VCE_Brocade_Tosca.yaml
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/VCE_Brocade_Tosca.yaml
@@ -325,13 +325,13 @@ node_types:
description: I Input provided at DESIGN TIME by Service Composer or Designer - password for login
domain_name:
type: string
- description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each Cloud Region) - login domain
+ description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each cloud Region) - login domain
time_zone:
type: string
- description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each Cloud Region) - time zone to set for vCE
+ description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each cloud Region) - time zone to set for vCE
login_session_timeout:
type: string
- description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each Cloud Region) - user login session timeout
+ description: Input provided at DESIGN TIME by Service Composer or Designer or (perhaps pre-defined for each cloud Region) - user login session timeout
ipag_vlan_bandwidth:
type: integer
description: Input provided at DESIGN TIME by Service Composer or Designer - bandwidth allocation of customer VLAN requested by customer
@@ -343,54 +343,54 @@ node_types:
description: Input provided at DESIGN TIME by Service Composer or Designer - QoS Policy name to be applied to this interface
hostname:
type: string
- description: Input provided at RUN TIME by Cloud-PO - Host VM is created first and this value is input when the vCE image is later on installed by Cloud-PO
+ description: Input provided at RUN TIME by cloud-PO - Host VM is created first and this value is input when the vCE image is later on installed by cloud-PO
host_ip:
type: string
- description: Input provided at RUN TIME by Cloud-PO - Host VM IP
+ description: Input provided at RUN TIME by cloud-PO - Host VM IP
availability_zone:
type: string
- description: Input provided at RUN TIME by Cloud-PO - Cloud availability zone where VM is created
+ description: Input provided at RUN TIME by cloud-PO - cloud availability zone where VM is created
oam_loopback_vlan_ip_address:
type: string
- description: Input provided at RUN TIME by Cloud-PO - OAM Network is pre-created - already exists in Data Center
+ description: Input provided at RUN TIME by cloud-PO - OAM Network is pre-created - already exists in Data Center
ipag_vlan_ip_address:
type: string
- description: Input provided at RUN TIME by Cloud-PO - IPAG VLAN Network is created by Cloud-PO before the vCE is created or installed
+ description: Input provided at RUN TIME by cloud-PO - IPAG VLAN Network is created by cloud-PO before the vCE is created or installed
vpe_vlan_ip_address:
type: string
- description: Input provided at RUN TIME by Cloud-PO - VPE VLAN Network is created by Cloud-PO before the vCE is created / installed
+ description: Input provided at RUN TIME by cloud-PO - VPE VLAN Network is created by cloud-PO before the vCE is created / installed
vpe_vlan_id:
type: string
- description: Input provided at RUN TIME by Cloud-PO - VLAN Id is created first by Cloud-PO. It is required to apply VPE QoS Policy
+ description: Input provided at RUN TIME by cloud-PO - VLAN Id is created first by cloud-PO. It is required to apply VPE QoS Policy
ipag_vlan_id:
type: string
- description: Input provided at RUN TIME by Cloud-PO - VLAN Id is created first by Cloud-PO. It is required to apply IPAG QoS Policy
+ description: Input provided at RUN TIME by cloud-PO - VLAN Id is created first by cloud-PO. It is required to apply IPAG QoS Policy
oam_vlan_interface_name:
type: string
- description: Input provided at RUN TIME by Cloud-PO - This interfce is created first by Cloud-PO. This is the interface to which QoS policy is applied
+ description: Input provided at RUN TIME by cloud-PO - This interfce is created first by cloud-PO. This is the interface to which QoS policy is applied
vpe_vlan_interface_name:
type: string
- description: Input provided at RUN TIME by Cloud-PO - This interfce is created first by Cloud-PO. This is the interface to which QoS policy is applied
+ description: Input provided at RUN TIME by cloud-PO - This interfce is created first by cloud-PO. This is the interface to which QoS policy is applied
ipag_vlan_interface_name:
type: string
- description: Input provided at RUN TIME by Cloud-PO - This interfce is created first by Cloud-PO. This is the interface to which QoS policy is applied
- #############ATTRIBUTES of vCE - These values are outputted by Cloud-PO when vCE is created / installed ##############
+ description: Input provided at RUN TIME by cloud-PO - This interfce is created first by cloud-PO. This is the interface to which QoS policy is applied
+ #############ATTRIBUTES of vCE - These values are outputted by cloud-PO when vCE is created / installed ##############
attributes:
vce_name:
type: string
- description: Name assigned to vCE by Cloud-PO
+ description: Name assigned to vCE by cloud-PO
oam_loopback_vlan_ipaddres:
type: string
- description: IP Address assigned by Cloud-PO to OAM VLAN
+ description: IP Address assigned by cloud-PO to OAM VLAN
ipag_vlan_ipaddres:
type: string
- description: IP Address assigned by Cloud-PO to IPAG VLAN
+ description: IP Address assigned by cloud-PO to IPAG VLAN
vpe_vlan_ipaddres:
type: string
- description: IP Address assigned by Cloud-PO to VPE VLAN
+ description: IP Address assigned by cloud-PO to VPE VLAN
vnf_id:
type: string
- description: unique id assigned to VNF by Cloud-PO - used for AAI metadata
+ description: unique id assigned to VNF by cloud-PO - used for AAI metadata
#############CAPABILITIES of vCE - #########################
capabilities:
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/capabilityTypes.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/capabilityTypes.zip
index 75f56d4c76..7f1a513fc1 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/capabilityTypes.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/capabilityTypes.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector.zip
index 31ddc8cbf6..a7ba8119d9 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector/org.openecomp.resource.nfv.CP.IPAG_VLAN_Connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector.zip
index 2076fb039b..f7ebded1d9 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector/org.openecomp.resource.nfv.CP.OAM_VLAN_Connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector.zip
index 5808fc9338..cabbde3ac8 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector/org.openecomp.resource.nfv.CP.VPE_VLAN_Connector.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP/org.openecomp.resource.nfv.CP.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP/org.openecomp.resource.nfv.CP.zip
index 0fd24994f9..708d20f99f 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP/org.openecomp.resource.nfv.CP.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.CP/org.openecomp.resource.nfv.CP.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.json
index 95673b81ff..4fa3fe9bf4 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.vdu.RoutingCategoryVDU.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"name": "org.openecomp.resource.nfv.vdu.RoutingCategoryVDU",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.zip
index 3853a341b0..68f16aaa96 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU/org.openecomp.resource.nfv.VDU.RoutingCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU.zip
index 1d5b041a88..47e3cbff2a 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU/org.openecomp.resource.nfv.VDU.VCE_Brocade_VDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU/org.openecomp.resource.nfv.VDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU/org.openecomp.resource.nfv.VDU.zip
index 569a8b2a44..9e5c12189a 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU/org.openecomp.resource.nfv.VDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/org.openecomp.resource.nfv.VDU/org.openecomp.resource.nfv.VDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.json
index e17b474385..d0f60bb7e3 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"resourceName": "org.openecomp.resource.nfv.VDU.DHCPCategoryVDU",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml
index 64f150e73e..04aac7300e 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.yaml
@@ -3,7 +3,7 @@
##################################################################
org.openecomp.resource.nfv.VDU.DHCPCategoryVDU:
derived_from: org.openecomp.resource.nfv.VDU
- capabilities: #paharoni - added to connect to VCE_Brocade_VDU
+ capabilities: #paronin - added to connect to VCE_Brocade_VDU
dhcp:
type: org.openecomp.capabilities.nfv.VNF.DHCPCapability
description: This capability has been introduced
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.zip
index d60b15698c..d55698f3e6 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU/org.openecomp.resource.nfv.VDU.DHCPCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.json
index 8c419d17d3..ca0f2c9ea8 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.VDU.DNSCategoryVDU.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"resourceName": "org.openecomp.resource.nfv.VDU.DNSCategoryVDU",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.zip
index e927ad3d2a..f036a2fdd9 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.DNSCategoryVDU/org.openecomp.resource.nfv.VDU.DNSCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU.zip
index 548b64ed17..aa453f0912 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU/org.openecomp.resource.nfv.VDU.FirewallCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.json
index be8f6fd133..67762f8c60 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"resourceName": "org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.zip
index 93ef2905f6..708d8a8521 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU/org.openecomp.resource.nfv.VDU.NetworkAddrCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU.zip
index 0bad67331b..ce987de81f 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU/org.openecomp.resource.nfv.VDU.PortAddrCategoryVDU.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VL/org.openecomp.resource.nfv.VL.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VL/org.openecomp.resource.nfv.VL.zip
index b6d19de95b..a5029cd710 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VL/org.openecomp.resource.nfv.VL.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VL/org.openecomp.resource.nfv.VL.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.json
index 6e68301bcb..d191fe14cc 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"resourceName": "org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.zip
index 158f917ee8..403a7b8281 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF/org.openecomp.resource.nfv.VNF.VCE_Brocade_VNF.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.json b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.json
index 18ce8bbca5..2106ae9ff7 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.json
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.json
@@ -1,6 +1,6 @@
{
"payloadName": "org.openecomp.resource.nfv.VNF.yaml",
- "contactId": "jh0003",
+ "attContact": "jh0003",
"resourceName": "org.openecomp.resource.nfv.VNF",
"description": "Node Type that represents a Module",
"resourceIconPath": "defaulticon",
diff --git a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.zip b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.zip
index 2b8e33d71a..1e14315fa7 100644
--- a/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.zip
+++ b/asdc-tests/src/test/resources/CI/importResource-VCE-Brocade/resourcesToFix/org.openecomp.resource.nfv.VNF/org.openecomp.resource.nfv.VNF.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/Derived_VFC.json b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/Derived_VFC.json
new file mode 100644
index 0000000000..a26149e8e5
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/Derived_VFC.json
@@ -0,0 +1,26 @@
+{
+ "payloadName": "normative-types-new-Derived_VFC.yml",
+ "contactId": "jh0003",
+ "name": "ciDerivedVFC",
+ "description": "Represents a real or virtual machine or server. Information specified on the Compute
+ node will be used to find the machine that fits the given requirements in the cloud
+ available machines. If no sizing information are specified the cloud provider default
+ machine will be used. It is strongly recommended to specify the required CPUs and memory
+ at least.",
+ "resourceIconPath": "defaulticon",
+ "categories": [
+ {
+ "name": "Generic",
+ "subcategories": [
+ {
+ "name": "Infrastructure"
+ }
+ ]
+ }
+],
+ "tags": [
+ "ciDerivedVFC"
+ ],
+ "vendorName": "UserVendor",
+ "vendorRelease": "1.1.1"
+} \ No newline at end of file
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.yml b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.yml
new file mode 100644
index 0000000000..949fa6e633
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.yml
@@ -0,0 +1,5 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ org.openecomp.resource.vfc.nodes.VFCderive:
+ derived_from: org.openecomp.resource.abstract.nodes.VFC
+
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.zip b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.zip
new file mode 100644
index 0000000000..dcc9eb37db
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/Derived_VFC/normative-types-new-Derived_VFC.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/empty_contact/normative-types-new-empty_contact.zip b/asdc-tests/src/test/resources/CI/importResourceTests/empty_contact/normative-types-new-empty_contact.zip
index bee0ffef8f..a91defb4f6 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/empty_contact/normative-types-new-empty_contact.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/empty_contact/normative-types-new-empty_contact.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/empty_resource_name/normative-types-new-empty_resource_name.zip b/asdc-tests/src/test/resources/CI/importResourceTests/empty_resource_name/normative-types-new-empty_resource_name.zip
index 940a74ab05..6146cb8524 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/empty_resource_name/normative-types-new-empty_resource_name.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/empty_resource_name/normative-types-new-empty_resource_name.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/empty_tag/normative-types-new-empty_tag.zip b/asdc-tests/src/test/resources/CI/importResourceTests/empty_tag/normative-types-new-empty_tag.zip
index cd75d64a89..069b3d1979 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/empty_tag/normative-types-new-empty_tag.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/empty_tag/normative-types-new-empty_tag.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4test/normative-types-new-importResource4test.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4test/normative-types-new-importResource4test.zip
index eb69428cf1..facd591e1d 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4test/normative-types-new-importResource4test.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4test/normative-types-new-importResource4test.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testCP/normative-types-new-importResource4testCP.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testCP/normative-types-new-importResource4testCP.zip
index be77395250..9efacc69eb 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testCP/normative-types-new-importResource4testCP.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testCP/normative-types-new-importResource4testCP.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testMissingNameSpace/normative-types-new-importResource4testMissingNameSpace.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testMissingNameSpace/normative-types-new-importResource4testMissingNameSpace.zip
index 3160c73fe7..688fe84b5f 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testMissingNameSpace/normative-types-new-importResource4testMissingNameSpace.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testMissingNameSpace/normative-types-new-importResource4testMissingNameSpace.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUnknown/normative-types-new-importResource4testUnknown.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUnknown/normative-types-new-importResource4testUnknown.zip
index 67b81c3d7f..5e2b0ac582 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUnknown/normative-types-new-importResource4testUnknown.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUnknown/normative-types-new-importResource4testUnknown.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateVendorNameAndCategory/normative-types-new-importResource4testUpdateVendorNameAndCategory.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateVendorNameAndCategory/normative-types-new-importResource4testUpdateVendorNameAndCategory.zip
index a092a1c14b..bf42a80ed9 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateVendorNameAndCategory/normative-types-new-importResource4testUpdateVendorNameAndCategory.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateVendorNameAndCategory/normative-types-new-importResource4testUpdateVendorNameAndCategory.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateWithoutReqCap/normative-types-new-importResource4testUpdateWithoutReqCap.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateWithoutReqCap/normative-types-new-importResource4testUpdateWithoutReqCap.zip
index 3005f9231f..75622b7c25 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateWithoutReqCap/normative-types-new-importResource4testUpdateWithoutReqCap.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testUpdateWithoutReqCap/normative-types-new-importResource4testUpdateWithoutReqCap.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVF/normative-types-new-importResource4testVF.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVF/normative-types-new-importResource4testVF.zip
index 46c652fd24..b6ccc062eb 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVF/normative-types-new-importResource4testVF.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVF/normative-types-new-importResource4testVF.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVFC/normative-types-new-importResource4testVFC.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVFC/normative-types-new-importResource4testVFC.zip
index 0ca8098ff9..97daa8e401 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVFC/normative-types-new-importResource4testVFC.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVFC/normative-types-new-importResource4testVFC.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVL/normative-types-new-importResource4testVL.zip b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVL/normative-types-new-importResource4testVL.zip
index 9a1a28b1f6..5d3a7e6b50 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVL/normative-types-new-importResource4testVL.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/importResource4testVL/normative-types-new-importResource4testVL.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_category/normative-types-new-missing_category.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_category/normative-types-new-missing_category.zip
index 51a01c1bb9..7a458426b4 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_category/normative-types-new-missing_category.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_category/normative-types-new-missing_category.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_contact/normative-types-new-missing_contact.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_contact/normative-types-new-missing_contact.zip
index 21d14a9a73..d89b711cdb 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_contact/normative-types-new-missing_contact.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_contact/normative-types-new-missing_contact.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_desc/normative-types-new-missing_desc.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_desc/normative-types-new-missing_desc.zip
index bd5174df62..6cdde04c67 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_desc/normative-types-new-missing_desc.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_desc/normative-types-new-missing_desc.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_icon/normative-types-new-missing_icon.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_icon/normative-types-new-missing_icon.zip
index 45d8e192f1..5a53c7b5bf 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_icon/normative-types-new-missing_icon.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_icon/normative-types-new-missing_icon.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_payloadName/normative-types-new-missing_payloadName.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_payloadName/normative-types-new-missing_payloadName.zip
index 3a72360c25..2de80ad97a 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_payloadName/normative-types-new-missing_payloadName.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_payloadName/normative-types-new-missing_payloadName.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_resource_name/normative-types-new-missing_resource_name.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_resource_name/normative-types-new-missing_resource_name.zip
index 24294b9647..b6ae3ba9ad 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_resource_name/normative-types-new-missing_resource_name.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_resource_name/normative-types-new-missing_resource_name.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/missing_tags/normative-types-new-missing_tags.zip b/asdc-tests/src/test/resources/CI/importResourceTests/missing_tags/normative-types-new-missing_tags.zip
index 1d619e8c93..0ad7b6ee05 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/missing_tags/normative-types-new-missing_tags.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/missing_tags/normative-types-new-missing_tags.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/userCompute/normative-types-new-userCompute.zip b/asdc-tests/src/test/resources/CI/importResourceTests/userCompute/normative-types-new-userCompute.zip
index bda162b32f..895d397728 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/userCompute/normative-types-new-userCompute.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/userCompute/normative-types-new-userCompute.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/userUpdateCompute/normative-types-new-userUpdateCompute.zip b/asdc-tests/src/test/resources/CI/importResourceTests/userUpdateCompute/normative-types-new-userUpdateCompute.zip
index 3ecead7579..25a0312031 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/userUpdateCompute/normative-types-new-userUpdateCompute.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/userUpdateCompute/normative-types-new-userUpdateCompute.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueInit/normative-types-new-validateProporties_typeBoolean_valueInit.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueInit/normative-types-new-validateProporties_typeBoolean_valueInit.zip
index 6eb2d7e7af..46dc70477b 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueInit/normative-types-new-validateProporties_typeBoolean_valueInit.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueInit/normative-types-new-validateProporties_typeBoolean_valueInit.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueString/normative-types-new-validateProporties_typeBoolean_valueString.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueString/normative-types-new-validateProporties_typeBoolean_valueString.zip
index 538ba0e3ef..5cc2e4f916 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueString/normative-types-new-validateProporties_typeBoolean_valueString.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeBoolean_valueString/normative-types-new-validateProporties_typeBoolean_valueString.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueBoolean/normative-types-new-validateProporties_typeFloat_valueBoolean.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueBoolean/normative-types-new-validateProporties_typeFloat_valueBoolean.zip
index a577aeb1e3..9ac3bb72e4 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueBoolean/normative-types-new-validateProporties_typeFloat_valueBoolean.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueBoolean/normative-types-new-validateProporties_typeFloat_valueBoolean.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueString/normative-types-new-validateProporties_typeFloat_valueString.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueString/normative-types-new-validateProporties_typeFloat_valueString.zip
index a9ec4d791e..88d67edc48 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueString/normative-types-new-validateProporties_typeFloat_valueString.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeFloat_valueString/normative-types-new-validateProporties_typeFloat_valueString.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueBoolean/normative-types-new-validateProporties_typeInit_valueBoolean.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueBoolean/normative-types-new-validateProporties_typeInit_valueBoolean.zip
index 9e76fbee46..04b32e1dee 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueBoolean/normative-types-new-validateProporties_typeInit_valueBoolean.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueBoolean/normative-types-new-validateProporties_typeInit_valueBoolean.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueFloat/normative-types-new-validateProporties_typeInit_valueFloat.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueFloat/normative-types-new-validateProporties_typeInit_valueFloat.zip
index 91b69dd746..b224b70d40 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueFloat/normative-types-new-validateProporties_typeInit_valueFloat.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueFloat/normative-types-new-validateProporties_typeInit_valueFloat.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueString/normative-types-new-validateProporties_typeInit_valueString.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueString/normative-types-new-validateProporties_typeInit_valueString.zip
index 747e215071..d7eb9f59b1 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueString/normative-types-new-validateProporties_typeInit_valueString.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeInit_valueString/normative-types-new-validateProporties_typeInit_valueString.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeList_valueUrlCredential/normative-types-new-validateProporties_typeList_valueUrlCredential.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeList_valueUrlCredential/normative-types-new-validateProporties_typeList_valueUrlCredential.zip
index 10b1ce10ac..7fee84c8a5 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeList_valueUrlCredential/normative-types-new-validateProporties_typeList_valueUrlCredential.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeList_valueUrlCredential/normative-types-new-validateProporties_typeList_valueUrlCredential.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeMap_valueUrlCredential/normative-types-new-validateProporties_typeMap_valueUrlCredential.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeMap_valueUrlCredential/normative-types-new-validateProporties_typeMap_valueUrlCredential.zip
index 9a8f093d95..c7e65e7068 100644
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeMap_valueUrlCredential/normative-types-new-validateProporties_typeMap_valueUrlCredential.zip
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeMap_valueUrlCredential/normative-types-new-validateProporties_typeMap_valueUrlCredential.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeMap.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeMap.zip
deleted file mode 100644
index e8f0470948..0000000000
--- a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeMap.zip
+++ /dev/null
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeTestDataType.zip b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeTestDataType.zip
new file mode 100644
index 0000000000..27ce7bc887
--- /dev/null
+++ b/asdc-tests/src/test/resources/CI/importResourceTests/validateProporties_typeTestDataType/normative-types-new-validateProporties_typeTestDataType.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack1/myHeatStack1.zip b/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack1/myHeatStack1.zip
index ee57b02826..2619853f4b 100644
--- a/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack1/myHeatStack1.zip
+++ b/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack1/myHeatStack1.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack2/myHeatStack2.zip b/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack2/myHeatStack2.zip
index 1d75c7f4d0..7f43af70eb 100644
--- a/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack2/myHeatStack2.zip
+++ b/asdc-tests/src/test/resources/CI/importTypesTest/myHeatStack2/myHeatStack2.zip
Binary files differ
diff --git a/asdc-tests/src/test/resources/CI/tests/importToscaResourceByCreateUrl/CPWithAttributes.yml b/asdc-tests/src/test/resources/CI/tests/importToscaResourceByCreateUrl/CPWithAttributes.yml
index afafe7510b..807f7fe630 100644
--- a/asdc-tests/src/test/resources/CI/tests/importToscaResourceByCreateUrl/CPWithAttributes.yml
+++ b/asdc-tests/src/test/resources/CI/tests/importToscaResourceByCreateUrl/CPWithAttributes.yml
@@ -1,8 +1,7 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
node_types:
- org.openecomp.resource.cp.CP:
- derived_from: tosca.nodes.Root
+ org.openecomp.resource.cp.CP: derived_from: tosca.nodes.Root
properties:
type:
type: string
@@ -52,8 +51,6 @@ node_types:
type: tosca.datatypes.network.PortInfo
requirements:
- virtualLink:
- capability: tosca.capabilities.network.Linkable
- relationship: tosca.relationships.network.LinksTo
+ capability: tosca.capabilities.network.Linkable relationship: tosca.relationships.network.LinksTo
- virtualbinding:
- capability: tosca.capabilities.network.Bindable
- relationship: tosca.relationships.network.BindsTo \ No newline at end of file
+ capability: tosca.capabilities.network.Bindable relationship: tosca.relationships.network.BindsTo \ No newline at end of file
diff --git a/asdc-tests/tarball.xml b/asdc-tests/tarball.xml
deleted file mode 100644
index 18bc00854f..0000000000
--- a/asdc-tests/tarball.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>bin</id>
- <formats>
- <format>tar</format>
- </formats>
- <files>
- <file>
- <source>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</source>
- <outputDirectory>./</outputDirectory>
- <destName>${project.artifactId}-${project.version}-jar-with-dependencies.jar</destName>
- </file>
- <file>
- <source>src/main/resources/ci/scripts/startTest.sh</source>
- <outputDirectory>./</outputDirectory>
- <destName>startTest.sh</destName>
- </file>
- <!--file>
- <source>src/main/resources/ci/scripts/postinstall</source>
- <outputDirectory>./</outputDirectory>
- <destName>postinstall</destName>
- </file-->
- <file>
- <source>src/main/resources/ci/conf/sdc.yaml</source>
- <outputDirectory>conf</outputDirectory>
- <destName>sdc.yaml</destName>
- </file>
- <file>
- <source>src/main/resources/ci/conf/sdc-packages.yaml</source>
- <outputDirectory>conf</outputDirectory>
- <destName>sdc-packages.yaml</destName>
- </file>
- <file>
- <source>src/main/resources/ci/conf/log4j.properties</source>
- <outputDirectory>conf</outputDirectory>
- <destName>log4j.properties</destName>
- </file>
- <file>
- <source>src/main/resources/ci/conf/titan.properties</source>
- <outputDirectory>conf</outputDirectory>
- <destName>titan.properties</destName>
- </file>
- <file>
- <source>${project.basedir}/../catalog-be/src/main/resources/config/error-configuration.yaml</source>
- <outputDirectory>conf</outputDirectory>
- <destName>error-configuration.yaml</destName>
- </file>
- <file>
- <source>${project.basedir}/../catalog-be/src/main/resources/config/configuration.yaml</source>
- <outputDirectory>conf</outputDirectory>
- <destName>configuration.yaml</destName>
- </file>
-
-
-
- </files>
-
- <fileSets>
- <fileSet>
- <directory>src/test/resources</directory>
- <outputDirectory>./</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/main/resources/ci/testSuites</directory>
- <outputDirectory>./testSuites</outputDirectory>
- </fileSet>
-
- </fileSets>
-
-</assembly>